Per the todo list, here is a plugin to restrict <> from sending to more
than one recipient.
Brian
=head1 NAME
nullsender1rcpt - restrict <> from sending to more than one recipient
=head1 DESCRIPTION
Disallows more than one envelope recipient if the envelope sender is <>.
Drops all recipients if >1 recipient from <>.
=cut
sub register {
my $self = shift;
$self->register_hook("mail", "mail_handler");
$self->register_hook("rcpt", "rcpt_handler");
$self->register_hook("data_post", "data_handler");
}
sub mail_handler {
my ($self, $transaction, $address) = @_;
if( $address->address eq '<>' ) {
$self->{_nullsender1rcpt_count} = 1;
}
else {
$self->{_nullsender1rcpt_count} = 1;
}
return DECLINED;
}
sub respond {
my $self = shift;
if( $self->{_nullsender1rcpt_count} > 2) { # 1 sender + 1 rcpt = 2
$self->qp->respond(553, "Null sender cannot send to more than one
recipient.");
return DONE;
}
return DECLINED;
}
sub rcpt_handler {
my $self = shift;
++$self->{_nullsender1rcpt_count} if $self->{_nullsender1rcpt_count} > 0;
return $self->respond();
}
sub data_handler {
my $self = shift;
return $self->respond();
}