Re: Why do I keep getting a 501 mail error?
| From: | Curt Zirzow | Date: | Fri, 06 Aug 2004 03:50:22 +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-192959@lists.php.net to get a copy of this message | ||
* Thus wrote Brian Dunning:
> 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>";
I know this isn't going to help your problem but...
you should quote this mail_to:
$mail_to = '"' .
str_replace($first_name, '"', '\"') . ' ' .
str_replace($last_name, '"', '\"') . '" ' .
<$email>";
It will prevent 'To' injection:
$last_name = "<email1@anotherplace>,<email-infinity@enless.com>,";
without it:
To: <email1@anotherplace>,<email-infinity@enless.com>,<real@address.com>
with quoted:
To: "<email1@anotherplace>,<email-infinity@enless.com>,"
<real@address.com>
With the latter only sending one email verses however many one
person whishes.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!