I need to get the To/CC/BCC addresses from a JavaMail MimeMessage
object. It seems that the only way I can do this is through getRecepients
, but then I can't tell who's in the To
field vs the CC
and BCC
fields. Is there a way to do this?
getRecipients
public Address[] getRecipients(Message.RecipientType type) throws 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"
Note that you'll never find Bcc recipients on a message you receive, that's the whole point of "Bcc".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With