从MimeMessage获取/ CC/BCC地址?

Naf*_*Kay 4 java jakarta-mail

我需要从JavaMail MimeMessage对象获取To/CC/BCC地址.似乎我能做到这一点的唯一方法就是通过getRecepients,但后来我无法分辨出To场上的对手CCBCC场地.有没有办法做到这一点?

Per*_*ion 13

getRecipients

public Address [] getRecipients(Message.RecipientType type)抛出MessagingException

Returns the recepients specified by the type. The mapping between the type and the corresponding RFC 822 header is as follows:

                Message.RecipientType.TO                "To"
                Message.RecipientType.CC                "Cc"
                Message.RecipientType.BCC               "Bcc"
                MimeMessage.RecipientType.NEWSGROUPS    "Newsgroups"
Run Code Online (Sandbox Code Playgroud)


Bil*_*non 9

请注意,您永远不会在收到的邮件中找到密件抄送收件人,这就是"密件抄送"的全部内容.

  • 是的,我们不知道,但人们有时会对此感到困惑所以我认为值得指出.如果您同意其中值得指出的信息,也许其他人可以对其进行投票? (3认同)