简体   繁体   English

邮件功能中的密件抄送

[英]BCC in mail Function

Hi i am trying to add BCC to mail function but it does not works. 嗨,我试图将密件抄送添加到邮件功能,但它不起作用。 can anybody please help??? 有人可以帮忙吗? Here my code. 这是我的代码。

<?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";

Remove that extra ; 删除多余的; from Bcc value Bcc

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

Try like this: 尝试这样:

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

REFERENCE 参考

You are missing an important point: 您错过了重要的一点:

If you want BCC add the receiver via "To:" but not to the headers. 如果要BCC,请通过“收件人:”添加接收者,但不要将其添加到标题中。 People only see who also got the mail via the header information. 人们只会通过标头信息看到谁也收到了邮件。 So you are good to go by adding it via "To:" 因此,您可以通过“ To:”添加它

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

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