problem with hidden copy in phpmailer

Asked

Viewed 179 times

0

Guys I’m trying to send several emails with phpmailer, my recipients are receiving them, but to avoid them seeing to whom else I sent the emails, I 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:;

Good currently I pass the following way:

// 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 you send an email to everyone on my registration list

Someone knows how I fix it?

1 answer

1


This happens because all recipients are hidden.

See the changelog v1.7 2003:

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 "To" from you (e.g., [email protected]), or send one email at a time to each recipient, but that’s certainly not a 'problem'. If you choose to change, it will be by 'aesthetic' same.

  • the problem is that I created a page where I check all my system registration and send an email. How do I send 1 email at a time?

  • @Hugoborges make a for in this mailing list and keep firing the emails, but it’s not the best alternative: there is usually a daily limit of emails that you can fire and consume a lot more resources that way. As a rule, what is happening to you is not a problem, it is just a matter of aesthetics. I would prefer the solution of an email in "To". If the answer helped you clarify, give a vote. If that’s what you wanted to know, mark it as a response. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.