php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31167 mail() is not RFC 822 compliant
Submitted: 2004-12-18 01:23 UTC Modified: 2004-12-18 02:26 UTC
From: polone at townnews dot com Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.10 OS: RedHat Linux 7.3
Private report: No CVE-ID: None
 [2004-12-18 01:23 UTC] polone at townnews dot com
Description:
------------
Please note, I have READ ticket #30226 - this person was right, but for the wrong reasons. The mail() function is not RFC822 compliant:

BEGIN RFC822 SNIPPET >>>

3.2.  HEADER FIELD DEFINITIONS

These rules show a field meta-syntax, without regard for the particular  type  or internal syntax.  Their purpose is to permit detection of fields; also, they present to  higher-level parsers an image of each field as fitting on one line.

field =  field-name ":" [ field-body ] CRLF
 
<<< END RFC822 SNIPPET

All header fields inserted by PHP's mail() function are only separated with LF. Note that this causes issues with RFC822 compliant MTAs. The file where this is occuring is in ext/standard/mail.c, lines 228-233. As it turns out, probably anywhere you are doing LF you should be doing CRLF.

References:
RFC822
http://www.faqs.org/rfcs/rfc822.html

Reproduce code:
---------------
<?php

mail("anyone@example.com", "RFC822 problems", "This message fails RFC822 compliance!");

?>

Expected result:
----------------
The generated mail message should be:

To: anyone@example.com\r\n
Subject: RFC822 problems\r\n
\r\n
This message fails RFC822 compliance!\r\n

Actual result:
--------------
To: anyone@example.com\n
Subject: RFC822 problems\n
\n
This message fails RFC822 compliance!\n

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-18 02:26 UTC] jed@php.net
Duplicate of #22962 -- caused more trouble than it was worth.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC