0
Guys I’m trying to set up an array with the list of e-mail addresses, so that phpmailer send them. However I’m having problems.
No error is displayed, php simply does not send the emails.
I’m mounting the array like this:
// Define os destinatário(s)
$consulta = $mysqli->query("select email,nome from clientes where status=true");
while ($resultado = mysqli_fetch_object($consulta)) {
// Monta o array
$destinatario[] = array($resultado->email => $resultado->nome);
}
And send like this:
foreach($destinatario as $email_cliente => $name){
$mail->AddBCC($email_cliente, $name);
}
Can anyone help me? I think the problem is in the array mount.
I think this way it works, however and when I want to send an array that is not performed a query in the BD, just like the previous question that you helped me. I need a way to send a list that I mount slect in the BD and tbm with input understands.
– Hugo Borges
I don’t quite understand your placement now @Hugoborges. If you take the bank emails you can do it this way. If you mount the array you can do otherwise.
– Ricardo Mota
An alternative is to standardize the object shape and transform its array if necessary. $Object = (Object) $array;
– Ricardo Mota
I got it, well I tested it this way and it worked. But my netbeans is saying that the variable
$key
not being used. What is the need for it?– Hugo Borges
In this case only it is working as a counter even(0,1,2,3 ...). If you were to make some rule could use. You can take if you are not going to use.
– Ricardo Mota
OK, thank you very much :)
– Hugo Borges