From:             php at info-svc dot com
Operating system: Windows Server 2003 SP2
PHP version:      5.2.6
PHP Bug Type:     Mail related
Bug description:  From Header Not Parsed Correctly

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('[EMAIL PROTECTED]', 'Test Message1', 'Does the From header work at
all?', 'From: [EMAIL PROTECTED]');
echo 'Sending message 2<br />';
mail('[EMAIL PROTECTED]', 'Test Message2', 'Does the From header work at
all?', 'From: Robert Chapin <[EMAIL PROTECTED]>');
ini_set('sendmail_from', NULL);
echo 'Sending message 3<br />';
mail('[EMAIL PROTECTED]', 'Test Message3', 'Does the From header work at
all?', 'From: [EMAIL PROTECTED]');
echo 'Sending message 4<br />';
mail('[EMAIL PROTECTED]', 'Test Message4', 'Does the From header work at
all?', 'From: Robert Chapin <[EMAIL PROTECTED]>');


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 bug report at http://bugs.php.net/?id=45305&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45305&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45305&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45305&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45305&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45305&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45305&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45305&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45305&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45305&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45305&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45305&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45305&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45305&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45305&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45305&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45305&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45305&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45305&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45305&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45305&r=mysqlcfg

Reply via email to