Hi,
I’m getting the below error while sending mail.
Error:
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for xyz@zyx.com in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\mail.php on line 39
Code:
if (isset($_POST["submit"])) {
$to = strip_tags($_POST["to"]);
$sub = strip_tags($_POST["sub"]);
$feedback = strip_tags($_POST["feedback"]);
$from = strip_tags($_POST["from"]);
$to= "xyz@gmail.com";
$sendto = $to;
$subject = $sub;
$message = $feedback;
$headers ="MIME-Version:1.0\\r\
";
$headers .="content-type:text/html; Charset=iso-8859-1\\r\
";
$headers .="From: <" . "$from" . ">\\r\
";
$headers .="X-Sender: <" . "$sendto" . ">\\r\
";
$headers .="Return-Path: <" . "$sendto" . ">\\r\
";
$headers .="Error-To: <" . "$sendto" . ">\\r\
";
$sendto = trim($sendto);
$themail= mail($sendto, $subject, $message, $headers) ;
}
Kindly help.
Thanks,
Ramki