如何停止在Php电子邮件中发送电子邮件确认邮件


How to Stop Getting Email Sent Confirmation Mail In Php Email

我得到了这个代码:

<?php
//Fetching Values from URL
$name = $_POST['name1'];
$email = $_POST['email1'];
$message = $_POST['message1'];
$contact = $_POST['contact1'];
//sanitizing email
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
//After sanitization Validation is performed
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$subject = $name;
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "'r'n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";
$headers .= 'From:' . $email. "'r'n"; // Sender's Email
$headers .= 'Cc:' . $email. "'r'n"; // Carbon copy to Sender
...........

它运行良好,但当任何用户通过此表单进行联系时,然后管理员(我)和用户都得到了相同的电子邮件确认。。。

我不想向用户发送电子邮件确认,有人能帮我吗?

删除此行:

$headers .= 'Cc:' . $email. "'r'n";  // Carbon copy to Sender

(有一条评论说"抄送发件人")。

删除CC:是一个相当粗略的解决方案,因为您正在丢失副本。因此,不要使用CC:(复写本)标头,要将副本发送给更多用户,您应该将副本作为单独的邮件发送,或者使用BCC:blindcarbon-copy)标头,后者将被目标邮件服务器剥离,因此收件人将看不到它,也无法回复该地址。

$headers .= 'Cc:' . $email. "'r'n"; // Carbon copy to Sender 

从代码中删除这一行。