On Mon Jun 22, 2009 at 13:23:38 +0000, b-sub-0bfe...@rope.net wrote:

> I'd like to retrieve the HOSTNAME. Can someone please point out how to get
> that information into a plugin? Thanks.

  This is a complete plugin I use to log some details into new
 headers for messages:

use Qpsmtpd::Constants;

sub hook_data_post
{
    my ( $self, $transaction ) = (@_);

    # get the sender + ip + helo name for logging.
    my $remote_ip   = $self->qp->connection->remote_ip;
    my $remote_host = $self->qp->connection->remote_host;
    my $helo        = $self->qp->connection->hello_host;

    # from + to
    my $from = $transaction->sender->address || "<>";
    my $to  = join( " ", $transaction->recipients );

    $transaction->header->add( 'X-HELO-Host',   $helo );
    $transaction->header->add( 'X-Remote-IP',   $remote_ip );
    $transaction->header->add( 'X-Remote-Host', $remote_host );

    $transaction->header->add( 'X-MAIL-FROM', $from);
    $transaction->header->add( 'X-RCPT-TO',   $to);

    $transaction->header->add( "X-Plugin-Name", $self->plugin_name() );
    return DECLINED;
}

  
Steve
--

Reply via email to