Page 1 of 1

Problem w/ 'From' address using PHP's mail() & IIS 6.0

Posted: Tue Sep 13, 2005 11:42 am
by Astryk
On a Windows 2003 server using IIS and the built-in SMTP server, I get the error "Warning: mail(): SMTP server response: 501 5.5.4 Invalid Address" from the following code:

$to = 'my@address.com';
$subject = 'Testing';
$message = 'This is a test message';
$headers = 'From: Testing <just@testing.com>' . "\r\n" . 'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

However, it works fine when I remove the friendly name from the From address and just use:

$headers = 'From: just@testing.com'

Has anybody seen this problem before and/or could anybody try and help me solve it?

Thx

Posted: Wed Sep 14, 2005 10:06 am
by Astryk
Here's some additional info. If I telnet into the SMTP server I can send messages fine when I include the friendly name in the DATA portion [From: "Me" <my@address.com>], so it seems that the problem has something to do with the way in which the PHP mail() function is interacting with it. What continues to be strange, however, is that an identically configured IIS/SMTP server with the friendly name included in the mail() call works fine on a Windows 2000 Server machine. My first reaction is to think that Microsoft stopped supporting something in 2003 that they did in 2000 but if that were the case there should have been a lot more people with the same complaint out there on the net. In any case, additional thoughts would be greatly appreciated.