note 73355 deleted from function.mail by danbrown
| From: | danbrown@php.net | Date: | Sat, 25 Apr 2009 15:00:22 +0000 |
| Subject: | note 73355 deleted from function.mail by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153738@lists.php.net to get a copy of this message | ||
Note Submitter: andy at andybev dot com
----
I'm copying Ben Cooke's note from the main mail page into here because I didn't find
it initially. The issue described below caused me a lot of problems because of Postfix converting a
single \r\n into double new lines, resulting in corrupted mail.
=====================================================
Note that there is a big difference between the behavior of this function on Windows systems vs.
UNIX systems. On Windows it delivers directly to an SMTP server, while on a UNIX system it uses a
local command to hand off to the system's own MTA.
The upshot of all this is that on a Windows system your message and headers must use the standard
line endings \r\n as prescribed by the email specs. On a UNIX system the MTA's
"sendmail" interface assumes that recieved data will use UNIX line endings and will turn
any \n to \r\n, so you must supply only \n to mail() on a UNIX system to avoid the MTA
hypercorrecting to \r\r\n.
If you use plain old \n on a Windows system, some MTAs will get a little upset. qmail in particular
will refuse outright to accept any message that has a lonely \n without an accompanying \r.