为什么这封邮件会直接发送到垃圾邮件箱?

时间:2010-06-08 15:53:40

标签: php email

我使用以下脚本发送邮件

<?
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."; }
?>

但这总是在垃圾邮件文件夹中结束。为什么呢?

1 个答案:

答案 0 :(得分:0)

您必须在发送邮件时使用标题,以证明邮件来自真正的来源,而不是机器人。

试试这个!

<?
  extract($_POST);
  $subject = "Feedback from ".$name." (".$email.", Ph: ".$phone.")";
  $headers  = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  $headers .= 'From:'.$email."\r\n";
  $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."; }
?>