problem with hidden copy in phpmailer

0

I'm trying to send multiple emails with phpmailer, my recipients are receiving them, but to prevent them from seeing who else I've sent the emails to, I've used the following function:

$email->AddBCC($resultado_nome->email, $resultado_nome->nome);

The problem is that they receive the email with the following:

undisclosed-recipients:;

Well, I currently do this as follows:

// Define os destinatário(s)
$consulta_nome = $mysqli->query("select * from cadastro");
while ($resultado_nome = mysqli_fetch_object($consulta_nome)) {


   // Destinatório e cópia oculta
   $email->AddBCC($resultado_nome->email, $resultado_nome->nome);

   // Iremos enviar o email no formato HTML
   $email->IsHTML(true);

   // Define a mensagem (Texto e Assunto)
   $email->Subject = "Nova email";
   $email->Body = "emai";

   // Envia o e-mail
   $email->Send();
}

Is it wrong? That way I'll send an email to everyone on my mailing list.

Does anyone know how to solve this?

    
asked by anonymous 23.02.2016 / 12:34

1 answer

1

This happens because all the recipients are hidden.

See the changelog v1.7 2003

a>:

  

Adds "To: undisclosed-recipients :;" when all recipients are hidden (BCC)

     

[en] Adds "To: undisclosed-recipients :;" when all recipients are hidden (BCC)

You can see how this is handled in the source code here too:

To avoid this, you can add an email to your "To" email (eg [email protected]), or send one email at a time to each recipient, but this is certainly not a problem. If you choose to change, it will be by 'aesthetics'.

    
23.02.2016 / 12:53