public static MimeBodyPart newAttachmentBodyPart( URL contentUrl, String contentId )
    throws MessagingException
  {
    MimeBodyPart mimeBodyPart = new MimeBodyPart();
    mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
    if( contentId != null ) {
      mimeBodyPart.setHeader("Content-ID", contentId);
    }
    mimeBodyPart.setDisposition(DISPOSITION_ATTACHMENT);
    String fileName = fileNameForUrl(contentUrl);
    if( fileName != null ) {
      mimeBodyPart.setFileName(fileName);
    }
    return mimeBodyPart;
  }
public static MimeBodyPart newAttachmentBodyPart ( URL contentUrl , String contentId ) throws MessagingException { MimeBodyPart mimeBodyPart = new MimeBodyPart ( ) ; mimeBodyPart . setDataHandler ( new DataHandler ( contentUrl ) ) ; if ( contentId != null ) { mimeBodyPart . setHeader ( "Content-ID" , contentId ) ; } mimeBodyPart . setDisposition ( DISPOSITION_ATTACHMENT ) ; String fileName = fileNameForUrl ( contentUrl ) ; if ( fileName != null ) { mimeBodyPart . setFileName ( fileName ) ; } return mimeBodyPart ; }
Creates a body part for an attachment that is downloaded by the user.