2002-09-10 13:00:31 +02:00
|
|
|
# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
|
|
|
|
|
2005-07-07 06:17:39 +02:00
|
|
|
sub hook_rcpt {
|
2002-09-10 13:00:31 +02:00
|
|
|
my ($self, $transaction, $recipient) = @_;
|
2002-09-10 19:17:15 +02:00
|
|
|
my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED);
|
2002-09-10 13:00:31 +02:00
|
|
|
return (DECLINED) unless $recipient->host && $recipient->user;
|
|
|
|
my $host = lc $recipient->host;
|
2004-06-18 07:47:45 +02:00
|
|
|
my $from = lc($recipient->user) . '@' . $host;
|
2002-09-10 13:00:31 +02:00
|
|
|
for my $bad (@badrcptto) {
|
2004-06-18 07:47:45 +02:00
|
|
|
$bad = lc $bad;
|
2002-09-10 13:00:31 +02:00
|
|
|
$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")
|
2004-04-21 14:42:45 +02:00
|
|
|
if substr($bad,0,1) eq '@' && $bad eq "\@$host";
|
2002-09-10 13:00:31 +02:00
|
|
|
}
|
|
|
|
return (DECLINED);
|
|
|
|
}
|