> I'd suggest if a name is followed by an exclamation mark, this means do a
> DENYHARD, otherwise it does a plain DENY (ie "tim" - will reject this
> recipient, "tim !" will reject all emails that include "tim" amongst the
> recipients).
I think it would be cleaner to do this as a wrapped plugin and two
separate config files.[1]
check_badrcptto_hard:
sub register {
my $self = shift;
$self->isa_plugin("check_badrcptto");
$self->SUPER::register(@_);
}
sub check_for_badrcptto {
my $self = $_[0];
my $r = $self->SUPER::check_for_badrcptto( @_ );
$r = DENYHARD if $r == DENY;
return $r;
}
config/plugins:
check_badcrptto badrcptto
check_badcrptto_hard badrcptto_hard
patch for check_badrcptto:
diff -u -u -p -r1.4 check_badrcptto
--- check_badrcptto 18 Jun 2004 05:47:45 -0000 1.4
+++ check_badrcptto 20 Feb 2005 19:34:40 -0000
@@ -1,13 +1,15 @@
# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
sub register {
- my ($self, $qp) = @_;
+ my ($self, $qp, @args) = @_;
$self->register_hook("rcpt", "check_for_badrcptto");
+
+ ($self->{_configfile}) = $args[0] || "badrcptto";
}
sub check_for_badrcptto {
my ($self, $transaction, $recipient) = @_;
- my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED);
+ my @badrcptto = $self->qp->config( $self->{_configfile } ) or return
(DECLINED);
return (DECLINED) unless $recipient->host && $recipient->user;
my $host = lc $recipient->host;
my $from = lc($recipient->user) . '@' . $host;
Footnotes:
[1] I think the plugin patch actually would let you do this without
the wrapping, but wrapping is fun.