发送多个收件人而不泄露其他收件人 [英] Email multiple recipients without revealing other recipients
问题描述
我正在使用javamail将电子邮件发送到收件人列表,但不希望他们能够看到其他人收到的电子邮件。我也不想使用BCC发送它,因为用户甚至没有看到自己在TO列表中。我以为这个代码会这样做,但是它显示了TO列表中的所有收件人。除了创建循环和一次发送电子邮件之外,还有另一种方法吗?
I'm using javamail to send emails to a list of recipients, but don't want them to be able to see who else received the email. I also don't want to send it using BCC since then the user doesn't even see themselves in the TO list. I thought this code would do it, but it shows all the recipients in the TO list. Other than creating a loop and sending the emails one at a time, is there another way to do this?
(注意:recipient []是一个包含电子邮件的字符串数组地址。)
(NOTE: recipients[] is a string array containing the email addresses.)
javax.mail.internet.InternetAddress[] addressTo = new javax.mail.internet.InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
{
addressTo[i] = new javax.mail.internet.InternetAddress(recipients[i]);
}
msg.setRecipients(javax.mail.Message.RecipientType.TO, addressTo);
推荐答案
不,没有办法与电子邮件。
No, there isn't a way to do this with email.
您必须明确构建并发送每个收件人迭代的邮件,其中一个作为您的 addressTo $的唯一成员c $ c> array。
You have to explicitly build and send an email iterating by each of your recipients, one of them as the sole member of your addressTo
array.
这篇关于发送多个收件人而不泄露其他收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!