Improve error messages from the Postfix module (Erik I. Bols�,

<knan at mo.himolde.no>)

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
This commit is contained in:
Ask Bjørn Hansen 2004-07-19 11:08:15 +00:00
parent 154ca2e617
commit e27534048c
3 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,9 @@
[ many changes from cvs logs, gah ] [ many changes from cvs logs, gah ]
Improve error messages from the Postfix module (Erik I. Bolsø,
<knan at mo.himolde.no>)
Mail::Address does RFC822 addresses, we need SMTP addresses. Mail::Address does RFC822 addresses, we need SMTP addresses.
Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module. Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module.

View File

@ -93,6 +93,7 @@ sub open_cleanup {
my ($class) = @_; my ($class) = @_;
my $self = IO::Socket::UNIX->new(Type => SOCK_STREAM, my $self = IO::Socket::UNIX->new(Type => SOCK_STREAM,
Peer => "/var/spool/postfix/public/cleanup"); Peer => "/var/spool/postfix/public/cleanup");
die qq[Couldn't open unix socket "/var/spool/postfix/public/cleanup": $!] unless ref $self;
bless ($self, $class); bless ($self, $class);
$self->init(); $self->init();
return $self; return $self;

View File

@ -19,6 +19,8 @@ use Time::HiRes qw(gettimeofday);
sub register { sub register {
my ($self, $qp, @args) = @_; my ($self, $qp, @args) = @_;
# TODO: support per user/domain/? maildirs
if (@args > 0) { if (@args > 0) {
($self->{_maildir}) = ($args[0] =~ m!([/\w\.]+)!); ($self->{_maildir}) = ($args[0] =~ m!([/\w\.]+)!);
} }
@ -51,6 +53,10 @@ sub queue_handler {
my $file = join ".", $time, $unique, $self->{_hostname}; my $file = join ".", $time, $unique, $self->{_hostname};
my $maildir = $self->{_maildir}; 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 open (MF, ">$maildir/tmp/$file") or
$self->log(LOGWARN, "could not open $maildir/tmp/$file: $!"), $self->log(LOGWARN, "could not open $maildir/tmp/$file: $!"),
return(DECLINED, "queue error (open)"); return(DECLINED, "queue error (open)");