[Mimedefang] canonicalize_email error

Jan Pieter Cornet johnpc at xs4all.nl
Mon May 9 20:06:03 EDT 2005


On Thu, May 05, 2005 at 01:05:11PM +0900, alan premselaar wrote:
>  You need to actually define a subroutine called "canonicalize_email" 
> in the filter as well.
> 
> mine looks like:
> 
> sub canonicalize_email ($) {
>         my ($email) = @_;
> 
>         $email =~ s/^<//;
>         $email =~ s/>$//;
> 
>         return lc($email);
> }
> 
> basically all it does is remove any < or > from the email and return it 
> in lowercase.

Have you considered

RCPT To:< "aL\ien+foo"@mail.12inch.com.>

which your mailer could accept as valid and deliver to you (Except
that in your case, you're not accepting mail to the hostname of
your MX, which is good, but in some cases that or something similar
might be configured).

I've got a somewhat monstrous routine that will actually rewrite this
to a canonicalized email address, and it does a loose RFC2821 compliance
check too (somewhat less monstrous than the last chapter of mastering
regular expressions, though).

Specifically, I've seen cases with additional spaces, dots, and plussed
user parts appear in spam. Dunno if that was intentional or ratware
operator thick fingering, but it flew past our filters the first few
times.

Hmm... and I now notice that my IPv6 address literal parsing is
slightly flawed, but nobody is likely to have noticed that since we
do not support IPv6 on those mailservers (yet). I'll fix that and
post what I've got tomorrow, it might be useful to people.

-- 
#!perl -wpl # mmfppfmpmmpp mmpffm <pmmppfmfpppppfmmmf at fpffmm4mmmpmfpmf.ppppmf>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig;                                # Jan-Pieter Cornet



More information about the MIMEDefang mailing list