php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43730 mail() Incorrect Address Format when using IIS7/FastCGI
Submitted: 2008-01-02 19:31 UTC Modified: 2008-01-28 23:48 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: dan at easycgi dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.5 OS: Windows 2008 RC0
Private report: No CVE-ID: None
 [2008-01-02 19:31 UTC] dan at easycgi dot com
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. test@test.com) 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@test.com>

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@test.com>>

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@test.com>

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-21 11:22 UTC] r dot tenberge at creatiestudio dot nl
I've got the same problem using PHP 5.2.5/Apache/2.2.4 on Windows XP.
 [2008-01-28 23:48 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 15:01:56 2024 UTC