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 [email protected] in D:\Xampp\htdocs\CMEPortal\Test.php on line 83 Message delivery failed... Here's my code: $to = "[email protected]"; $subject = "Hi!"; $body = "Hi,\n\nGenki desu ka?"; $headers = "From: [email protected]\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! 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. 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? 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. Link to comment https://forums.phpfreaks.com/topic/177201-sending-email-problem/#findComment-934325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.