PHP Mail() Function Problem on Windows Server
We recently had a problem trying to send email using the PHP Mail function on Windows 2003 Server. When we tried to send mail we just got an error message:
PHP Warning: mail(): SMTP server response: 501 5.5.4 Invalid Address
We were trying to add a ‘friendly’ name to the from header of the email in the format:
$headers .= ‘From: Name <address@domain.com>’. “\r\n”;
We found that PHP running on Windows doesn’t parse these headers correctly (see http://www.php.net/manual/en/function.mail.php ) so the fix was to change to:
$headers .= ‘From: address@domain.com’. “\r\n”;
Which gets the mail to send but doesn’t allow us to use ‘friendly’ names.
Leave a Reply
You must be logged in to post a comment.