qpsmtpd/plugins/check_badrcptto

19 lines
647 B
Plaintext
Raw Normal View History

# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
sub hook_rcpt {
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 = lc($recipient->user) . '@' . $host;
for my $bad (@badrcptto) {
$bad = lc $bad;
$bad =~ s/^\s*(\S+)/$1/;
return (DENY, "mail to $bad not accepted here")
if $bad eq $from;
return (DENY, "mail to $bad not accepted here")
if substr($bad,0,1) eq '@' && $bad eq "\@$host";
}
return (DECLINED);
}