public static MimeBodyPart newHtmlAttachmentBodyPart ( URL contentUrl , String contentId ) throws MessagingException { MimeBodyPart mimeBodyPart = new MimeBodyPart ( ) ; mimeBodyPart . setDataHandler ( new DataHandler ( contentUrl ) ) ; if ( contentId != null ) { mimeBodyPart . setHeader ( "Content-ID" , contentId ) ; } return mimeBodyPart ; }
Creates a body part for an attachment that is used by an html body part .