#29646 [Fbk->Opn]: mail() inserts change CRLF ("\r\n") to CRCRLF ("\r\r\n") for some extra headers
| From: | shelby at coolpage dot com | Date: | Mon, 16 Aug 2004 22:49:38 +0000 |
| Subject: | #29646 [Fbk->Opn]: mail() inserts change CRLF ("\r\n") to CRCRLF ("\r\r\n") for some extra headers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64737@lists.php.net to get a copy of this message | ||
ID: 29646
User updated by: shelby at coolpage dot com
Reported By: shelby at coolpage dot com
-Status: Feedback
+Status: Open
Bug Type: Mail related
Operating System: FreeBSD
PHP Version: Irrelevant
New Comment:
I verified that the work around this bug for my configuration (as
previously mentioned) is to use "\r\n" only after the "From:",
"Reply-To:", "Cc:", and "Bcc:" headers, if there is another header
which follows, and to use only "\n" after other extra headers, if
another header follows.
Note in my use, I only tried placing the "From:", "Reply-To:", "Cc:",
and "Bcc:" headers first, and any extra headers (such as "Date:",
"Mime-Versions:", etc) after.
Previous Comments:
------------------------------------------------------------------------
[2004-08-17 00:40:32] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-08-13 11:12:50] shelby at coolpage dot com
Note I made two typos:
Content-Type: text/plainn\r\r\n
Should be:
Content-Type: text/plain\r\r\n
And:
There seems to be no one answer of solution?
Should be:
There seems to be no one answer or solution?
Also I would like to point out that either mail() or Qmail must be
handling the CRLR after the From: dna Reply-To: headers correctly. It
is strange that only some headers are affected. That could explain why
others have not reproduced the bug reports of yore ("yore" is like 2002
apparently! :)
Now it seems I remember having this same problem (had to change my "\n"
to "\r\n" between headers input to mail()) when I migrated from Pair.com
to Rackspace.com (from Qmail to SendMail) and now revisiting this again
when migrating back.
So what is correct work around? Do I change all "\r\n" back to "\n"
when using Qmail, or just the headers it seems to affect?
What is going to work in current and future CVS of PHP?
Please give some definitive guidance!
Having mail break for 1000 AccuSpam users (spam filter) is not pretty!
Thanks,
Shelby Moore
http://AccuSpam.com
http://CoolPage.com
------------------------------------------------------------------------
[2004-08-13 10:31:06] shelby at coolpage dot com
Description:
------------
See the post for detailed description of problem, as well as fact that
others are experiencing the problem:
http://www.zend.com/zend/comments/show_comment.php?article=sendmimeemailpart1&id=5733&pid=2921&days=10000&f_id=sendmimeemailpart1&mode=&kind=sl
I think the reason no one isolated this yet, is because it only
manifests itself for certain extra headers and only causes a noticeable
corruption in Outlook Express, even though the header corruption is
occuring always.
I remembered seeing this before and remember it had something to do
with extra "\r" character after a header line.
I then did a raw telnet session saved to a raw log and confirmed that
the extra CR ("\r") is being inserted by mail().
I am guessing that the mail() code extracts known header lines and
their "\r\n", then does str_replace( "\n", "\r\n" ) on remaining lines
of extra headers?
I use pair.com as host:
php -v
PHP 4.3.4 (cli) (built: Nov 4 2003 16:10:03)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
We do use Qmail.
See other relevant bug posts:
http://bugs.php.net/bug.php?id=15841&edit=2
http://bugs.php.net/bug.php?id=22262&edit=2
There seems to be no one answer of solution?
Reproduce code:
---------------
If the following headers input to mail():
"From: johndoe@domain.com\r\n" .
"Reply-To: johndoe@domain.com\r\n" .
"Date: Wed, 11 Aug 2004 08:15:15 -0400\r\n" .
"Mime-Version: 1.0\r\n" .
"Content-Type: text/plainn\r\n" .
"Content-Transfer-Encoding: 7BIT\r\n"
Expected result:
----------------
(1) In Outlook Express, you get:
From: johndoe@domain.com
Reply-To: johndoe@domain.com
Date: Wed, 11 Aug 2004 08:15:15 -0400
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7BIT
(2) In Eudora 4, you see:
From: johndoe@domain.com
Reply-To: johndoe@domain.com
Date: Wed, 11 Aug 2004 08:15:15 -0400
Mime-Version: 1.0
Content-Type: text/plainn
Content-Transfer-Encoding: 7BITT
(3) In raw text you see:
From: johndoe@domain.com\r\n
Reply-To: johndoe@domain.com\r\n
Date: Wed, 11 Aug 2004 08:15:15 -0400\r\r\n
Mime-Version: 1.0\r\r\n
Content-Type: text/plainn\r\r\n
Content-Transfer-Encoding: 7BIT\r\r\n
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29646&edit=1