I want a foreach
loop to send email to multiple addresses each time I run the PHP code:
$id = "a@a.com
b@c.com
d@e.com";
$new = explode("\n", $id);
foreach ($new as $addr) {
$mail->addAddress($addr);
}
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
But it put all the email addresses in to
field and then sends the email.
So when someone get the email, he can see all the email addressees in the to
field.
I want a code to send emails one by one.