I would like to know how to make the "to:" in the email correspond to the field in the table, that is, that for example I have two emails, one email is [email protected]
and the other email from the bank is [email protected]
, I would like to know how do I send the email to the respective ones, because I can not, I can only send to one, I would like it to be my message para:[email protected]
only this and without showing the two emails that were sent as do that?
$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 did not work, it only sends 1.
NOTE: In%% of% it brings me right all the results of the bank.