Joey Smith wrote: > 1) Maybe you could go back to Wietse and ask him to justify the > seemingly contradictory assertions that "text is expected to be > in native UNIX stream-LF format" [1] but "Postfix receives local > submissions in (LF or CRLF) format" [2] and "Postfix looks at > the first input line [to determine what format you are using]" [3]? > It's hard to know what to tell PHP developers when we get mixed > messages from someone like Wietse...
I think from his previous replies on the subject Postfix tolerates CRLF formatted submissions and prefers LF, which is understandable as it is a NIX program. > As for "other vendors", I can tell you first-hand that sendmail and > exim both handle "mixed line-endings" just fine. However, I agree that > not sending them in the first place is the ideal scenario... Mixed line endings should never be passed to the mailer. > 2) Perhaps this has changed, but last time I looked, the built-in > SMTP client is the ONLY method available for mail() on Win32. It is perfectly possible to use sendmail under Windows it's not really advertised though, I've not tested it either. > 3) I don't have an Apple platform for testing, what will happen on > Mac if PHP_EOL is used as the separator for $additional_headers? Well you are entering the realms of pre-OSX systems there, not really a valid concern. > 4) I don't write/maintain an MTA, but it seems like you're conflating > SMTP and the "local pipe to a sendmail binary" conversation where it > should not be. If you're sending your emails to a local pipe, I don't > think you should be wrapping your headers in the PHP code with a LF-WSP. I have to disagree RFC 2822 specifies the message format. While I agree it does specify that the end of line should be CRLF and that folding is conducted using the CRLF followed by WSP, this is not really a point of discussion suited to PHP it is for the MTA authors. The derivation from the RFC 2822 specification as far as I am aware is just line endings, which ever the MTA expects should be used. I think its a fair assumption to expect nearly all mailers to permit both CRLF and LF separated emails, however the mail() function only permits talking LF. As stated previously sending mixed line endings should be a total no go, as it stands then only LF can be used by headers passed to mail(). > Since PHP's mail() doesn't know if it's sending over SMTP or a local > pipe, I honestly feel that SKIP_LONG_HEADER_SEP is doing the correct > thing here - your MTA should be able to accept long headers via a > local pipe and make sure it formats them appropriately before sending > them on to their SMTP destination - PHP should only be concerned with > SKIP_LONG_HEADER_SEP in a *pure* SMTP situation. It is simple to detect the method used, SMTP is used if sendmail_path is empty and the system is Windows, otherwise sendmail is used. The SKIP_LONG_HEADER_SEP was added for a reason back in 2003 in response to bug #22355. [1] > Note: I just fed exim a 12000 character long subject from PHP and exim > wrapped it before sending it to the other end of the SMTP conversation. > Are you saying that Postfix does not do this? Did you try encoding a 12000 UTF-8 string using RFC 2047 [2], this is where the real problems emerge. Postfix will handle a really long subject just fine, but an encoded header reaching that long gets folded rendering it invalid. This is why it is imperative to be able to fold the Subject and To headers in PHP, which is where it should be done. Regards, Chris [1] http://bugs.php.net/bug.php?id=22355 [2] http://tools.ietf.org/html/rfc2047 -- Chris Smith -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php