From:             dan at easycgi dot com
Operating system: Windows 2008 RC0
PHP version:      5.2.5
PHP Bug Type:     *General Issues
Bug description:  mail() Incorrect Address Format when using IIS7/FastCGI

Description:
------------
When using IIS7 with PHP 5.2.5 with the FastCGIModule, the mail() function
returns the following error message when trying to use anything but a plain
email address (ex. [EMAIL PROTECTED]) in the From or To headers:

PHP Warning: mail() [function.mail]: SMTP server response: 501 Incorrect
Address Format

If you use a plain email address it works fine.  An example of what causes
this problem is as follows:

Test <[EMAIL PROTECTED]>

The problem is that PHP is formatting the header incorrectly but adding
additional < and > tags around the entire address.  This is illustrated in
this excerpt from my mail server log:

16:28:05.79 5 SMTPI-39353([XXX.XXX.XXX.XXX]) inp: MAIL FROM:<Test
<[EMAIL PROTECTED]>>

With a plain email address, it still adds the < and > tags, but it works. 
Here is an example of that from the mail server log:

16:28:21.72 5 SMTPI-39408([XXX.XXX.XXX.XXX]) inp: MAIL
FROM:<[EMAIL PROTECTED]>

Also, this same behavior was reported in Bug #28038 but I have confirmed
that this is error does not occurs when using this same PHP version in CGI
mode with IIS7.  That tells me this bug was fixed, but has reoccured in
5.2.5 with FastCGI.

Reproduce code:
---------------
<?php
$To = "[EMAIL PROTECTED]";
$Subject = "Test";
$Body = "Test";
$Headers = "From: Test User <[EMAIL PROTECTED]>" . "\r\n";
mail($To, $Subject, $Body, $Headers);
print "mail sent!";
?>


Expected result:
----------------
True result

Actual result:
--------------
PHP Warning: mail() [function.mail]: SMTP server response: 501 Incorrect
Address Format

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

Reply via email to