Search code examples
javajakarta-mailmessage

How to remove CC and BCC from Recipients address : JavaMail


I am able to add CC,BCC and TO successfully to message or Mimemessage, But my requirement is I need to send the constructed email to some third party for backup purpose. I Tried this:

message.setRecipient(Message.RecipientType.CC, null);
message.setRecipient(Message.RecipientType.CC, "");

Please help!!!


Solution

  • Use setRecipients instead of setRecipient, with a null address.