1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#!perl -w
=head1 NAME
dont_require_anglebrackets
=head1 SYNOPSIS
accept addresses in MAIL FROM:/RCPT TO: commands without surrounding <>
=head1 DESCRIPTION
RFC821 requires that email addresses presented during the SMTP conversation
be enclosed in angle brackets. Like this:
MAIL FROM:<user@example.com>
This plugin relaxes that requirement, accepting messages in this format:
MAIL FROM:user@example.com
=cut
sub hook_mail_pre {
my ($self, $transaction, $addr) = @_;
unless ($addr =~ /^<.*>$/) {
$addr = '<' . $addr . '>';
$self->adjust_karma(-2);
$self->log(LOGINFO, "fail, added MAIL angle brackets");
}
return (OK, $addr);
}
sub hook_rcpt_pre {
my ($self, $transaction, $addr) = @_;
unless ($addr =~ /^<.*>$/) {
$addr = '<' . $addr . '>';
$self->adjust_karma(-2);
$self->log(LOGINFO, "fail, added RCPT angle brackets");
}
return (OK, $addr);
}
|