default color: lavender w/red vlinks)
change to: default, lav, whi, gra, ora

Mail-Penguin::Main::Fetch::Redirect: See If for and To: are Same

last updated: Sunday, 24-Jan-1999 02:50:30 EST
[an error occurred while processing this directive]   visit to this page
[ write to Jeff ]

########################################################################
sub see_if_for_and_to_are_same {
    local $x;
    local $y;
        
# If 'for' and 'To:' are the same, there's a good chance we now
# know who this email is for -- but not always. :-) Some mail
# servers write 'for' and 'To:' as the maillist name, and don't
# include the true recipient's name -anywhere- within the header
# (though presumably it's present in the 'envelope' somewhere.
# We'll add '1' to $recipient if we find a match, but clearly
# we have reason to keep going anyway, even if they do match.
# We'll set $recipient to '1', though, indicating we've found
# one 'clue' to who this email is for.

    if ((defined $header{"for"}) && (defined $header{"To:"}))
    {

# We'll lc both header fields, then match (//) for items
# immediately adjacent to an 'at' sign.  It's generally true
# (meaning, I haven't thus far found an exception to it) that
# the 'for' field will contain a properly-formed, angle-
# bracketed address, and will terminate with a semi-colon.
# We -removed- the brackets and semi-colon earlier, so
# if what's on either side of that 'at' sign is also found
# on either side of the 'at' sign in the 'To: field, we win.

	$x = lc $header{"for"};
        $y = lc $header{"To:"};
        $x =~ /(.*)\@(.*)/;
        if ($y =~ /.*$1\@$2.*/)
        {
            print "for and To are same: $y\n";
            $recipient = 1;
        }
    }
} # end of sub see_if_for_and_to_are_same

[ back to Redirect | to sub see_if_from_listed_sender ]