Kaizard Posted October 10, 2009 Share Posted October 10, 2009 Hi, I'm trying to create a simple email script..but I'm getting this error.. Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for testmail@yahoo.com in D:\Xampp\htdocs\CMEPortal\Test.php on line 83 Message delivery failed... Here's my code: $to = "testmail@yahoo.com"; $subject = "Hi!"; $body = "Hi,\n\nGenki desu ka?"; $headers = "From: sender@example.com\r\nX-Mailer: php"; if (mail($to, $subject, $body, $headers)) { echo("<p>Message sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } What should I do? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/177201-sending-email-problem/ Share on other sites More sharing options...
Daniel0 Posted October 10, 2009 Share Posted October 10, 2009 You should fix your SMTP server. Quote Link to comment https://forums.phpfreaks.com/topic/177201-sending-email-problem/#findComment-934310 Share on other sites More sharing options...
Kaizard Posted October 10, 2009 Author Share Posted October 10, 2009 You should fix your SMTP server. Any tips? Quote Link to comment https://forums.phpfreaks.com/topic/177201-sending-email-problem/#findComment-934317 Share on other sites More sharing options...
PFMaBiSmAd Posted October 10, 2009 Share Posted October 10, 2009 Your sending mail server has relaying restricting in effect (which it should) and thinks that you are relaying an email through it. This would occur if neither of the To: or From: address is hosted at the sending mail server. Is the From: address hosted at the sending mail server? You can also get a "Unable to relay" error if your mail server unconditionally requires SMTP authentication in order to send any email, relayed or not. Quote Link to comment https://forums.phpfreaks.com/topic/177201-sending-email-problem/#findComment-934325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.