Ejemplo n.º 1
0
 private static void appendAttachment(Multipart multipart, Attachment attachment)
     throws MessagingException {
   BodyPart fileBodyPart = new MimeBodyPart();
   fileBodyPart.setDataHandler(new DataHandler(attachment.getDataSource()));
   fileBodyPart.setFileName(attachment.getFileName());
   multipart.addBodyPart(fileBodyPart);
 }
Ejemplo n.º 2
0
 public static AttachmentBuilder attachment(Attachment attach) {
   AttachmentBuilder builder = new AttachmentBuilder();
   builder.fileName = attach.getFileName();
   builder.contentType = attach.getContentType();
   builder.thumbnail = attach.getThumbnail();
   builder.fileSize = attach.getFileSize();
   return builder;
 }