客户未收到通过电子邮件发送的表单内容

发布于 2024-11-25 19:51:56 字数 1632 浏览 1 评论 0原文

我有一个简单的表单帖子,在提交时通过电子邮件发送给客户。

他们没有在电子邮件中收到表格。似乎不是垃圾邮件问题,因为其域中的任何人都不会收到内容,并且他们已经检查了垃圾邮件过滤器。

如果我将内容发送到各种邮件服务器和域上的电子邮件地址,我总是会收到它们。

我打电话给主机的支持人员 (mediaTemple),他们立即想到了问题所在 - 网站的邮件服务已打开,但邮件正在由另一台机器 (Google) 处理。在 mediaTemple Plesk 控制面板中关闭邮件服务。客户仍然没有收到电子邮件。有什么建议吗?

我省略了一些字段,只是为了让大家能够了解 PHP:

$to = "[email protected], [email protected]";
$subject = "Web Site Feedback";

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$date_of_visit = $_POST['date_of_visit'];
$first_visit = $_POST['first_visit'];

$body = "From: $first_name $last_name\n Date of Visit: $date_of_visit\n First Visit: $first_visit\n";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$headers .= 'From: Client Name <[email protected]>'. "\r\n";
$headers .= "Reply-To: " . "<[email protected]>\r\n";
$headers .= "Return-path: [email protected]";

mail($to, $subject, $body, $headers)

I've got a simple form post that's being emailed to a client on submit.

They are not receiving the form in their email. Doesn't seem to be a spam issue, as anyone on their domain won't receive the contents, and they've checked their spam filters.

If I send the contents to my email addresses on various mail servers and domains, I always receive them.

I call the host's support (mediaTemple) and they thought immediately what the problem--that the mail services were turned on for the web site, but mail was being handled by another machine (Google). Turned of mail services in the mediaTemple Plesk control panel. Client still isn't receiving emails. Any suggestions?

I've ommitted a bunch of the fields, but just so you all can get an idea of the PHP:

$to = "[email protected], [email protected]";
$subject = "Web Site Feedback";

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$date_of_visit = $_POST['date_of_visit'];
$first_visit = $_POST['first_visit'];

$body = "From: $first_name $last_name\n Date of Visit: $date_of_visit\n First Visit: $first_visit\n";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$headers .= 'From: Client Name <[email protected]>'. "\r\n";
$headers .= "Reply-To: " . "<[email protected]>\r\n";
$headers .= "Return-path: [email protected]";

mail($to, $subject, $body, $headers)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

就是爱搞怪 2024-12-02 19:51:56

检查邮件功能是否失败...

if (!mail($to, $subject, $body, $headers)) {
   echo "Failed to send email...";
}

如果可以发送到不属于他们的其他电子邮件地址,那么这肯定是垃圾邮件问题。

您可以尝试在邮件服务器上设置 SPF 记录以验证它不是垃圾邮件,也可以考虑使用 DKIM (PHPMailer有良好的 DKIM 支持)。

Check if the mail function fails...

if (!mail($to, $subject, $body, $headers)) {
   echo "Failed to send email...";
}

If it works sending to a different email address that's not theirs, then it's definetly a spam issue.

You can try setting up an SPF record on the mail server to verify it's not spam and also consider using DKIM (PHPMailer have good DKIM support).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文