#31167 [Opn->Bgs]: mail() is not RFC 822 compliant

From: Date: Sat, 18 Dec 2004 01:26:30 +0000
Subject: #31167 [Opn->Bgs]: mail() is not RFC 822 compliant
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70562@lists.php.net to get a copy of this message
ID: 31167 Updated by: jed@php.net Reported By: polone at townnews dot com -Status: Open +Status: Bogus Bug Type: Mail related Operating System: RedHat Linux 7.3 PHP Version: 4.3.10 New Comment: Duplicate of #22962 -- caused more trouble than it was worth. Previous Comments: ------------------------------------------------------------------------ [2004-12-18 01:23:42] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31167&edit=1

« previous php.bugs (#70562) next »