邮件最终在垃圾文件夹 - PHP联系表单

时间:2015-01-31 10:53:29

标签: php forms email spam-prevention

有人可以告诉我如何从联系表单正确发送邮件,以便收到我的收件箱而不是funk文件夹吗?

<?php
$EmailFrom = "myhost@email.nl";
$EmailTo = "myemail@address.com";
$Subject = "Mail via mydomain.nl";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text

$Body = "";
$Body .= "Naam: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Bericht: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

这是我到目前为止的代码。 它修剪&#39;来自HTML的输入,将其抛出在$ body变量中。

如何使邮件对我的收件箱安全? $头? :)

0 个答案:

没有答案