944,091 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 13198
  • PHP RSS
May 24th, 2007
0

PHP Mail Error

Expand Post »
Hello,

I am trying to send an email through php using the mail() function but getting the following error:

PHP Syntax (Toggle Plain Text)
  1. Warning: mail() [function.mail]: SMTP server response: my-server-name-here [my-ip-address-here] is currently not 550-permitted to relay through this server. Perhaps you have not logged into 550-the pop/imap server in the last 30 minutes or do not have SMTP 550 Authentication turned on in your email client.
My PHP Code is:

PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $to = 'nobody@example.com';
  3. $subject = 'the subject';
  4. $message = 'hello';
  5. $headers = 'From: webmaster@example.com' . "\r\n" .
  6. 'Reply-To: webmaster@example.com' . "\r\n" .
  7. 'X-Mailer: PHP/' . phpversion();
  8.  
  9. mail($to, $subject, $message, $headers);
  10. ?>

FYI: I am running this code on windows 2003 server and i can send email using Horde.

What I am guessing is I need to add smtp authentication in my php code, so If you can tell me what is the syntax that can help me.

Does anyone know how to overcome this problem?


Thanx
Similar Threads
Reputation Points: 58
Solved Threads: 1
Posting Whiz in Training
cancer10 is offline Offline
234 posts
since Dec 2004
May 24th, 2007
0

Re: PHP Mail Error

I may be wrong, but I think there is no way you can authenticate to a mail server using just the mail() function in php.
You should set your server to allow emails from localhost/ local IP without authentication.
I use phpMailer class from here: http://phpmailer.sourceforge.net/
It is open source and has a lot of functionality, including authentication on smtp servers.
Reputation Points: 33
Solved Threads: 7
Junior Poster in Training
johny_d is offline Offline
92 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Template
Next Thread in PHP Forum Timeline: help with preg match





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC