Re: Why do I keep getting a 501 mail error?

From: Date: Thu, 05 Aug 2004 17:46:14 +0000
Subject: Re: Why do I keep getting a 501 mail error?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192913@lists.php.net to get a copy of this message
From: "Brian Dunning" <brian@briandunning.com> > 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 <name@domain.com>'; > $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... :) The first step is to see if you can send a mail using a very basic call to mail(), simply: mail('me@mydomain.com','subject','message'); If that works, then you can move on by slowly adding the code you have above. Why do you have two To: headers? That'll mess things up. remove the one from the "extra headers" parameter. ---John Holmes...

« previous php.general (#192913) next »