Doc #54012 [NEW]: Line separators in additional_header parameter
| From: | karl dot riedling at tuwien dot ac dot at | Date: | Mon, 14 Feb 2011 13:05:41 +0000 |
| Subject: | Doc #54012 [NEW]: Line separators in additional_header parameter | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-5991@lists.php.net to get a copy of this message | ||
From:
Operating system: Debian Lenny
PHP version: Irrelevant
Package: Mail related
Bug Type: Documentation Problem
Bug description:Line separators in additional_header parameter
Description:
------------
---
From manual page: http://www.php.net/function.mail#Parameters
---
Experienced in three different PHP installations under Debian Lenny
(PHP/5.2.6-1+lenny9) and Red Hat 3.4.5-2 (PHP/5.0.4):
Using \r\n as line separators in the additional-header parameter, as
required in the documentation (_any_ version I found) causes severe
problems with some mail clients. Apparently, either mail() or the MTA adds
an additional CR, which is no problem with most mail clients but
effectively results in extraneous linefeeds if the mail is received by GMX.
These extraneous linefeeds preempt the mail header section and move
everything but the first header line into the mail body. Accordingly, the
MIME headers are not properly interpreted. This problem has been reported,
incidentally, in several forum postings, with hardly a good solution found
there.
I replaced "\r\n" in my software with PHP_EOL; the pertinent section reads
now:
$this->header = "From: ".$from;
if ($reply_to != "")
$this->header .= PHP_EOL."Reply-to: ".$reply_to;
$this->header .= PHP_EOL."X-Mailer: PHP/".phpversion();
$this->header .= PHP_EOL."MIME-Version: 1.0";
...
Test script:
---------------
Simply send a mail with "\r\n" in the additional_headers and with several
lines in the header section from a Linux environment to a gmx mail account.
Replace "\r\n" with PHP_EOL (which is "\n" under Linux), and note the
difference.
--
Edit bug report at http://bugs.php.net/bug.php?id=54012&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54012&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54012&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54012&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54012&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54012&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54012&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54012&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54012&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54012&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54012&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54012&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54012&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54012&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54012&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54012&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54012&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54012&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54012&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54012&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54012&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54012&r=mysqlcfg