2
I would like to know how to make the "to:" in the email corresponds to the field in the table, that is, for example I have two emails, an email is [email protected]
and the bank’s other email is [email protected]
, I would like to know how to send the email to the respective ones, because I can not, I can only send to only one, I would like this to be my message para:[email protected]
just that and without showing the two emails that were sent how to do this?
$res = mysqli_query($mysqli, "SELECT * FROM newsletter");
while($aux = mysqli_fetch_assoc($res)){
$e = $aux['mail'];
$mail->ClearAddresses($e);
$mail->AddAddress($e);
var_dump($e);
}
//se enviou com sucesso salvo este envio
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Mensagem enviada!';
return true;
}
This is the code snippet I did, but it didn’t work, it only sends to 1.
OBS: No var_dump($e)
he brings me all the bank results.
but I am already done in my while it is doing as long as there is email that would be the
$e = $aux['mail']
– Leonardo Costa
Okay, I did the same thing once and the problem was in require("../class.phpmailer.php"), check this out..
– Nayron Morais