[Mimedefang] Monitoring Selected User Emails

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Thu Sep 9 13:40:25 EDT 2004


David F. Skoll wrote:
> On Wed, 8 Sep 2004, Ted Beaton wrote:
> 
>>               if ($recip = user at somewhere.com) {
> 
> That's invalid perl.  Should be:
> 
> 	if ($recip eq '<user at somewhere.com>') {
> 

Can the @Recipients collection be counted upon to have <> and lc pre-applied?
Erring on the side of caution I'd go with something like

	if ($recip =~ /^<?user at somewhere\.com>?$/i) {

myself.

Or maybe do something like

sub canonify_email($);
... and then ...
 	if (	canonify_email($recip) eq
		canonify_email('user at somewhere.com')
	) {
... and finally ...
sub canonify_email($)
{	my $raw_email = shift;
	my $canonical_email = $raw_email;

	# subject $canonical_email to various tortuous manipulations here...
	$canonical_email = lc $canonical_email; # transform uppercase to lowercase
	$canonical_email =~ s/"[^"]*"//g; # take out anything in quotes
	$canonical_email =~ s/^\s*//; # remove initial whitespace
	$canonical_email =~ s/^<//; # remove initial <
	$canonical_email =~ s/>$//; # remove final >
	... etc (haven't reread RFC's in a while)

	return $canonical_email;
}

Matthew.van.Eerde at hbinc.com                      805.964.4554 x902
Hispanic Business Inc./HireDiversity.com         Software Engineer
perl -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"



More information about the MIMEDefang mailing list