90daeb3786
The great plugin renaming in the name of inheritance and standardization commit. 1. new concept of standard hook_ names. 2. Plugin::init 3. renamed many subroutines in plugins (and cleaned up register subs) 4. updated README.plugins git-svn-id: https://svn.perl.org/qpsmtpd/trunk@479 958fd67b-6ff1-0310-b445-bb7760255be9
45 lines
1.0 KiB
Plaintext
45 lines
1.0 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) = @_;
|
|
|
|
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 hook_queue {
|
|
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
|