Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 29th, 2012  |  syntax: None  |  size: 0.87 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Reading eml file in java : base64 issue
  2. InputStream inMsg = new FileInputStream("D:\Sample Project\makhir.eml");
  3.    Message msg = new MimeMessage(session, inMsg);
  4.     if(msg.isMimeType("multipart/*") || msg.isMimeType("MULTIPART/*")){
  5.              Multipart mp = (Multipart)msg.getContent();
  6.              int totalAttachments = mp.getCount();
  7.              if(totalAttachments>0){
  8.              for(int i=0;i<totalAttachments;i++){
  9.                Part part = mp.getBodyPart(i);
  10.                String attachFileName = part.getFileName();
  11.                String disposition = part.getDisposition();
  12.                String contentType = part.getContentType();
  13.                if((attachFileName!=null &&  attachFileName.endsWith(".ics"))`||contentType.indexOf("text/calendar")>=0){
  14.         String[] dateHeader = msg.getHeader("date");
  15.              }
  16.         }
  17.            inMsg.close();
  18.          }