Now, if I try the following php on a Linux webserver, it works fine:
Code: Select all
<?php
$to = 'Somebody <you@domain.com>';
$subject = 'Hello';
$message = 'Hi there, just testing';
$from = 'Me <me@domain.com>';
$fromAddress = 'me@domain.com';
$headers = "From: $from\r\n";
$param = "-f$fromAddress";
mail($to,$subject,$body,$headers,$param);
?>Warning: mail() [function.mail]: SMTP server response: 501 <Me <me@domain.com>>: "@" or "." expected after "Me" in C:\httpdocs\test.php on line 11
And when I reduce the $from to just the address only (i.e. like $fromAddress), the same problem occurs with the To address:
Warning: mail() [function.mail]: SMTP server response: 501 <Somebody <you@domain.com>>: "@" or "." expected after "Somebody" in C:\httpdocs\test.php on line 11
When I reduce that as well to just 'you@domain.com', it works fine again.
I tried several SMTP servers, but it made no difference. And besides, in this case the Linux and Windows machines were using the same SMTP server anyway.
Is this a bug in php_smtp.dll or ... ?
(FYI: I'm running PHP Version 5.2.9 on Apache/2.2.11, phpinfo says "SMTP support: enabled, version 0.2.0-dev")