We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.MSG attachments not saving properly

Hello,

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?
Thanks,
Dave

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:

MailMessagemyMsg
= MailMessage.load(
“MsgWithAt.msg”, MessageFormat.getMsg());<o:p></o:p>

for (Attachment a: myMsg.getAttachments())

{

ByteArrayOutputStreamoutStream = newByteArrayOutputStream();

a.save(outStream);

MailMessagemailMsg = MailMessage.load(newByteArrayInputStream(outStream.toByteArray()));

MapiMessagemapi = MapiMessage.fromMailMessage(mailMsg);

System.out.println(mapi.getSubject() + " extracted.");

}