简体   繁体   English

phpmailer发送电子邮件到多个地址

[英]phpmailer sending emails to multiple addresses

I'm making a mailling list and wanted to send emails to multiple addresses. 我正在制作邮件列表,并希望将电子邮件发送到多个地址。 I have it working but i have a question. 我有它的工作,但我有一个问题。 I have an array of emails lets say 我有很多电子邮件可以说

$emails = array('email1@example.com', 'email2@example.com', 'email3@example.com');

now, to send to these 3 emails, what i did was 现在,要发送到这3封电子邮件,我所做的是

foreach($emails as $email) {
    $mail->AddAddress($email);
}

this works but wont this send 3 separate emails? 这可行,但是不会发送3封单独的电子邮件吗? (one for each?) How can i make it send just one email to all the addresses? (每个一个?)我如何使它仅向所有地址发送一封电子邮件?

Thanks in advance. 提前致谢。

No. That code will send one email to all three addresses, and all addressees will be able to see all the other recipient's addresses. 不会 。该代码将向所有三个地址发送一封电子邮件,所有收件人将能够看到其他收件人的所有地址。 If that's not what you want, look into using addBCC instead, or send separate messages, as shown in the mailing list example provided with PHPMailer. 如果那不是您想要的,请考虑使用addBCC代替,或者发送单独的消息,如PHPMailer随附的邮件列表示例所示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM