繁体   English   中英

如何防止Gmail堆积成通过PHP mail()发送的“对话”电子邮件?

[英]How to prevent Gmail from stacking into a “conversation” emails sent via PHP mail()?

我有一个使用以下PHP代码发送电子邮件的网络表单:

$senderEmail = "sender@sender.com"
$senderName = "John Smith"

$noreplyEmail = "noreply@receiver.com"
$receiverEmail = "inbox@receiver.com"

$header = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
$header .= 'From: "' . $senderName . '" <' . $noreplyEmail . ">\r\n";
$header .= 'Reply-To: "' . $senderName . '" <' . $senderEmail . ">";

$subject = "Contact form";
$message = "...";

mail($receiverEmail, $subject, $message, $header);

问题是,尽管每次$senderName$senderEmail$message在接收者的收件箱(这是一个Gmail域收件箱)中都不同,但电子邮件会被Gmail的系统堆叠到对话中。

防止这种堆叠并始终将其作为单独的单独电子邮件接收的正确方法是什么?

简单:您必须更改电子邮件的Subject

mail('hi@example.com', 'Test', 'Hi there 3')

分组消息截图

mail('hi@example.com', 'Test 3', 'Hi there 3')

单独的味精屏幕截图

也许像$subject = "Contact from" . $senderName; $subject = "Contact from" . $senderName;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM