java - Missing attachments when parse .p7m file -


i have p7m file in disk contains 1 jpg picture, 1 txt file , email body context. fortunately, can email body text , p7s file. can verify p7s file(certificate), can not find 2 attachments. looks missing. don't know why? has meet issue? , p7m file ews(outlook).

  public static void main(string args[]) { try {   datasource source = new filedatasource("c:/users/zhontao/desktop/smime.p7m");   mimemultipart multi1 = new mimemultipart(source);   (int = 0; < multi1.getcount(); i++) {     part part1 = multi1.getbodypart(i);     if (part1.getcontent() instanceof multipart) {       multipart multi2 = (multipart) part1.getcontent();       (int j = 0; j < multi2.getcount(); j++) {         part part2 = multi2.getbodypart(i);         string contenttype = part2.getcontenttype();         system.out.println(contenttype);         // if content type multipart/alternative, email text.         if (part2.ismimetype("multipart/alternative")) {           if (part2.getcontent() instanceof multipart) {             multipart multi3 = (multipart) part2.getcontent();             (int k = 0; k < multi3.getcount(); k++) {               part part4 = multi3.getbodypart(k);               string contenttype1 = part4.getcontenttype();               system.out.println(contenttype1);               if (part4.ismimetype("text/plain") && !part.attachment.equalsignorecase(part4.getdisposition())) {                 system.out.println(part4.getcontent().tostring());               } else if (part4.ismimetype("text/html") && !part.attachment.equalsignorecase(part4.getdisposition())) {                 system.out.println(part4.getcontent().tostring());               }             }           }         }       }     } else {       string contenttype = part1.getcontenttype();       system.out.println(contenttype);       string disposition = part1.getdisposition();       system.out.println(disposition);       system.out.println(part1.getfilename());       // this.savefile(part1.getfilename(), part1.getinputstream());     }   } } catch (messagingexception e) {   // todo auto-generated catch block   e.printstacktrace(); } catch (ioexception e) {   // todo auto-generated catch block   e.printstacktrace(); } 

}

part part2 = multi2.getbodypart(i); 

should be

part part2 = multi2.getbodypart(j); 

Comments