########################################################################
sub see_if_from_listed_sender {
local $alias;
local $goober;
local $sendto;
local $x;
local $y;
# Now we'll check to see if this is -list- mail intended for a local
# recipient. (Note: This case covers both true 'mailing list' email
# and also personal email sent to members of a personal distribution
# list.) Such mail can arrive with either the name of the list
# or something like 'Multiple recipients of ABC-L" in the 'To:'
# line, in which case 'for' can be holding the true address and 'for'
# and 'To:' won't be the same. This gives us a chance to use the
# '$goober' trick on the Subject line... If 'To:' is not set the
# same as 'for', we'll rewrite it and keep a record of what 'To:'
# was saying in a new 'Was-to:' (just in case...)
#
# '_senders.lst' is our local file of "known regular senders".
# It's holding one-per-line records like so:
#
# infobeat news jeff.gordon@wellnow.com
#
# ...where I (jeff.gordon) am the only one receiving email from
# InfoBeat. (We need an additional solution for those cases in
# which there are multiple receivers from the same source.)
open (SENDERS,"f:/mr2/pollpop/_senders.lst") or die "eek! - senders";
if (defined SENDERS)
{
while (<SENDERS>)
{
($alias, $goober, $sendto) = split;
if ((index( $header{"From:"}, $alias ) > -1 ) &&
(index( $header{"for"}, $sendto ) > -1 ))
{
# Half-baked logic here; might need 'To:' field instead...?
# Problem is, some mail is 'for' and 'To:' a list
# address -- which doesn't yet tell us -who- it's to
# be delivered to. Suppose multiple local recipients
# exist for the same mail list, and only the envelope
# that got it to the POP server has that name...?
# If we were to match -each- recipient of that list,
# then we'd be sure it got delivered...perhaps multiple
# times to each one, though, delivering on a one-to-many
# basis for each arriving piece of list mail...
#
# At present I'm on a mail list where this problem is
# actually present. I'm receiving the list's posts at
# two different addresses, with two different POP servers.
# Mail from one server matches this 'rule' and arrives with
# its correct 'goober' on the Subject: line -- but the same
# post, coming through the other server, does not, because
# the header information is enough different between the two
# servers as to produce that result.
#
# Presumably, -both- servers saw correct and useful information
# in the -envelopes- to these email posts -- but they aren't
# passing that along to me when I 'pop' the mail from them.
unless ($goober eq "''")
{
$header{"Subject:"} = "($goober) $header{\"Subject:\"}";
}
unless (($x = lc $header{"To:"}) && ($x =~ /.*$sendto.*/))
{
$header{"Was-To:"} = $header{"To:"};
}
$header{"To:"} = "$sendto";
$recipient ++;
last;
}
}
close (SENDERS) or die "eek! -- senders";
}
} # end of see_if_from_listed_sender