Examples of GmailAttachment


Examples of com.googlecode.gmail4j.GmailAttachment

                 Multipart multipart = (Multipart)content;
                 for(int i = 0; i < multipart.getCount(); i++) {
                     Part bodyPart = multipart.getBodyPart(i);
                     if (bodyPart.getDisposition() != null) {
                         if (bodyPart.getDisposition().equalsIgnoreCase(Part.ATTACHMENT)) {
                             result.add(new GmailAttachment(i, bodyPart.getFileName(), bodyPart.getContentType(), bodyPart.getInputStream()));
                         }
                     }
                 }
             }
        } catch (Exception e) {
View Full Code Here

Examples of com.googlecode.gmail4j.GmailAttachment

        return result;
    }
   
    @Override
    public GmailAttachment getAttachment(int partIndex) {
        GmailAttachment result = null;
       
        try {
            Object content = this.source.getContent();
             if (content instanceof Multipart) {
                 Multipart multipart = (Multipart)content;
                 Part bodyPart = multipart.getBodyPart(partIndex);
                 if (bodyPart.getDisposition() != null) {
                     if (bodyPart.getDisposition().equalsIgnoreCase(Part.ATTACHMENT)) {
                         result = new GmailAttachment(partIndex, bodyPart.getFileName(), bodyPart.getContentType(), bodyPart.getInputStream());
                     }
                 }
             }
             else {
                 throw new GmailException("Failed to get attachement with partIndex :" + partIndex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.