qpsmtpd/plugins/queue/postfix-queue
Ask Bjørn Hansen 76e1119a5e loglevel change
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@234 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-05 10:07:03 +00:00

46 lines
1.1 KiB
Plaintext

=head1 NAME
postfix-queue
=head1 DESCRIPTION
This plugin passes mails on to the postfix cleanup daemon.
=head1 CONFIG
It takes one optional parameter, the location of the cleanup socket.
If set the environment variable POSTFIXQUEUE overrides this setting.
=cut
use Qpsmtpd::Postfix;
sub register {
my ($self, $qp, @args) = @_;
$self->register_hook("queue", "queue_handler");
if (@args > 0) {
$self->{_queue_socket} = $args[0];
$self->log(LOGWARN, "WARNING: Ignoring additional arguments.") if (@args > 1);
} else {
$self->{_queue_socket} = "/var/spool/postfix/public/cleanup";
}
$self->{_queue_socket} = $ENV{POSTFIXQUEUE} if $ENV{POSTFIXQUEUE};
}
sub queue_handler {
my ($self, $transaction) = @_;
my ($status, $qid, $reason) = Qpsmtpd::Postfix->inject_mail($transaction);
$status and return(DECLINED, "Unable to queue message ($status, $reason)");
my $msg_id = $transaction->header->get('Message-Id') || '';
$msg_id =~ s/[\r\n].*//s; # don't allow newlines in the Message-Id here
return (OK, "Queued! $msg_id (Queue-Id: $qid)");
}
#vim: sw=2 ts=8