Click here to Skip to main content
15,920,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. As we know that PHP allows us to send e-mails directly from a script.so i have created a php file. Coding of this file is here:-

PHP
<?php
$to = "anoop27@rocketmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "27anoopsharma@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>


while running this file using xampp i am getting a warning
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for anoop27@rocketmail.com in C:\Program Files\xampp\htdocs\form\mailphp.php on line 7
Mail Sent.

In last I have a message that i have print after sending mail is 'Mail Sent'.But i have not received any mailon my email account

Please Help me.
Thanx in adance
Posted
Comments
Garth J Lancaster 30-Jun-13 23:38pm    
I would have thought it was perfectly obvious what the error is

>> Unable to relay for anoop27@rocketmail.com

The SMTP Server you are connecting to, in order to send your email, is saying, "I'm not allowing you to send to anoop27@rocketmail.com"

In the good old (sic) days, you could connect anonymously to alsomost any SMTP server and send email to almost any other email address you wanted - in the golden era of SPAM, SMTP servers are now a lot more restrictive about who they allow to connect to them and to whom they allow email to be sent to

In a lot of SMTP servers, this is configurable - so whatever SMTP server/gateway you are using, you're going to have to RTFM and see how to allow relaying

[Edit] It may also be that you need to have an authenticated connection to your SMTP server to allow relaying, but again, an RTFM should tell you that [/Edit]
Anoop Kr Sharma 30-Jun-13 23:49pm    
Thanks for explaining me the whole concept.
I want to know what is RTFM? I have never heard about it.

1 solution

Please check : SMTP server response: 550 5.7.1 Unable to relay - *A Solution*[^]

Or also you may have a look at this thread[^].

--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900