> The main problem is when sending mail from Windows with the mail()
function and using and SMTP server. The mail function modifies the TO header (CC and BCC also). The change made by the mail function does not conform with the RFC 2822 (wich obsoletes 822), and then the SMTP server does not accept the mail because headers are incorrectly formed.
Here the examples: (Note that all examples work perfect on Linux, only fails on windows)
mail("[EMAIL PROTECTED]", $subject, $text); // WORKS mail("My Name <[EMAIL PROTECTED]>", $sub, $txt); // FAILS
Also, the function fails when you write additional headers with the Cc: and Bcc: Fiels in the same format:
$header = "Cc: Someone Name <[EMAIL PROTECTED]"; $header .= "Bcc: Someother Name <[EMAIL PROTECTED]"; mail("[EMAIL PROTECTED]", $sub, $txt, $header); // FAILS
All this headers follow the RFC 2822, and the SMPT server would accept them with no problems. (And it really does). The problem is that the PHP mail layer on windows changes this headers encolsing them betwen the signs <>.
Looking at the SMTP dialog, you can see that the mail() function encloses all adresses betwen <>, and then the address are:
To: <[EMAIL PROTECTED]> To: <My Name <[EMAIL PROTECTED]>> Cc: <Someone Name <[EMAIL PROTECTED]>> Bcc: <Someothe Name <[EMAIL PROTECTED]>>
What's the problem? Main problem is when the function starts sending mail, because it modifies the additional headers. Modifiying the To:, Cc: and Bcc: fields ... and then using the modified addresses in the RCPT TO comand to send the mail.
The SMTP standard, stated on RFC 2821, expects only the email address on the RCPT TO: command. This command MUST be formed this way:
RCPT TO:<[EMAIL PROTECTED]>
But PHP sends all the To: field in the form: RCPT TO:<Someone Name <[EMAIL PROTECTED]>> wich does not conform the standard.
Then, the same SMTP standard, expects all headers (Without any modification) to be sent in the DATA section:
DATA
From: Jordi Canals <[EMAIL PROTECTED]> To: Someone Name <[EMAIL PROTECTED]>
... so, in my opinion, the mail layer should extract the e-mail adrresses to send the RCPT commands, and leave the headers with no changes to send them in the SMTP DATA section.
Ok,
I've submited a bug and the answer was: Sending recipient headers with this format is NOT suported on Windows.
So, in windows, you can use only email addresses on the recipient headers. Sending mail with repicients in the form stated above is only implemented on Linux and Unix Platforms.
More info about this at: http://bugs.php.net/bug.php?id=28038 Thanks to all for your time. Regards, Jordi.
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php