关于phpmailer,以及$mail->AddAddress
我循环遍历生成电子邮件的内容,我希望它将每个独特的项目发送给一个独特的人。
我发现,当我使用 $mail->AddAddress 时,下次循环时,它只是添加地址,包括之前循环中的所有收件人,并将它们全部发送出去。
如何重置地址变量?
loop(xtimes){
[generate customer $message]
$mail->Host = "smut.blabla.com";
$mail->port = 25;
$mail->AddReplyTo('[email protected]', 'test name');
$mail->AddAddress($currentEmployeeEmail);
$mail->SetFrom('[email protected]', 'test name');
$mail->Subject = "Your Daily Report, for $currentEmployee - $reportDate";
$mail->MsgHTML($message);
$mail->AddAttachment('logo_white.png');
$mail->Send();
}
有没有等于SetAddress的东西?
im looping through something that generates an email and I want it to send each unique item to a unique person.
I found, that when I use $mail->AddAddress, the next time it loops, It just adds the address, including all the recipients from the previous loops, and sends them all out.
How can I reset the address variable?
loop(xtimes){
[generate customer $message]
$mail->Host = "smut.blabla.com";
$mail->port = 25;
$mail->AddReplyTo('[email protected]', 'test name');
$mail->AddAddress($currentEmployeeEmail);
$mail->SetFrom('[email protected]', 'test name');
$mail->Subject = "Your Daily Report, for $currentEmployee - $reportDate";
$mail->MsgHTML($message);
$mail->AddAttachment('logo_white.png');
$mail->Send();
}
Is there something equal to SetAddress?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在循环开始时创建一个新的邮件程序,例如:
如果我记得的话,还有一个
ClearAddresses
方法,例如:What if you create a new mailer at the beginning of the loop, like:
If I remember, there's also a
ClearAddresses
method, like:您可以使用:
You can use: