RE: [PHP] Why do I keep getting a 501 mail error?
| From: | Nicklas Bondesson | Date: | Fri, 06 Aug 2004 09:07:08 +0000 |
| Subject: | RE: [PHP] Why do I keep getting a 501 mail error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192974@lists.php.net to get a copy of this message | ||
Are you getting this error on the Linux or the Windows box? Correct me if
i'm wrong but the mailserver directive in php.ini is only valid for with PHP
on the Windows platform?
/Nicke
-----Original Message-----
From: Curt Zirzow [mailto:php-general@zirzow.dyndns.org]
Sent: den 6 augusti 2004 05:50
To: php-general@lists.php.net
Subject: Re: [PHP] Why do I keep getting a 501 mail error?
* 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!
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php