密件抄送功能

BCC in mail Function

您好,我正在尝试将 BCC 添加到邮件功能,但它不起作用。有人可以帮忙吗??? 这是我的代码。

<?php 
     if(isset($_REQUEST['submit'])){
     $cleanedFrom = $_POST['mailtxt'];
      $to ='abcd@abc.com'; 
        $subject = 'Booking Form';
        $headers = "From: " . $cleanedFrom . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        $message= '<html><body>';
        $message .= "</table>";
        $message .= "</body></html>";
        $headers .=  "BCC: abc@abc.com;\r\n";
        $send =    mail($to, $subject, $message, $headers);
        $send =    mail ("info@visitkullumanali.com", $subject, $message, $headers);
    if($send)
    {
        echo "<script> window.location = 'wwww.mysite.com' </script>";}
    else
    {
        echo "<script> window.location = 'index.html' </script>";
    }
 }     

?>

    $headers .=  "BCC: abc@abc.com;\r\n";

Bcc 值中删除额外的 ;

    $headers .=  "Bcc: abc@abc.com\r\n";

这样试试:

$headers .= 'Bcc: abc@abc.com' . "\r\n";

REFERENCE

你漏掉了一个重点:

如果您想要密件抄送,请通过 "To:" 添加收件人,但不要添加到 header。人们只能通过 header 信息看到谁也收到了邮件。所以你可以通过 "To:"

添加它