PHP联系表格标记为垃圾邮件

时间:2014-03-04 09:58:58

标签: php html mime contact-form spam-prevention

我真的可以在这个上使用你的帮助。我写了以下电子邮件表单,它与我自己的私人域名电子邮件地址(me@my-domain.co.uk)一起使用,但是,公司电子邮件地址(me@work.com)必须具有更强的垃圾邮件过滤器没有经过。我现在希望通过组织单独的MIME类型来降低垃圾邮件级别,即客户端的text / html和text / plain变化。我查看了以下教程:http://www.tek-tips.com/faqs.cfm?fid=2681

问题在于它毫无意义。任何人都可以指出我正确的方向来纠正问题,并告诉我如何分类单独的标题等?

<?php
  {
  $to = "me@work.com, me@my-domain.co.uk";
  $subject = "Quotation Request from Work Website.";
  $headers = "Content-type:text/html;charset=iso-8859-1";
  $first_name = filter_input(INPUT_POST, 'first_name');
  $last_name = filter_input(INPUT_POST, 'last_name');
  $telephone = filter_input(INPUT_POST, 'telephone');
  $gotNumberFrom = filter_input(INPUT_POST, 'gotNumberFrom');
  $quoteFor = filter_input(INPUT_POST, 'quoteFor');
  $address = filter_input(INPUT_POST, 'address');
  $takenBy = filter_input(INPUT_POST, 'takenBy');

  $message = 
  "<span style='font-weight: bold;'>Name: </span>"."<br />".$first_name." ".$last_name."<br />"."<br />".
  "<span style='font-weight: bold;'>Telephone: </span>"."<br />".$telephone."<br />"."<br />".
  "<span style='font-weight: bold;'>Address of Works: </span>"."<br />".$address."<br />"."<br />".
  "<span style='font-weight: bold;'>Quotation for: </span>"."<br />".$quoteFor."<br />"."<br />".
  "<span style='font-weight: bold;'>Got our number from: </span>"."<br />".$gotNumberFrom."<br />"."<br />".
  "<span style='font-weight: bold;'>Quotation taken by: </span>"."<br />".$takenBy."<br />"; 

  mail($to, $subject,"<html>Hola!<br /> Please find details below of the individual that has requested a quotation Gaffer.<br />
      <br />" . $message . "</html>", $headers);
  echo "Your message has been successfully sent, here's a lollipop. <br />"?>
<?php  }
?>

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:3)

问题背后的主要原因是标题不正确,将正确的标题传递到您的邮件功能中,您将会很高兴。您可以使用以下示例:

$headers  = "From: My site<noreply@example.com>\r\n";
$headers .= "Reply-To: info@example.com\r\n";
$headers .= "Return-Path: info@example.com\r\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";