Reputation: 39
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>";
}
}
?>
Upvotes: 0
Views: 423
Reputation: 5670
You are missing an important point:
If you want BCC add the receiver via "To:" but not to the headers. People only see who also got the mail via the header information. So you are good to go by adding it via "To:"
Upvotes: 0
Reputation: 46900
$headers .= "BCC: [email protected];\r\n";
Remove that extra ;
from Bcc
value
$headers .= "Bcc: [email protected]\r\n";
Upvotes: 1