Package com.kentcdodds.javahelper.model

Examples of com.kentcdodds.javahelper.model.EmailAttachment


   * @throws Exception
   */
  public static EmailAttachment zipAttachments(String attachmentName, EmailAttachment... attachments) throws FileNotFoundException, IOException, Exception {
    HelperFile[] files = new HelperFile[attachments.length];
    for (int i = 0; i < attachments.length; i++) {
      EmailAttachment emailAttachment = attachments[i];
      byte[] fileBytes = emailAttachment.getFileBytes();
      if (fileBytes == null) {
        fileBytes = IOHelper.getFileBytes(emailAttachment.getFile()); //in the case that this is a file on disk
      }
      files[i] = new HelperFile(fileBytes, emailAttachment.getAttachmentName());
    }
    byte[] zippedBytes = IOHelper.zipFiles(files);
    return new EmailAttachment(zippedBytes, "attachments.zip", "application/zip", Message.ATTACHMENT);
  }
View Full Code Here

TOP

Related Classes of com.kentcdodds.javahelper.model.EmailAttachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.