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

Mail-Penguin::Main::Fetch: Redirect

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

######################################################
# sub redirect -- compares elements of header with
# entries in disk file lists for 'lists', 'aliases',
# 'senders', to determine where this piece of mail
# should be delivered.  This specifically serves
# situations in which multiple recipients are sharing
# one POP box
######################################################

sub redirect {
    local ($recipient);
    local ($alias);
    local ($goober);
    local ($sendto);
    local ($list_alias);
      
    $recipient = 0;

    	# We'll first check to see if this is
        # an incoming post to a local mail list

    &see_if_outgoing_list_message;

    	# If we found a match on that test, variable
        # $recipient will now be holding the value 99.
        # We'll test for that and 'return' if true.

    if ($recipient == 99) { return; }

    	# If not for a local mail list, we'll next
        # look to see if the 'for' and the 'To:'
        # addresses are the same.  If they are, that's
        # a good indication we know who this email is for.

    &see_if_for_and_to_are_same;

    	# Regardless of what we found on examining
        # 'for' and 'To:', we'll next check to see if this
        # is from a "known" sender, one that's in a list
        # we're maintaining in a file.  If we find a match,
        # we can take this opportunity to prepend a small
        # tag on the Subject: line to help visually identify
        # the source of this email to the recipient of it.

    &see_if_from_listed_sender;
    
    	# And finally we'll see if this email is addressed
        # to a "known alias" of one of our local users.  This
        # is a final check (in case we haven't identified
        # the recipient with our other tests) and also another
        # opportunity to add a tag to the Subject: line.

    &see_if_for_local_user_alias unless $recipient > 1;

    	# At this point, if variable $recipient is still
        # holding value 0, it means we don't have a useful
        # clue about the identity of the recipient.  So we'll
        # direct this email to lost_letter_recipient, which
        # could be a 'live' person or a designated "dead letter"
        # location.

    if ($recipient == 0) { &give_to_lost_letter_receiver; }

        # If we get here, we're ready to send it, somewhere.
        # If the item was found to be for outgoing list mail,
        # we've already sent it and 'returned' before now.

    &send_message;

} # End of sub redirect

[ back to Fetch | to sub see_if_outgoing_list_message ]