fix default reason handling

Tomas Lee <j533xdbjwfgdbsv@jetable.net> pointed out that
cab7466c08 broke the default badmailfrom
reason.

This fixes that functionality and simplifies the code a little.
This commit is contained in:
Robert 2009-06-22 22:44:38 -07:00
parent 7efee7b1af
commit 6345b62e82

View File

@ -36,11 +36,9 @@ sub hook_mail {
my $host = lc $sender->host;
my $from = lc($sender->user) . '@' . $host;
for my $bad (@badmailfrom) {
my $reason = $bad;
$reason =~ s/^\s*(\S+)[\t\s]+//;
for my $config (@badmailfrom) {
my ($bad, $reason) = $config =~ /^\s*(\S+)(?:\s*(.*)\s*)?$/;
$reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason;
$bad =~ s/^\s*(\S+).*/$1/;
next unless $bad;
$bad = lc $bad;
$self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/;