更严格的DMARC政策意味着如果客户输入雅虎或AOL电子邮件地址,我们不会收到使用我们在线表格的客户的电子邮件。
我认为这是因为PHP表格生成的电子邮件是从我们的网站服务器发送的,但客户自己的电子邮件地址是来自'。当这个来自'电子邮件是雅虎电子邮件,它触发我们的接收电子邮件帐户阻止它。 (我们使用gmail阅读和回复电子邮件。)
因此,我试图找出如何修改PHP表单以将客户的电子邮件地址设置为“回复”#39;和我们自己的服务器电子邮件地址'来自'在我们服务器上的PHP表单发送给我们的电子邮件中。我希望能够点击回复'在Gmail中,能够直接向客户发送电子邮件。
让主题中的客户名称或来自字段的gmail使我们从表单收到的电子邮件更具可读性也是一件好事,但这远远不够了。
这是当前的php文件的内容。
<?php
$to ="info@futonz.co.nz";
$name = ($_POST['name']);
$email = ($_POST['email']);
$phone = ($_POST['phone']);
$enquiry = ($_POST['enquiry']);
$where = ($_POST['where']);
$sub = "Enquiry from the Futonz Website!";
$headers .= "From: $name <$email>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$mes = "".$sub."
Name: ".$name."
Email: ".$email."
Phone: ".$phone."
Message: ".$enquiry."
I found Futonz by: ".$where."";
if(empty($name) || empty($email)) {
header("Location:required-fields.html");
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
header("Location:invalid-email.html");
}
else {
mail($to, $sub, $mes, $headers);
header("Location:contact-thanks.html");
exit();
}
?>
阅读其他人的建议,我尝试用以下内容替换第一个$标头:
$headers = 'From: '.futonz@futonz.co.nz."\r\n" .
'Reply-To: '.$email."\r\n";
这不起作用。浏览器只是一个空白屏幕。
我还尝试在第一行下面添加另一个$ headers行,如下所示:
$headers .= "From: $name <info@futonz.co.nz>\n";
$headers .= "Reply-to: $name <$email>\n";
这确实出现在Gmail中,因为客户的电子邮件是&#39;回复&#39;。但是,当回复&#39;点击Gmail,它将info@futonz.co.nz作为收件人!
使用以下代码时,请回复以下TheGreenKey的评论:
$headers .= "From: $name <info@futonz.co.nz>\n";
$headers .= "Reply-to: $name <$email>\n";
然后得到以下结果:
Delivered-To: info@futonz.co.nz
Received: by 10.52.238.130 with SMTP id vk2csp258969vdc;
Fri, 13 Feb 2015 18:18:11 -0800 (PST)
X-Received: by 10.140.19.14 with SMTP id 14mr30541534qgg.37.1423880290937;
Fri, 13 Feb 2015 18:18:10 -0800 (PST)
Return-Path: <futonz@futonz.co.nz>
Received: from zeke.hosts.net.nz (zeke.hosts.net.nz. [210.48.108.243])
by mx.google.com with ESMTPS id q137si1269163qha.85.2015.02.13.18.18.09
for <info@futonz.co.nz>
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Fri, 13 Feb 2015 18:18:10 -0800 (PST)
Received-SPF: none (google.com: futonz@futonz.co.nz does not designate permitted sender hosts) client-ip=210.48.108.243;
Authentication-Results: mx.google.com;
spf=none (google.com: futonz@futonz.co.nz does not designate permitted sender hosts) smtp.mail=futonz@futonz.co.nz
Received: from futonz.co.nz (localhost.localdomain [127.0.0.1])
by zeke.hosts.net.nz (8.13.8/8.13.8) with ESMTP id t1E2Hxjm006900
for <info@futonz.co.nz>; Sat, 14 Feb 2015 15:17:59 +1300
Received: (from futonz@localhost)
by futonz.co.nz (8.13.8/8.13.8/Submit) id t1E2Hwf6006899;
Sat, 14 Feb 2015 15:17:58 +1300
Date: Sat, 14 Feb 2015 15:17:58 +1300
Message-Id: <201502140217.t1E2Hwf6006899@futonz.co.nz>
To: info@futonz.co.nz
Subject: Enquiry from the Futonz Website!
From: Robin test <info@futonz.co.nz>
Reply-to: Robin test <teahigh@gmail.com>
Content-Type: text/plain; charset=iso-8859-1
Enquiry from the Futonz Website!
Name: Robin test
Email: teahigh@gmail.com
Phone: 09
Message:
I found Futonz by:
请告诉我如何修改php表单,以便在“回复”时显示客户的电子邮件地址。在Gmail中单击。
答案 0 :(得分:1)
$headers = "From: " . strip_tags($_POST['email']) . "\r\n";
$headers .= "Reply-To: info@youradmin.com\r\n";
$headers .= "CC: info@youradmin.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
答案 1 :(得分:1)
以下是我用来修复DMARC身份验证问题和正确回复&#39;的代码。 gmail中的电子邮件地址。
<?php
$to = "info@futonz.co.nz";
$name = ($_POST['name']);
$email = ($_POST['email']);
$phone = ($_POST['phone']);
$enquiry = ($_POST['enquiry']);
$where = ($_POST['where']);
$sub = "".$name."'s enquiry from the Futonz Website!";
$headers .= "MIME-Version:1.0\n";
$headers .= "Content-type: text/plain; charset=utf-8\n";
$headers .= "X-Mailer: $DOMAIN\n";
$headers .= "X-MSMail-Priority: normal\n";
$headers .= "Return-Path: ".$email."\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Reply-To: ".$email."\r\n";
$mes = "".$sub."\r\n\n";
$mes .= "Name: ".$name."\r\n";
$mes .= "Email: ".$email."\r\n";
$mes .= "Phone: ".$phone."\r\n\n";
$mes .= "Message: ".$enquiry."\r\n\n";
$mes .= "I found Futonz by: ".$where."";
if(empty($name) || empty($email)) {
header("Location:required-fields.html");
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
header("Location:invalid-email.html");
}
else {
mail($to, $sub, $mes, $headers);
header("Location:contact-thanks.html");
exit();
}
?>
感谢那些试图在这里提供帮助的人:)
尝试解决雅虎DMARC问题的人可能对此链接感兴趣: https://help.yahoo.com/kb/mail/SLN24016.html