Edit report at http://bugs.php.net/bug.php?id=49355&edit=1
ID: 49355
Comment by: lukas dot starecek at centrum dot cz
Reported by: php dot net at chris dot cs278 dot org
Summary: Unable to properly fold To/Subject in emails
Status: Open
Type: Bug
Package: Mail related
Operating System: win32 only
PHP Version: 5.2.10
New Comment:
We have same problem on *nix system with PHP 5.1.6 and PHP 5.3.2. In
mail function is allowed to use only \r\n to separate chunks of subject,
but email with this subject is damaged when processed by microsoft SMTP
server (I think some kind of exchange server). In damaged email are
chunks of subjects followed by two new lines, which means end of header.
Below you can see broken email headers. The part after "MIME-Version:
1.0" is supposed to be message body, but you can se fragments of second
and following lines of chunked subject, and email headers, which was
after subject in original email.
----------
Received: from ***** (*****) by *****
(*****) with Microsoft SMTP Server (TLS) id 8.1.393.1; Wed, 19 May
2010 15:03:47 +0200
Received: from ***** (*****) by
***** (*****) with Microsoft SMTP Server id
8.2.176.0; Wed, 19 May 2010 15:03:45 +0200
Received: by ***** (Postfix, from userid 48)id 72D6A36C2D; Wed,
19 May 2010 15:03:53 +0200 (CEST)
From: infooma <*****>
To: *****
Date: Wed, 19 May 2010 15:03:45 +0200
Subject:
=?Windows-1252?Q?Spam=5Fcsc:_POZOR!!_JEDN=C1_SE_O_TESTOVAC=CD_NOTIFIKACI_?=
=?Windows-1252?Q?=8EoP_?=
Thread-Topic:
=?Windows-1252?Q?Spam=5Fcsc:_POZOR!!_JEDN=C1_SE_O_TESTOVAC=CD_NOTIFIKACI_?=
=?Windows-1252?Q?=8EoP_?=
Thread-Index: Acr3U7hpsAXS9QjASjS/sZtv0YXFjg==
Message-ID: <3167228c-f54a-4a6b-b6c7-c7c1e5dc6...@*****>
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: *****
X-MS-Has-Attach:
X-MS-Exchange-Organization-SenderIdResult: None
X-MS-Exchange-Organization-PCL: 2
X-MS-Exchange-Organization-PRD: *****
X-MS-TNEF-Correlator:
received-spf: None (*****: ***** does not
designate permitted sender hosts)
x-tm-as-product-ver: CSC-0-6.0.1038-17392
x-tm-as-result: Yes-9.62-7.00-31-1
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
=?UTF-8?B?MSBwcm9qZWt0dSBDWi4xLjEwLzIuMi4wMC8wNC4xMTExMSBieWxhIHDFmWVk?=
=?UTF-8?B?w6FuYSBkbyBzdMOhZGlhICJTOC4xIEtvbnRyb2xhIDEuIHN0dXBuxJsgcHJv?=
=?UTF-8?B?dmVkZW5hIi4=?=
Received: from phpmailer ([*****])
by ***** with HTTP (phpmailer);
Wed, 19 May 2010 15:03:53 +0200
Date: Wed, 19 May 2010 15:03:53 +0200
From: *****
Message-ID: <c4bdf1fff95394c018522634ebbd3...@*****>
X-Priority: 3
X-Mailer: phpmailer [version 1.65]
X-Mailer: PHP/5.1.6
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Previous Comments:
------------------------------------------------------------------------
[2009-08-25 09:47:20] php dot net at chris dot cs278 dot org
Description:
------------
The SKIP_LONG_HEADER_SEP macro only permits CR-LF-WSP as a separator
which works fine for SMTP, but sendmail under NIX requires LF as the new
line character. The macro doesn't skip over LF-WSP which causes the LF
to be replaced with a space, unfolding the header. This makes it near
impossible to use UTF-8/etc. encoded strings for these headers.
I posted to internals about this problem:
http://marc.info/?l=php-internals&m=125110373328523&w=2
Reproduce code:
---------------
mail('[email protected]', "Reproduction test e-mail for PHP bug
breaking the correct wrapping\n of e-mails with long To/Subject
headers.", 'Testing...');
Expected result:
----------------
To: [email protected]
Subject: Reproduction test e-mail for PHP bug breaking the correct
wrapping of e-mails with long To/Subject headers.
Testing...
Actual result:
--------------
To: [email protected]
Subject: Reproduction test e-mail for PHP bug breaking the correct
wrapping
of e-mails with long To/Subject headers.
Testing...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=49355&edit=1