Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: php Mail() headers problems in OS X server 10.5



On Apr 8, 2008, at 6:42 AM, Axel Luttgens wrote:

Dear all,
When using the mail() function in php from a web page on the OSX 10.5 server (see example code below), only the first header is processed but the other headers are added to the body of the email and are not processed as header for the email.
The same exact code works just fine on the OS X10.4.11 server.


It seems to be a postfix related issue on how to handle the return characters because it works fine if I replace the \r\n by \n but then may not work right on 10.4.

Hello Bruno,

Have you tried it? I mean, to use \n on 10.4?
I just tried here on a 10.4.11 stock install, and it seems to be fully functional.
Moreover, IIRC, I never worried to user \r\n when building the $additional_headers argument of the mail() function.

\r\n (CRLF) is the standard header delimiter per RFC 2822:

http://www.ietf.org/rfc/rfc2822.txt

2.2. Header Fields
Header fields are lines composed of a field name, followed by a colon (":"), followed by a field body, and terminated by CRLF
\n also working is not a bug, but \r\n not working definitely is a bug.

According to PHP's source code, this would anyway be consistent with the handling of the other parts of the message to be sent with the help of /usr/sbin/sendmail.

It's clearly stated in the documentation of mail() that message (the only other field with line breaks) and additional_headers have inconsistent line break conventions. There's a note addressing this exact problem:


http://php.net/function.mail

Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with ยป RFC 2822.


So using \n may solve this problem on a specific flawed system, but that's a clear deviation from the standard and should not be encouraged nor expected to work more generally.

Looks like to be a change in the /usr/sbin/sendmail binary of the postfix system. As if it didn't care anymore to check for \r\n line endings (btw, such endings don't make much sense in an interactive session on a unix box).

Sure they do; \r\n is the standard delimiter for email headers, so it should work in *any* email system, regardless of the local convention. That's the whole point of specifying it in the RFC standard.


Peace,
Scott _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden
References: 
 >php Mail() headers problems in OS X server 10.5 (From: bruno herreros <email@hidden>)
 >Re: php Mail() headers problems in OS X server 10.5 (From: Axel Luttgens <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.