Here are the subroutines I use to get the information to send as well as send the mail. The To, from, Subject, information are all passed to this script from a form. I've tried to remove the "!!" from $article, with the no luck. I imagine that it's adding that information when it clears a buffer or something.

I'm using an ISP to host my site and don't think I can use MAIL::SEND. I'll look into it.

#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 "<html><body>\n"; &get_mailtext; print MAIL "<font face=\"helvetica, arial, sans-serif, verdana\" size= +\"2\">\n"; print MAIL "<b>$FORM{'fromname'} ($FORM{'emailfrom'}) </b>has sent you + a news article.</a></font><br><br>\n"; if ($FORM{'msg'} ne "") { print MAIL "<font face=\"helvetica, arial, sans-serif, verdana\" size= +\"2\"><b>Personal Message:</b><br>$FORM{'msg'}<br><br></font>\n"; } print MAIL "<font face=\"helvetica, arial, sans-serif, verdana\" size= +\"2\" color=\"#006633\"><b>$FORM{'title'}</b></font><br><font face=\" +helvetica, arial, sans-serif, verdana\" size=\"2\"><a href=\"$FORM{'l +ink'}\">Link to article</a><br><br><hr size=\"1\" noshade></font>\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/\<html\>//g; $article =~ s/\<\/html\>//g; print MAIL "<div align=\"center\"><font face=\"helvetica, arial, sans- +serif, verdana\" size=\"2\" color=\"#006633\"><b>$headline</b></font> +<br>\n"; print MAIL "<font face=\"helvetica, arial, sans-serif, verdana\" size= +\"1\">$byline</font><br><br></div>\n"; print MAIL "<font face=\"helvetica, arial, sans-serif, verdana\" size= +\"2\">\n"; print MAIL "$article\n"; print MAIL "</font><br><br><font face=\"helvetica, arial, sans-serif, +verdana\" size=\"1\">$disclosure<br><br>$p_offerh<br><br>\n"; print MAIL "&#169; 2001 All rights reserved.</font></body></html>\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=<DATABASE>; 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 inves +t or send money.\n"; $p_offerh = "Please read the information carefully before you inve +st or send money.\n"; $disclosure = "$Temp[6]"; } } flock(DATABASE, $LOCK_UN); close(DATABASE); }

2001-03-29 Edit by Corion : Added formatting and CODE tags.


In reply to Re: Re: I'm getting garbage in email from Sendmail by Anonymous Monk
in thread I'm getting garbage in email from Sendmail by NodeReaper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.