2 Replies Latest reply: Jul 31, 2013 2:29 PM by Bill Shannon-Oracle RSS

    Parsing email attachments using Javamail

    ac5c7e8a-94df-481d-8137-7241f2762d49

      Hi All,

       

      I'm working on a multimedia application where I have to parse emails using Javamail.

      Here is a problem that i'm facing.

       

      When i'm receiving an attachment from icloud.com, i'm not able to get the filename whereas i'm able to get the fileSize and fileContent.

      I'm using Part.getFileName() to get the file name. and Part.getFileSize() and Part.getInputStream() to get size and the content.

      When i checked the attachment header, I could see the name encoded in ISO-8859-1.

       

       

       

      --Boundary_(ID_kS5Ng+OB35IVBfC+scPoMA)

      Content-id:203806fb-b62e-4cfa-a1ca-78fffa589c20@icloud.com

      Content-type:image/jpeg;

      name*1*=utf-8"%20%32%33%30%32%32%30%31%33%37%32%35;

      name*2*=%2E%6A%70%67

      Content-transfer-encoding:BASE64

      Content-disposition:inline;

      filename*1*=utf-8"%20%32%33%30%32%32%%30%32%33%37%32%35

      filename*2*=%2E%6A%70%67

       

       

      In both the cases above, Part.getFileName() is returning null.

      I set the parameter mail.mime.decodeparameters="true".Still it is not working.

      It would be great if someone can suggest a solution for this.

       

      Thanks

      Shyama