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

Mail-Penguin::Main::Fetch::Redirect: See If Outgoing List Message

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

###################################################################
# sub see_if_outgoing_list_message -- Check to see if
# this is incoming maillist mail for a list that originates
# here with us.  We'll presume that if it is, the 'for' line
# will show it, while the 'To:' line may not, as could be the
# case when someone sends list mail as a 'Cc:' on a letter in
# which s/he was addressing one specific list member, or when
# sharing with the list something s/he'd written in private
# correspondence with someone off the list.
#
# '$goober' is a small optional 'tag' that can be prepended to the
# Subject line, e.g., 'abc' if this is Almost Beautiful Cars-L
###################################################################
sub see_if_outgoing_list_message {
    local $list_alias;
    local $goober;
    local $to_text;
    local $sendto_list_file;
    local @list_addresses;

# "_lists.lst" is our file for local-origin mail lists:
# with one-line entries such as:
#
#  owl.net|ORTN|Multiple members of Owl Network|f:\mr2\owllist.lst|
#
# ...where 'owl.net' is the maillist posting address at wellnow.com
# ...ORTN is the 'goober' that will be prepended in 'Subject:'
# ...Multiple members etc. will appear in the 'To:' field
# ...and 'owlist.lst' contains the addresses of list recipients

    open (LISTS,"f:/mr2/pollpop/_lists.lst") or die "eek! - lists";
    if (defined LISTS)
    { 
      while (<LISTS>)
      {
        ($list_alias, $goober, $to_text, $sendto_list_file) =
            split(/\|/,$_);

# We'll 'lc' (lowercase) the email header items, just in case...

	$x = lc $header{"for"};
        $y = lc $header{"To:"};

# ...and use 'index' to see if we've got a match.  With
# 'index' we can ignore extraneous 'To:' info.  It says'
# "If $list_alias is anywhere in $x or $y, we'll take it."

	if ((index($x, $list_alias) > -1) ||
            (index($y, $list_alias) > -1))
        {

# Then we'll plug $to_text into the 'To:' field, and set
# $recipient equal to 99 (so no further checks will be
# done by the Redirect subroutine).

	    $header{"To:"} = "$to_text"; # e.g., 'Multiple recipients'
            $recipient = 99;
            $list_addresses = "";

# If $goober is holding '', we won't modify the Subject field.
# If it's holding more than that, we'll prepend what it's
# holding to the Subject: line as an identifying tag.

	    unless ($goober eq "''")
            {
                $header{"Subject:"} = "($goober) $header{\"Subject:\"}";
            }

# Now we'll open the file containing addresses of list members...

	    open (LISTMEMBERS,$sendto_list_file) or die "eek! -- dist.list";
            if (defined LISTMEMBERS)
            {
                while (<LISTMEMBERS>)
                {

# ...and use match (//) to eliminate angle brackets
# and any trailing text -- because later the SMTP.pm
# method '$smtp->to' will be placing its own angle
# brackets around -all- of what it's passed -- and
# build a list array of those addresses to send to.

	      	    $_ =~ /^<?(\S*\@\S*)>?.*$/;
                    @list_addresses = (@list_addresses, $1);

		} # end of while
            } # end of if (defined LISTMEMEBERS)

	    close (LISTMEMBERS) or die "eek! -- dist.list";

	    &send_message;

            last;

	} # end of if($index...
      } # end of while LISTS

      close (LISTS) or die "eek! -- lists";

    } # end of if defined LISTS
  } # end of sub see_if_outgoing_list_message

[ back to Redirect | to sub see_if_for_and_to_are_same ]