Hi,
I'm using PHPMailer to send mailout to about 1500 email addresses coming from a database, but i would like to send using BCC , as going through a loop and sending a mail for each address times out.
However i'm a bit stuck on how to get all the email addresses in the BCC i keep getting this error:
Message was not sentMailer Error: Language string failed to load: recipients_failed
when i use the following code
require("class.phpmailer.php");
$sql="
SELECT *
FROM amails
";
$result = mysql_query($sql, $conn)or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
//give a name to the fields
$email=$row['email'];
$email_id=$row['email_id'];
$display_block.="$email;";
}
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.mysite.com"; // SMTP server
$mail->From = "info@mysite.com";
$mail->FromName = "info@mysite.com";
$mail->AddAddress("me@mysite.com");
$mail->AddBCC("$display_block");
//$mail->AddAddress("$email\n");
$mail->AddEmbeddedImage("../images/cover17.jpg", "my", "cover17.jpg");
$mail->IsHTML(true);
$mail->Subject = "Online";
$mail->Body = 'Embedded Image: <img src="cid:my" alt="cover" >';
$mail->Body = "
<table width=\"500\" border=\"1\" align=\"center\" cellpadding=\"3\" cellspacing=\"4\" bordercolor=\"#CCCCCC\" bgcolor=\"#FFFFFF\">
<tr><td><a href=\"http://www.mysite.com/comments/unsubscribe.php?unsubscriber=$email_id\">Click here</a> to remove your address from this mailing list</td></tr>
</table>";
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
$display_block= " meassage sent to $email\n";
}
I'm not quite sure how i get all the addresses in to the BCC. Help would be greatly appreciated.