RE: [PHP] Why do I keep getting a 501 mail error?

2004-08-06 Thread Nicklas Bondesson
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:[EMAIL PROTECTED] 
Sent: den 6 augusti 2004 05:50
To: [EMAIL PROTECTED]
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 [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;


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 = [EMAIL PROTECTED],[EMAIL PROTECTED],;

without it:
To: [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

with quoted:
To: [EMAIL PROTECTED],[EMAIL PROTECTED], [EMAIL PROTECTED]

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2004-08-06 Thread Brian Dunning
Thanks very much to everyone for all the suggestions. I tried them all, 
and even the most minimal stripped down attempt:

  mail('[EMAIL PROTECTED]','Test','Test');
fails with a 501 error, Bad address syntax. This is on a Windows box. 
Anything else I can try? Is it possible that there is some ini_set that 
is not configured?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Why do I keep getting a 501 mail error?

2004-08-06 Thread Nicklas Bondesson
Do you know what SMTP software they are running on the mailserver?

Nicke 

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED] 
Sent: den 6 augusti 2004 17:32
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Why do I keep getting a 501 mail error?

Thanks very much to everyone for all the suggestions. I tried them all, and
even the most minimal stripped down attempt:

   mail('[EMAIL PROTECTED]','Test','Test');

fails with a 501 error, Bad address syntax. This is on a Windows box. 
Anything else I can try? Is it possible that there is some ini_set that is
not configured?

--
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



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

2004-08-06 Thread Brian Dunning
On Aug 6, 2004, at 8:35 AM, Nicklas Bondesson wrote:
Do you know what SMTP software they are running on the mailserver?
Just whatever IIS uses by default on my Windows box...
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why do I keep getting a 501 mail error? - SOLVED

2004-08-06 Thread Brian Dunning
Turns out I was doing one of these in my config file:
  ini_set(sendmail_from, 'First Last [EMAIL PROTECTED]');
And there's that Windows-unfriendly format again. Thanks much to all 
who showed me what to look for!  :)  :)

- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

2004-08-06 Thread Jason Wong
On Friday 06 August 2004 23:32, Brian Dunning wrote:
 Thanks very much to everyone for all the suggestions. I tried them all,
 and even the most minimal stripped down attempt:

See how much easier it is to get to the root of the problem with a stripped 
down minimal example? 

mail('[EMAIL PROTECTED]','Test','Test');

 fails with a 501 error, Bad address syntax. This is on a Windows box.
 Anything else I can try? Is it possible that there is some ini_set that
 is not configured?

You tell us. Read the comments in the [mail function] section of php.ini and 
check that they are correct and valid for your system. Pay particular 
attention to 'sendmail_from'.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Rune's Rule:
If you don't care where you are, you ain't lost.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2004-08-06 Thread John Holmes
Brian Dunning wrote:
On Aug 6, 2004, at 8:35 AM, Nicklas Bondesson wrote:
Do you know what SMTP software they are running on the mailserver?
Just whatever IIS uses by default on my Windows box...
Sounds like it's not configured correctly.
Try doing the SMTP tutorial here 
http://www.metaconsultancy.com/whitepapers/smtp.htm
and see where you encounter the error.

--
John Holmes
php|architect - The magazine for PHP professionals - http://www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Why do I keep getting a 501 mail error?

2004-08-05 Thread Ed Lazor
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



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

2004-08-05 Thread Jason Wong
On Friday 06 August 2004 01:05, Ed Lazor wrote:
 Why are you specifying the To field twice?  I'd try removing the extra
 formatting around the email addresses for troubleshooting.

I would say strip the whole thing down to the bare minimum that illustrates 
the problem.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The porcupine with the sharpest quills gets stuck on a tree more often.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2004-08-05 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED]

 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...  :)

The first step is to see if you can send a mail using a very basic call to
mail(), simply: mail('[EMAIL PROTECTED]','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...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2004-08-05 Thread Jordi Canals
Brian Dunning wrote:
Developing on a Windows server to be deployed on Linux. I get SMTP 
server response: 501 Bad address syntax. Here's my code:

$mail_to = $first_name $last_name $email;
On Windows Platform, You cannot use the TO address in the form Name 
address As it fails because the mail() function sends incorrect RCPTO 
headers to the SMTP server.

Just send the mail with the TO, CC and BCC adresses in the form 
[EMAIL PROTECTED]. On Windows, your vars must be: $mailto = $email and 
nothing more (No name and no less or greather signs, just an email address).

Take a look at PHP Bug #28038 http://bugs.php.net/bug.php?id=28038
... and make your vote to have it solved in some future version ;)
Regards.
Jordi Canals
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

2004-08-05 Thread Justin Patrin
On Fri, 06 Aug 2004 00:57:32 +0200, Jordi Canals [EMAIL PROTECTED] wrote:
 Brian Dunning wrote:
 
  Developing on a Windows server to be deployed on Linux. I get SMTP
  server response: 501 Bad address syntax. Here's my code:
 
  $mail_to = $first_name $last_name $email;
 
 On Windows Platform, You cannot use the TO address in the form Name
 address As it fails because the mail() function sends incorrect RCPTO
 headers to the SMTP server.
 
 Just send the mail with the TO, CC and BCC adresses in the form
 [EMAIL PROTECTED]. On Windows, your vars must be: $mailto = $email and
 nothing more (No name and no less or greather signs, just an email address).
 
 Take a look at PHP Bug #28038 http://bugs.php.net/bug.php?id=28038
  and make your vote to have it solved in some future version ;)
 

I put a patch in that bug report that *should* fix it. It's not tested
at all, though. If someone can test it, please do:

http://bugs.php.net/bug.php?id=28038

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2004-08-05 Thread Curt Zirzow
* 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 [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;


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 = [EMAIL PROTECTED],[EMAIL PROTECTED],;

without it:
To: [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

with quoted:
To: [EMAIL PROTECTED],[EMAIL PROTECTED], [EMAIL PROTECTED]

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