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)");