Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.8.0

Bug #18819 Empty message sent when body starts with a dot + LF character
Submitted: 2011-09-09 13:50 UTC
From: alec Assigned: jon
Status: Closed Package: Net_SMTP (version SVN)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    

 [2011-09-09 13:50 UTC] alec (Aleksander Machniak)
Description: ------------ The alone dot in a line is not replaced with two dots when it is on the beginning of the body. $body = ".\ntext"; $headers = "Subject: test"; $SMTP->data($body, $headers);


 [2011-09-09 14:47 UTC] alec (Aleksander Machniak)
Another possibility of wrong dot handling is when body is a file handle to data stream with lonely dots in some lines, because it is parsed using fgets(). Consider text: "aaaaa . bbbbb ." I think any of dots here will be dot-stuffed. I think quotedata() should contain additional code, e.g.: if ($data == '.' || substr($data, 0, 3) == ".\r\n") $data = '.' . $data;
 [2011-09-09 14:48 UTC] alec (Aleksander Machniak)
It should be "I think none of dots here will be dot-stuffed." above.
 [2011-09-18 13:17 UTC] doconnor (Daniel O'Connor)
Thanks for hte report alec, for those of us not super familar with the package; what's the expected vs actual output of your test case? Expected: .. text Actual: . text ?
 [2011-09-18 13:18 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
 [2011-09-18 14:56 UTC] alec (Aleksander Machniak)
Exactly. In SMTP protocol <CR><LF>.<CR><LF> sequence is used as end of data mark. So, when it appears in the body it must be replaced with <CR><LF>..<CR><LF>.
 [2011-09-19 06:39 UTC] jon (Jon Parise)
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: jon
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2011-09-19 13:39 UTC] alec (Aleksander Machniak)
-Status: Closed +Status: Open
The fix is wrong. See test case. "xxx.\" => "xxx.\r\", There's no line feed after the second dot. No need to dot-stuff it.
 [2011-09-26 11:05 UTC] jon (Jon Parise)
-Status: Assigned +Status: Closed
I don't think you're correct here. The SMTP standards says that we must dot-stuff whenever a line starts with a dot. From RFC-2821, Section 4.5.2 Transparency: - Before sending a line of mail text, the SMTP client checks the first character of the line. If it is a period, one additional period is inserted at the beginning of the line.