Solved

SENDMAIL: Adding a "!  " to my email ?!????!?

Posted on 2006-06-13
7
868 Views
Last Modified: 2008-03-04
I'm sending an email using sendmail, and it mysteriously and randomly seems to place an exclamation mark and then a space or two ("! ") in the link URL, link, or doesn't end the a href tag where it should (will end at the end of the message sometimes). Here is the code i am using, any ideas what could be causing this??

Thanks

__________________________________________________

$r=time . '.' . $$  ;

my @mailnames=split(/ *, */,$email) ;
foreach(@mailnames) {

$link = CGI::escapeHTML($link);

#INSERT INTO DATABASE

$link = CGI::unescapeHTML($link);

$emaillink = "http://www.server.com/test.html?id=$r";
$emaillinklow = "http://www.server.com/test.html?id=$r&highspeed=no";

my $message;

$message = "<html><head><title>test</title></head><style type=\"text/css\">body, td, input, select, textarea { font-size: 13px; font-family: Trebuchet MS,  Verdana, Arial, Sans-Serif; }</style><body bgcolor=#FFFFFF marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><table border=0 cellpadding=0 width=600 cellspacing=0><tr><td valign=top align=left><img src=\"http://www.server.com/images/$background.jpg\"></td></tr><tr><td valign=top align=left><table border=0 cellpadding=3 cellspacing=3><tr><td align=left valign=top>$newemailcontent<br><br><a href=\"$emaillink\"><b>$link</b></a><br><a href=\"$emaillinklow\"><b>$link - For Dial-up</b></a><br><br>$newsignature</body></html>";

open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";

print SENDMAIL "to: $_\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
print SENDMAIL "Reply-to: $fromname <$fromemail>\n";
print SENDMAIL "Return-Path: $fromemail\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";

print SENDMAIL $message;

print SENDMAIL "\n\n";

close(SENDMAIL);

}
0
Comment
Question by:jmingo
  • 2
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Perl_Diver
ID: 16896771
looks like the same question you posted before. Close your other threads if that's the case, if not what is new abiut the problem? Nobody really answered before because this does not appear to have anything to do with perl. There is no reason I can think of why perl would insert random-ish characters.
0
 
LVL 8

Expert Comment

by:Perl_Diver
ID: 16896784
You might also attract more attention if the answer were worth 500 points.
0
 

Author Comment

by:jmingo
ID: 16896896
could peoples email clients/systems possibly be doing something to it do you suppose?
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 25

Accepted Solution

by:
clockwatcher earned 75 total points
ID: 16899830
Try throwing in some CRLFs ("\n") in there somewhere.  The SMTP RFC limits line length to 998 characters and some mail systems force that by throwing in an exclamation point followed by a CRLF.  It's a common problem with Microsoft's ASP.Net System.Web.Mail.  Maybe that's what you're running into.  It shouldn't be in the sample that you posted, but maybe you've hit a mail system which has an even shorter line length set.  RFC 2822 recommends line lengths of under 78 characters.

http://www.faqs.org/rfcs/rfc2822.html --

2.1.1. Line Length Limits

   There are two limits that this standard places on the number of
   characters in a line. Each line of characters MUST be no more than
   998 characters, and SHOULD be no more than 78 characters, excluding
   the CRLF.

   The 998 character limit is due to limitations in many implementations
   which send, receive, or store Internet Message Format messages that
   simply cannot handle more than 998 characters on a line. Receiving
   implementations would do well to handle an arbitrarily large number
   of characters in a line for robustness sake. However, there are so
   many implementations which (in compliance with the transport
   requirements of [RFC2821]) do not accept messages containing more
   than 1000 character including the CR and LF per line, it is important
   for implementations not to create such messages.

   The more conservative 78 character recommendation is to accommodate
   the many implementations of user interfaces that display these
   messages which may truncate, or disastrously wrap, the display of
   more than 78 characters per line, in spite of the fact that such
   implementations are non-conformant to the intent of this
   specification (and that of [RFC2821] if they actually cause
   information to be lost). Again, even though this limitation is put on
   messages, it is encumbant upon implementations which display messages

   to handle an arbitrarily large number of characters in a line
   (certainly at least up to the 998 character limit) for the sake of
   robustness.

0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 16899837
0
 

Author Comment

by:jmingo
ID: 16902151
clockwatcher: i think that might be it.... thanks a lot!! i will fix that.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Syslog text file into database or into .CSV 19 144
Perl - Mawk 2 96
Perl Sort Question 4 136
XPath Syntax help in conjunction with perl XML::LibXML 18 113
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question