Jump to content

Sending Email Problem


Kaizard

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.