Ok, so I need to fetch all email addresses from a database and send an email notice to each in a batch. Using addAddress() would reveal all destination emails to every recipient. Using addBCC() fixes it but now there is another problem which is a missing "To:" header and I'm not sure how to add it.
A quick and dirty workaround would be something like this:
while($email = mysql_fetch_row($res)[0] {
$mail->addAddress($email);
$mail->send();
$mail->clearAllRecipients();
}
This is very straightforward and addBCC() is not necessary here at all. Except it has to send as many times as there are email addresses. Obviously, not very elegant and much slower at that. I assume one would still have to stick with addBCC() supplemented with something like addCustomHeader(), but I fail to see how this combination wouldn't meet the same fate as addAddress() with all the addresses added before send(). Does a true workaround exist at all?