Solving the PHPMailer BCC list problem
Share on Facebook

How to add a BCC list using the PHPMailer class

It's much faster, if you are sending out a lot of emails, to send the email to one person (yourself, perhaps) and blind copy it to everyone else.


Some people seem to struggle with getting the PHPMailer class to add a BCC list but it is actually very simple:


Let's assume that you have your list of BCC recipients in an array. In this example, they are in the array $list

Simply loop through the array and call the PHPMailer function AddBCC():


foreach($list as $bccer){




And that's it. Simple, eh?


Creating a BCC list as an array

Simply use PHP's array() function:




Creating a BCC list as an array from a database

This is also straight-forward and there are a few ways of extracting data into an array but I think this one is the easiest to follow:


$sql="select emailaddress from emaillist";

$result = mysql_query($sql) or die("Invalid query on line: " . __LINE__);






while($y < $num){