> Therefore i programmed this new plugin.
By accident i've send an buggy development version instead of my latest
version. Please see the attached file for a running version.
-kju
--
It's an insane world, but i'm proud to be a part of it. -- Bill Hicks
#
# maillog
# a qpsmtpd plugin for mail logging
#
# This plugin logs the relevant details like sending host, envelope sender,
# envelope recipient and size to the logfile after a mail got accepted
#
# written by Michael Holzt, <kju -at- debian.org>
# last modified on September 3th, 2004
#
sub register {
my ($self, $qp) = @_;
$self->register_hook("data_post", "maillog");
}
sub maillog {
my ($self, $transaction) = @_;
my $recipient;
my $loglevel = $self->qp->config("maillog_level") || 7;
# log envelope sender
$self->log($loglevel, "mail from: " . $transaction->sender->format);
# log all envelope recipients
foreach $recipient ( $transaction->recipients )
{
$self->log($loglevel, "rcpt to: " . $recipient->format);
}
# log mail size
$self->log($loglevel, "mail size: " . $transaction->body_size . " bytes");
# log remote hostname and ip
$self->log($loglevel, "tcp client: " . $self->qp->connection->remote_host .
" [" . $self->qp->connection->remote_ip . "]");
# log whether this is an relay client
$self->log($loglevel, "relay client: " . ( $transaction->{_relaying} ? "yes" : "no"
) );
return DECLINED;
}