#!/usr/bin/perl # # Alter the message before it is delivered to add headers to it. # # Steve # -- 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; # # Store hosts. # $transaction->header->add( 'X-HELO', $helo ); $transaction->header->add( 'X-REMOTE-IP', $remote_ip ); $transaction->header->add( 'X-REMOTE-HOST', $remote_host ); # # Store sender & recipient # my $sender = $transaction->sender->address || undef; $transaction->header->add( 'X-MAIL-FROM', $sender ) if ( $sender ); my @to = transaction->recipients || undef; $transaction->header->add( 'X-RCPT-TO', join( " ", @to ) ) if ( @to && scalar( @to ) ); # # All done # return DECLINED; }