private void setRecipients ( final Email emailWithData , final MimeMessage msgToSet ) throws MessagingException { // TO final InternetAddress [ ] to = EmailAddress . convert ( emailWithData . to ( ) ) ; if ( to . length > 0 ) { msgToSet . setRecipients ( RecipientType . TO , to ) ; } // CC final InternetAddress [ ] cc = EmailAddress . convert ( emailWithData . cc ( ) ) ; if ( cc . length > 0 ) { msgToSet . setRecipients ( RecipientType . CC , cc ) ; } // BCC final InternetAddress [ ] bcc = EmailAddress . convert ( emailWithData . bcc ( ) ) ; if ( bcc . length > 0 ) { msgToSet . setRecipients ( RecipientType . BCC , bcc ) ; } }
Sets TO CC and BCC in msgToSet with TO CC and BCC from emailWithData .