I have a form that populates a PHP mail to be sent to our clients, I want to BCC most of the clients due to privacy. I have the following code
$to = "******@e-track.co.za"; //To recipients
$email_from = '*****@etrackbureau.co.za';//<== update the email address
$email_subject = "New Overdue Loaded";
$email_body = "A new High Risk Client has been loaded by $name $company.\n".
"\n Client Name: $driver_name $driver_surname\n
\n Client ID or Passport Number: $driver_id\n
\n Nationality: $driver_nationality\n
\n Reason for Loading Client: $type\n
\n Notes: $notes\n
".
$headers = "From: $email_from \r\n";
$headers = "Bcc: ******@e-track.co.za;*****@e-track.co.za;******@e-track.co.za\r\n";
//$headers = "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
I have added the BCC as a $headers but once I add this it doesn't send mails at all when I remove it I get the mail to the $to recipient.
I have tried spacing between the BCC mails as well. I have replaced the mail names with **** for spamming reasons
You should concatenate
$headers
Example :
$headers = "From: *****@etrackbureau.co.za\r\nX-Mailer: php\r\n";
$headers .= "MIME-Version: 1.0\r\n"; #Define MIME Version
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; #Set content type
$headers .= "Bcc: $EmailListHere\r\n"; #Your BCC Mail List