mail() Incorrect Address Format when using IIS7/FastCGI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. test@xxxxxxxx) 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 <test@xxxxxxxx>

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
<test@xxxxxxxx>>

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:<test@xxxxxxxx>

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 = "dan@xxxxxxxxxxx";
$Subject = "Test";
$Body = "Test";
$Headers = "From: Test User <test@xxxxxxxx>" . "\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

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux