2004-02-19 11:55:36 +01:00
|
|
|
=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];
|
2004-06-05 12:07:03 +02:00
|
|
|
$self->log(LOGWARN, "WARNING: Ignoring additional arguments.") if (@args > 1);
|
2004-02-19 11:55:36 +01:00
|
|
|
} 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
|