From: [EMAIL PROTECTED]
Operating system: Windows XP SP1
PHP version: 4CVS-2002-11-10
PHP Bug Type: Mail related
Bug description: mail() incorrectly strips multiple \r\n
tested on 4.3pre2 and 4.3-snapshot (2002-11-10).
php4/win32/sendmail.c contains:
/* This pattern removes \r\n from the start of the string,
* \r\n from the end of the string and also makes sure every line
* is only wrapped with a single \r\n (thus reduces multiple
* occurences of \r\n between lines to a single \r\n) */
#define PHP_WIN32_MAIL_RMVDBL_PATTERN "/^\r\n|(\r\n)+$/m"
#define PHP_WIN32_MAIL_RMVDBL_REPLACE ""
i'm not certain if the applicable specification(s) require that there be
NO multiple occurences of \r\n in a mime message, but this addition has
broken compatibility with outlook express clients at the very least, which
seems to depend on multiple \r\n to separate content blocks.
it will also unecessarily alter valid mail content, and therefore i
believe \r\n should only be stripped from the beginning and end of the
message, if at all.
example code:
--cut--
$headers = 'From: [EMAIL PROTECTED]' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: multipart/mixed;' . "\r\n";
$headers .= ' boundary="703c1875a9605c5619dd34f7642dcad8"' . "\r\n";
$headers .= 'Content-Transfer-Encoding: 7bit' . "\r\n\r\n";
$headers .= 'This is a multi-part message in MIME format.' . "\r\n\r\n";
$headers .= '--703c1875a9605c5619dd34f7642dcad8' . "\r\n";
$headers .= 'Content-Type: text/html;' . "\r\n";
$headers .= ' charset="iso-8859-1"' . "\r\n";
$headers .= 'Content-Transfer-Encoding: 7bit' . "\r\n\r\n";
$headers .= '<pre>' . "\r\n";
$headers .= 'test paragraph 1' . "\r\n\r\n";
$headers .= 'test paragraph 2' . "\r\n";
$headers .= '</pre>' . "\r\n\r\n";
$headers .= '--703c1875a9605c5619dd34f7642dcad8--' . "\r\n";
mail('[EMAIL PROTECTED]', 'test', null, $headers);
--cut--
the above code will deliver a seemingly empty email. if the message source
is viewed, you will find that even had the content been displayed, it
would not be as the sender had intended (no blank line between
paragraphs):
--cut--
Content-Transfer-Encoding: 7bit
<pre>
test paragraph 1
test paragraph 2
</pre>
--703c1875a9605c5619dd34f7642dcad8--
--cut--
--
Edit bug report at http://bugs.php.net/?id=20340&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20340&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20340&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20340&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20340&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20340&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20340&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20340&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20340&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20340&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20340&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20340&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20340&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20340&r=isapi