#this subroutine opens the mailing program and sends the emails #if a copy has been requested, it sends that out, too. sub mail_article { open(MAIL,"|$mailprog -t"); if ($z == 2) { print MAIL "To: $emailname\n"; } else { print MAIL "To: $FORM{'emailto'}\n"; } print MAIL "From: \"$FORM{'fromname'}\" \<$FORM{'emailfrom'}\>\n"; print MAIL "X-IP_Address: $ENV{REMOTE_ADDR}\n"; print MAIL "Subject: $FORM{'title'}\n"; if ($FORM{'atype'} eq "full") { print MAIL "Content-Type: text/html\n"; } else { print MAIL "Content-Type: text/plain; charset=\"us-ascii\"\n"; } $printline = 0; if ($FORM{'atype'} eq "full") { print MAIL "\n"; &get_mailtext; print MAIL "\n"; print MAIL "$FORM{'fromname'} ($FORM{'emailfrom'}) has sent you a news article.

\n"; if ($FORM{'msg'} ne "") { print MAIL "Personal Message:
$FORM{'msg'}

\n"; } print MAIL "$FORM{'title'}
Link to article


\n"; } #output only the link else { print MAIL "$FORM{'fromname'} ($FORM{'emailfrom'}) has sent you a news article.\n\n\n"; if ($FORM{'msg'} ne "") { print MAIL "Personal Message:\n"; print MAIL "$FORM{'msg'}\n\n"; } print MAIL "$FORM{'title'}\n"; print MAIL "$FORM{'link'}\n\n\n"; print MAIL "----------------------------------------------------"; } if ($FORM{'atype'} eq "full") { $count = 1; if ($count == "1") { $article =~ s/\//g; $article =~ s/\<\/html\>//g; print MAIL "
$headline
\n"; print MAIL "$byline

\n"; print MAIL "\n"; print MAIL "$article\n"; print MAIL "

$disclosure

$p_offerh

\n"; print MAIL "© 2001 All rights reserved.
\n"; } $count++; } else { #print MAIL "\n$disclosure\n\n"; #print MAIL "$p_offer\n\n"; } close MAIL; #opens the database file to get the information to mail sub get_mailtext { #variables $LOCK_EX = 2; $LOCK_UN = 8; open (DATABASE, "./file.txt"); #open database for reading flock(DATABASE, $LOCK_EX); @data=; foreach $Story (@data) { my $temptitle = $FORM{'title'}; my $id = $FORM{'id'}; @Temp = split(/\|/, $Story); if (($Temp[2] eq "$temptitle") && ($Temp[0] eq "$id")) { $id = "$Temp[0]"; $headline = "$Temp[2]"; $byline = "$Temp[3]"; $article = "$Temp[5]"; $article =~ s/\! \! //g; $article =~ s/\!\!//g; $p_offer = "Please read the information carefully before you invest or send money.\n"; $p_offerh = "Please read the information carefully before you invest or send money.\n"; $disclosure = "$Temp[6]"; } } flock(DATABASE, $LOCK_UN); close(DATABASE); }