We have answer of your question!

100% solved queries, no empty question

Question: Trying to send mail with PHP Mailer and BCC


I'm using the plugin "PHPMailer-master" to send email to adresses stored in my db.

I collect all adresses in a string:

$recipients = "mail@mail.com;mail@mail.com;mail@mail.com"; // OR
$recipients = "mail@mail.com,mail@mail.com,mail@mail.com";

Later i set BCC:


I also set my mail to get the mail:


So, i get no errors... but the only mail that is sent is the one to myself.. what can be the problem? How can i search what's wrong?


This is how i create my string:

while($row = $stmt->fetch()){
    $recipients .= $row['email'] . ";";
Question author Bj%c3%b6rn-c | Source



You can not add the mails like this. The Documentation for AddBCC looks like this AddBCC($address, $name = "").
I recommend you to use foreach loop or something similar:

$recipientsArray = explode(";",$recipients); //The delimiter depends on your string that separated the emails
foreach($recipientsArray as $recipient) {

Update (Regarding your update)

How you create the Array does not matter. The key point is that the PHPMailer function only accepts one BCC per call. If you fetch it, then you can do it like this:

while($row = $stmt->fetch()){
    $recipients[] = $row["email"];
Answer author Luca-jung

Tickanswer.com is providing the only single recommended solution of the question Trying to send mail with PHP Mailer and BCC under the categories i.e php , phpmailer , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer

Thanks for contributing an answer to Tick Answer!