Why are you specifying the To field twice? I'd try removing the extra formatting around the email addresses for troubleshooting.
> -----Original Message----- > From: Brian Dunning [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 05, 2004 8:43 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Why do I keep getting a 501 mail error? > > Developing on a Windows server to be deployed on Linux. I get "SMTP > server response: 501 Bad address syntax." Here's my code: > > $mail_from = 'My Name <[EMAIL PROTECTED]>'; > $mail_server = 'mail.servername.com'; // This is hosted externally > ini_set("SMTP", $mail_server); > ini_set("sendmail_from", $mail_from); > $mail_to = "$first_name $last_name <$email>"; > mail($mail_to, "Here is my subject", "Please click this link to > activate your account:\n\n$http_root"."owner.php?id=$entry_code", "To: > $mail_to\nFrom: $mail_from\nContent-type: text/plain\nMailer: > PHP/".phpversion()); > > I read about trying \r\n instead of \n in the headers, but it didn't > seem to make any difference, and \n is working on other mail actions on > this same server. > > Thanks for any clues... :) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php