June 8, 2010
Why is this mail going straight to SPAM box?
Question by Starx
I am using the following script to send mail
<?
extract($_POST);
$subject = "Feedback from ".$name." (".$email.", Ph: ".$phone.")";
$mail = @mail($send,$subject,$content);
if($mail) { echo "Your feedback has been sent"; }
else { echo "We are sorry for the inconvienience, but we could not send your feedback now."; }
?>
But this is always ending up in the spam Folder. Why?
Answer by Starx
You have to use headers while you send mail, to prove that the mail arrives from a genuine source and not a bot.
Try this!
<?
extract($_POST);
$subject = "Feedback from ".$name." (".$email.", Ph: ".$phone.")";
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'From:'.$email."rn";
$headers .= 'Reply-To: '.$email;
$mail = @mail($feedback,$subject,$content,$headers);
if($mail) { echo "Your feedback is send"; }
else { echo "We are sorry for the inconvienience, but we could not send your feedback now."; }
?>