I want to send multiple emails using php, in the BCC field.
What did I do wrong? When I try this, it only sends 1 email to the first person though it doesn't send any other emails to anyone else in the BCC (P.S the "to field" is working fine, its only the BCC I am having a hard time with)
What did I do wrong? When I try this, it only sends 1 email to the first person though it doesn't send any other emails to anyone else in the BCC (P.S the "to field" is working fine, its only the BCC I am having a hard time with)
PHP Code:
<?php
$HTML = "Testing...";
$to = "no-reply@yourdomain.com";
$bcc = "Bcc: no-reply********.com, no-reply@live.ca";
$from = "no-reply@yourdomain.com";
$subject = "Subject";
sendHTMLemail($HTML,$from,$to,$subject);
function sendHTMLemail($HTML,$from,$to,$subject)
{
$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLEMAIL");
$headers .= "Content-Type: multipart/alternative;".
"boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";
$headers .= "--$boundary\r\n".
"Content-Type: text/plain; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode(strip_tags($HTML)));
$headers .= "--$boundary\r\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($HTML));
mail($to,$subject,"",$headers,$bcc);
}
?>