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

From: Date: Sun, 13 Nov 2016 15:06:26 +0000
Subject: Bug #73507 [Opn]: 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-205335@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
 Updated by:         cmb@php.net
 Reported by:        mattcoz at yahoo dot com
 Summary:            Extra space added before additional headers when
                     mail.add_x_header is enabled
 Status:             Open
 Type:               Bug
 Package:            *Mail Related
 Operating System:   Windows
 PHP Version:        7.0.13
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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


Thread (8 messages)

« previous php.bugs (#205335) next »