我正在尝试将电子邮件发送给 10 个不同的用户,我已将变量 $friendsEmails 放入一个包含 10 个不同电子邮件的数组中,但是看起来它将为每封 10x10 的电子邮件复制 10 个。难道我做错了什么?
for($i =0; $i<11; $i++){
$mail->SetFrom($email, $name);
$mail->AddReplyTo($email,$name);
$mail->Subject = "We wish you a merry Christmas";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($friendsEmails[$i], $friendsNames[$i]);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
}