I'm having some trouble using mail() on Windows. This is working for me on some LINUX servers with no problems (sendmail, qmail and exim), but cannot make it to work on windows.
I'd like to send a message with name and address on the TO field, not just the address. To get that, I tried that formats:
$to = 'SomeOne Name <someone@xxxxxxxxxxx>' $to = '"SomeOne Name" <someone@xxxxxxxxxxx>'
And then I tried to send the message with: mail($to, $subject, $text);
The received error is:
Warning: mail(): SMTP server response: 501 <SomeOne Name <someone@xxxxxxxxxxx>>: "@" or "." expected after "SomeOne" in mail.class.php on line 333
Note that the mail() function puts the To field inside <>, and that makes the SMTP error. If I write just the email address, there is NO problem for sending (even if there are more than one recipient):
mail('someone@xxxxxxxxxxx', $subject, $text); // WORKS
Same with additionals headers CC or BCC with that format: "name" <address>.
As I said, I have it working on Linux with no problems. This problem only apears on a Windows Server I'm testing. I'm using an SMTP server on other computer because this Windows does not have it installed and cannot have it.
My server info:
Windows XP HE Apache 2.0.49 (Win32) PHP 4.3.6 (Tested also with 4.3.4)
My PHP.INI: SMTP = smtp.example.com sendmail_from=server@xxxxxxxxxxx
Any help to solve this issue will be welcome ... I've been searching on lists and manuals with no success. Hope not have to write my own SMTP function ...
Regards, Jordi.
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php