Bug #73507 [Com]: Extra space added before additional headers when mail.add_x_header is enabled

From: Date: Thu, 24 Nov 2016 05:50:03 +0000
Subject: Bug #73507 [Com]: Extra space added before additional headers when mail.add_x_header is enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205592@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73507&edit=1 ID: 73507 Comment by: mattcoz at yahoo dot com Reported by: mattcoz at yahoo dot com Summary: Extra space added before additional headers when mail.add_x_header is enabled Status: Feedback Type: Bug Package: *Mail Related Operating System: Windows PHP Version: 7.0.13 Block user comment: N Private report: N New Comment: What additional detail are you looking for? Previous Comments: ------------------------------------------------------------------------ [2016-11-21 18:50:36] ab@php.net @mattcoz at yahoo dot com, please describe in detail the way you trigger the bug. Thanks. ------------------------------------------------------------------------ [2016-11-21 16:52:34] mattcoz at yahoo dot com Ok, so I tried this on another server with a fresh copy of PHP 7.0.13. I created a php.ini file with the only settings being my smtp server and mail.add_x_header = On. I then tested my script and got the same problem. ------------------------------------------------------------------------ [2016-11-21 11:24:32] ab@php.net I don't reproduce this as well, debugged also through the Windows only sendmail part. @mattcoz at yahoo dot com, there must be something in the configuration, or the data, so we can reproduce this as well. Thanks. ------------------------------------------------------------------------ [2016-11-13 15:06:23] cmb@php.net I can't reproduce the reported behavior (neither on Windows with php-7.0.13-nts-Win32-VC14-x86, nor on Linux with current PHP-5.6 and PHP-7.0): php -n -d mail.add_x_header=1 -d sendmail_path="cat -" -r "mail('to@email.com', 'Subject', 'Message', 'From: from@email.com');" To: to@email.com Subject: Subject X-PHP-Originating-Script: 1:Command line code From: from@email.com Message ------------------------------------------------------------------------ [2016-11-12 18:10:55] mattcoz at yahoo dot com Description: ------------ When the server is set up with the mail.add_x_header preference enabled, an extra space is added before the additional headers. In my example where I set the From address in my additional headers, this causes it to add an additional From header. The email is then blocked if sent to gmail addresses. This does not happen on another server running PHP 5.3.13 with the same settings. I've attempted to look at the mail.c code and find the problem, but I don't see anywhere that might explain why the extra space is being added. Test script: --------------- mail("to@email.com", "Subject", "Message", "From: from@email.com"); Expected result: ---------------- To: <to@email.com> X-PHP-Originating-Script: 0:test.php From: <from@email.com> Actual result: -------------- To: <to@email.com> X-PHP-Originating-Script: 0:test.php From: from@email.com From: <from@email.com> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73507&edit=1

« previous php.bugs (#205592) next »