Bug #73485 [Nab]: mail() adds a lone CR or LF

From: Date: Thu, 24 Nov 2016 07:57:48 +0000
Subject: Bug #73485 [Nab]: mail() adds a lone CR or LF
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205597@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73485&edit=1 ID: 73485 Updated by: yohgaki@php.net Reported by: sherwoodsports at gmail dot com Summary: mail() adds a lone CR or LF Status: Not a bug Type: Bug Package: Mail related Operating System: All PHP Version: 7.0.X Block user comment: N Private report: N New Comment: It trims unneeded chars at the first and end, detects malformed newlines, but it never add modified headers by parsing addtional_headers. If you have problem, please try to reproduce by modifying the phpt file that I've mentioned. Previous Comments: ------------------------------------------------------------------------ [2016-11-24 07:51:59] yohgaki@php.net Like I mentioned, you should provide "bug case", not creating new bug report. PHP is not the only program modify mail header, so you should provide case that PHP produces malformed mail headers. BTW To: <to@email.com> X-PHP-Originating-Script: 0:test.php From: from@email.com From: <from@email.com> <--- PHP never adds this by mail("to@email.com", "Subject", "Message", "From: from@email.com"); Current mail() accepts multiline header, i.e. it allows too long line folding by "\r\n ", "\r\n\t", but it never split lines automatically. ------------------------------------------------------------------------ [2016-11-24 05:55:13] mattcoz at yahoo dot com I opened a new bug for my issue: https://bugs.php.net/bug.php?id=73507 ------------------------------------------------------------------------ [2016-11-24 05:46:07] sherwoodsports at gmail dot com Hold up... the comments posted are not related to the original report. Please do not identify this bug with those comments then mark this bug as "not a bug" due to your analysis of the issue identified in the comments. ------------------------------------------------------------------------ [2016-11-24 03:03:50] yohgaki@php.net We have test cases for multiple headers by additional_headers parameter. http://lxr.php.net/xref/PHP-7.0/ext/standard/tests/mail/mail_basic6.phpt > mail("to@email.com", "Subject", "Message", "X-PHP-Fix: > x\r\nFrom: from@email.com"); This shouldn't produce following headers. > To: <to@email.com> > X-PHP-Originating-Script: 0:test.php > From: from@email.com > From: <from@email.com> I suppose this is your MTA issue. If you think this is a bug in PHP, try to add bug case to http://lxr.php.net/xref/PHP-7.0/ext/standard/tests/mail/mail_basic6.phpt You can run the test in PHP source build like TESTS=ext/standard/tests/mail/mail_basic6.phpt make test Attach modified mail_basic6.phpt file and reopen this bug. ------------------------------------------------------------------------ [2016-11-12 17:21:06] mattcoz at yahoo dot com I'm running Windows, so the MTA is not an issue. Also, I have no problem overriding the from address. I think I found where the problem might really be though. My server had the mail.add_x_header preference set to On for some reason. When I switch it to Off I no longer get the space before the rest of my headers. I'll open a new bug report for this specific issue and leave it Off on my server because I really don't need it. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73485 -- Edit this bug report at https://bugs.php.net/bug.php?id=73485&edit=1

« previous php.bugs (#205597) next »