javasmtpjakarta-mail

Create a InternetAddress and set it to RecipientType BCC


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

InternetAddress system = new InternetAddress("nunyi@gmail.com");

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("nunyi@gmail.com"); message.setRecipients(Message.RecipientType.TO, system);