From e27534048cd3230b21cf0b8d0f23707a8060f094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Mon, 19 Jul 2004 11:08:15 +0000 Subject: [PATCH] =?UTF-8?q?Improve=20error=20messages=20from=20the=20Postf?= =?UTF-8?q?ix=20module=20(Erik=20I.=20Bols=EF=BF=BD,=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make the maildir plugin record who the message was to (needs some improvements still) git-svn-id: https://svn.perl.org/qpsmtpd/trunk@277 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 3 +++ lib/Qpsmtpd/Postfix.pm | 1 + plugins/queue/maildir | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/Changes b/Changes index 571b500..00f6caa 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ [ many changes from cvs logs, gah ] + Improve error messages from the Postfix module (Erik I. Bolsų, + ) + Mail::Address does RFC822 addresses, we need SMTP addresses. Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module. diff --git a/lib/Qpsmtpd/Postfix.pm b/lib/Qpsmtpd/Postfix.pm index 82fc344..bf594ca 100644 --- a/lib/Qpsmtpd/Postfix.pm +++ b/lib/Qpsmtpd/Postfix.pm @@ -93,6 +93,7 @@ sub open_cleanup { my ($class) = @_; my $self = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => "/var/spool/postfix/public/cleanup"); + die qq[Couldn't open unix socket "/var/spool/postfix/public/cleanup": $!] unless ref $self; bless ($self, $class); $self->init(); return $self; diff --git a/plugins/queue/maildir b/plugins/queue/maildir index c7da488..1bdc871 100644 --- a/plugins/queue/maildir +++ b/plugins/queue/maildir @@ -19,6 +19,8 @@ use Time::HiRes qw(gettimeofday); sub register { my ($self, $qp, @args) = @_; + # TODO: support per user/domain/? maildirs + if (@args > 0) { ($self->{_maildir}) = ($args[0] =~ m!([/\w\.]+)!); } @@ -51,6 +53,10 @@ sub queue_handler { my $file = join ".", $time, $unique, $self->{_hostname}; my $maildir = $self->{_maildir}; + # TODO: deliver the mail once per recipient instead + $transaction->header->add('Delivered-To', $_->address, 0) + for $transaction->recipients; + open (MF, ">$maildir/tmp/$file") or $self->log(LOGWARN, "could not open $maildir/tmp/$file: $!"), return(DECLINED, "queue error (open)");