Search code examples
javasmtpjakarta-mail

Create a InternetAddress and set it to RecipientType BCC


I've created a jakarta.mail.internet.InternetAddress

InternetAddress system = new InternetAddress("[email protected]");

but there is no set to set it as RecipientType BCC


Solution

  • InternetAddress is an object used to define address and has no property of type. However you can set the type when added this address to your message:

    InternetAddress system = new InternetAddress("[email protected]"); message.setRecipients(Message.RecipientType.TO, system);