diff --git a/plugins/check_badmailfrom b/plugins/check_badmailfrom index 70e8292..c30cac5 100644 --- a/plugins/check_badmailfrom +++ b/plugins/check_badmailfrom @@ -8,10 +8,15 @@ sub register { sub mail_handler { my ($self, $transaction, $sender) = @_; - return (DECLINED) unless $sender->host && $sender->user; + my @badmailfrom = $self->qp->config("badmailfrom") + or return (DECLINED); + + return (DECLINED) unless ($sender->format ne "<>" + and $sender->host && $sender->user); + my $host = lc $sender->host; my $from = $sender->user . '@' . $host; - my @badmailfrom = $self->qp->config("badmailfrom"); + for my $bad (@badmailfrom) { $bad =~ s/^\s*(\S+)/$1/; $transaction->notes('badmailfrom', "Mail from $bad not accepted here") diff --git a/plugins/check_badrcptto b/plugins/check_badrcptto index d4ceb03..e65c247 100644 --- a/plugins/check_badrcptto +++ b/plugins/check_badrcptto @@ -7,10 +7,10 @@ sub register { sub check_for_badrcptto { my ($self, $transaction, $recipient) = @_; + my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED); return (DECLINED) unless $recipient->host && $recipient->user; my $host = lc $recipient->host; my $from = $recipient->user . '@' . $host; - my @badrcptto = $self->qp->config("badrcptto"); for my $bad (@badrcptto) { $bad =~ s/^\s*(\S+)/$1/; return (DENY, "mail to $bad not accepted here")