[Mimedefang] Monitoring Selected User Emails
Matthew.van.Eerde at hbinc.com
Matthew.van.Eerde at hbinc.com
Thu Sep 9 13:59:25 EDT 2004
Matthew.van.Eerde wrote:
> David F. Skoll wrote:
>> On Wed, 8 Sep 2004, Ted Beaton wrote:
>>
>>> if ($recip = user at somewhere.com) {
Or if I wanted to get really crazy I'd do something like
sub email_lists_overlap(\@@);
sub lists_overlap(\@@);
sub canonify_email($);
...
if ( email_lists_overlap(
@Recipients,
( 'user1 at example.com',
'"Billie Joe" <Billie-Joe at example.com>',
'<>',
)
)
)
{ ...
}
...
sub email_lists_overlap(\@@)
{ my @first = @{ shift };
my @second = @_;
@first = map { canonify_email($_} } @first;
@second = map { canonify_email($_) } @second;
return lists_overlap(@first, @second);
}
sub lists_overlap(\@@)
{ my @first = @{ shift };
my @second = @_;
my %hash = ();
for my $element (@first)
{ $hash{$element} = 1;
}
for my $element (@second)
{ return 1 if $hash{$element};
}
return 0;
}
sub canonify_email($)
{ my $raw_email = shift;
my $canonical_email = $raw_email;
# canonify the email here...
$canonical_email = lc $canonical_email; # standardize on lowercase
... etc.
return $canonical_email;
}
More information about the MIMEDefang
mailing list