hi!
I'm trying to send a email to multiple addresses using Bcc. Ok...seems simple, but the truth is that i'm not getting it to work
Here's my code:
$mails[1] = "test1@teste.com";
$mails[2] = "test2@teste.com";
$mails[3] = "test3@teste.com";
$mails[4] = "test4@teste.com";
$bcc = implode(",", $mails);
$to = 'blabla@bla.com';
$subject = 'Email test';
$message = 'Welcome!';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Test Site <test@test.com>' . "\r\n";
$headers .= 'Bcc: $bcc' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
if( mail($to, $subject, $message, $headers) )
{
echo "oh eya!";
}
else
{
echo "oh damm!";
}
I have a simple function to check which emails were submitted by the user and store them in a array. This way there won't be any empty emails.
Can anyone tell me why this isn't working?