.MSG attachments not saving properly


I am parsing a large number of outlook .msg files using the Java component and extracting out attachments. Whenever I have a msg file that contains msg attachments, these do not get saved to disk properly with the .save method of the Aspose object - instead the object throws an exception with a null error message. Can anyone else experienced this issue? Any insight on it, or workarounds?

Hi Dave,

Thank you for writing to Aspose support team.

Could you please give the following code sample a try at your end and let us know your feedback? If the issue still persists, I would request you to please share your sample files with us for our investigation into this issue. We’ll look into these for assisting you further.

Sample Code:

MailMessage myMsg = MailMessage.load("MsgWithAt.msg", MessageFormat.getMsg());

for (Attachment a: myMsg.getAttachments())
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    MailMessage mailMsg = MailMessage.load(new ByteArrayInputStream(outStream.toByteArray()));
    MapiMessage mapi = MapiMessage.fromMailMessage(mailMsg);
    System.out.println(mapi.getSubject() + " extracted.");