php mail - Relaying not allowed - Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mraprak
Forum Newbie
Posts: 1
Joined: Thu Nov 01, 2007 4:14 am

php mail - Relaying not allowed - Error

Post by mraprak »

Hi All

Here is the php snippet that I used to send email.

Code: Select all

<?php 
if (mail('valid address over here', 'Subject', 'Your message here.')) { 
 echo('<p>Mail sent successfully.</p>'); 
} else {
  echo('<p>Mail could not be sent.</p>'); 
}  
?>
And I receive the following error in Apache logs
PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: SMTP server response: 550 5.7.1 Relaying not allowed: <valid email address over here> in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\email.php on line 2
Here are my system configuration
Windows XP Pro
Apache 2.2.4
PHP 5.2.3
Apache - PHP setup is working fine.
I'm using a Broandband account and using a SMTP server of the same
I have configured the php.ini for the SMTP setup
[mail function]
; For Win32 only.
SMTP = <broadband smtp server over here>
smtp_port = 25

; For Win32 only.
sendmail_from = <valid email address over here>
Please suggest a solution to fix the error that I receive.
Thanks
Prakash A
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This is fairly typical of broadband providers. Basically, they consider your server as an SMTP server in their network trying to relay a message through their SMTP servers. They do not allow it.

I suggest you switch your code to Swift Mailer. You can find out more about it at the bottom of the forum's index page.
Post Reply