qpsmtpd/plugins/check_badrcptto
John Peacock 1d0f889d3c Support for RFC 1893 - Enhanced Mail System Status Codes
Patch by Hanno Hecker <hah@uu-x.de>.

Adds the RFC 1893 status codes to the messages which are returned to the
sending client.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@602 958fd67b-6ff1-0310-b445-bb7760255be9
2006-01-25 02:59:31 +00:00

20 lines
705 B
Plaintext

# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
use Qpsmtpd::DSN;
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 Qpsmtpd::DSN->no_such_user("mail to $bad not accepted here")
if $bad eq $from;
return Qpsmtpd::DSN->no_such_user("mail to $bad not accepted here")
if substr($bad,0,1) eq '@' && $bad eq "\@$host";
}
return (DECLINED);
}