Search code examples
phpbcc

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 ='[email protected]'; 
        $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: [email protected];\r\n";
        $send =    mail($to, $subject, $message, $headers);
        $send =    mail ("[email protected]", $subject, $message, $headers);
    if($send)
    {
        echo "<script> window.location = 'wwww.mysite.com' </script>";}
    else
    {
        echo "<script> window.location = 'index.html' </script>";
    }
 }     

?>


Solution

  • Try like this:

    $headers .= 'Bcc: [email protected]' . "\r\n";
    

    REFERENCE