Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何防止Gmail堆积到通过PHP mail()发送的“对话”电子邮件中?_Php_Email_Gmail - Fatal编程技术网

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

如何防止Gmail堆积到通过PHP mail()发送的“对话”电子邮件中?,php,email,gmail,Php,Email,Gmail,我有一个web表单,它使用以下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"; $he

我有一个web表单,它使用以下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系统会将电子邮件堆积到一个对话中


什么样的正确方法可以防止这种堆积,并始终将它们作为单独的电子邮件接收?

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

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

可能类似于$subject=Contact from$senderName

非常感谢!
mail('hi@example.com', 'Test 3', 'Hi there 3')