#45305 [Opn]: From Header Not Parsed Correctly
| From: | php at info-svc dot com | Date: | Thu, 19 Jun 2008 01:03:56 +0000 |
| Subject: | #45305 [Opn]: From Header Not Parsed Correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125860@lists.php.net to get a copy of this message | ||
ID: 45305
User updated by: php at info-svc dot com
Reported By: php at info-svc dot com
Status: Open
Bug Type: Mail related
Operating System: Windows Server 2003 SP2
PHP Version: 5.2.6
New Comment:
Notice the SMTP error can never be reproduced if the following
statement comes before mail()
ini_set('sendmail_from', ini_get('sendmail_from'));
This is a good workaround until the bug is fixed.
Previous Comments:
------------------------------------------------------------------------
[2008-06-19 00:42:39] php at info-svc dot com
Description:
------------
PHP fails to parse the From: header in mail()'s additional_headers
parameter when all of the following conditions exist:
* Header is in the form of From: Name <address>
* Script does not call ini_set('sendmail_from')
* php.ini does not configure sendmail_from
As the test server is using the localhost smtp service I can't see the
smtp session using Network Monitor. The error returned by PHP is shown
below. If there is a way for me to show you the bad MAIL TO command
just let me know how.
Reproduce code:
---------------
ini_set('display_errors', TRUE);
echo 'Sending message 1<br />';
mail('nospam@info-svc.com', 'Test Message1', 'Does the From header work
at all?', 'From: miqrogroove@hotmail.com');
echo 'Sending message 2<br />';
mail('nospam@info-svc.com', 'Test Message2', 'Does the From header work
at all?', 'From: Robert Chapin <miqrogroove@hotmail.com>');
ini_set('sendmail_from', NULL);
echo 'Sending message 3<br />';
mail('nospam@info-svc.com', 'Test Message3', 'Does the From header work
at all?', 'From: miqrogroove@hotmail.com');
echo 'Sending message 4<br />';
mail('nospam@info-svc.com', 'Test Message4', 'Does the From header work
at all?', 'From: Robert Chapin <miqrogroove@hotmail.com>');
Expected result:
----------------
Sending message 1
Sending message 2
Sending message 3
Sending message 4
Actual result:
--------------
Sending message 1
Sending message 2
Warning: mail() [function.mail]: SMTP server response: 501 5.5.4
Invalid Address in test.php on line 5
Sending message 3
Sending message 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45305&edit=1