Jump to content

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 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!

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.