sending email using “bcc” without “to” in java application

后端 未结 3 1340
误落风尘
误落风尘 2021-01-22 09:23

I have read all the reference in stackoverflow. However, nothing matches in our goal. How can i use bcc in sendmail method in java?

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 09:33

    msg.addRecipient(Message.RecipientType.BCC, new InternetAddress("joe@example.com"));

    By default, JavaMail collects all the recipients specified on the Message object, including Bcc recipients, and uses them in the RCPT command to the SMTP server. The Bcc recipients won't show up in the message headers, however (which is the whole point of Bcc).

提交回复
热议问题