Re: mail() Incorrect Address Format when using IIS7/FastCGI
| From: | Manuel Lemos | Date: | Tue, 29 Jan 2008 18:01:40 +0000 |
| Subject: | Re: mail() Incorrect Address Format when using IIS7/FastCGI | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28761@lists.php.net to get a copy of this message | ||
Hello,
on 01/29/2008 02:57 PM Dan Richfield said the following:
> 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>
It seems like a bug.
If you are stuck, you may want to try this package that comes with a
mail() replacement function written in pure PHP named smtp_mail(). It
works like mail but it overcomes certain limitations. Take a look at the
test_smtp_mail.php example script.
http://www.phpclasses.org/mimemessage
You also need this for the delivery:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/