Solved

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

Posted on 2006-06-13
7
867 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
perl script help 5 233
pattern matching in perl 2 101
Perl Awk Need Help 3 109
Edit Odbc.ini using perl module 2 78
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now