Can Aspose java API hanldes *.msg files


I am building a solution that needs msg files (MS Exchange format) to convert to PDF. Can Aspose java API read msg file including attachments?



This message was posted using Aspose.Live 2 Forum

Hi there,

Thank you for inquiry.

I believe this is possible to achieve using both Aspose.Words and Aspose.Network for .NET, but to my knowledge is not yet possible using the Java platform.

According to this link to a video in the .NET platform, showing the basic steps of loading .MSG files in Aspose.Network, saving to the mhtml format, and then using Aspose.Words to load the mhtml file and render it to a PDF file.

From what I can see, Aspose.Network for Java does not support saving .msg files to .mhtml yet so the steps above can not be applied when using the Java platform. I will move this thread to their forum so the developers there can give you some further input regarding this.

Also please note that in the MHTML format is currently supported only in the .NET platform of Aspose.Words, but will be natively supported in the Java platform in the next release which is due out late this month.


Hi Manish,

Aspose.Network for Java can read the MSG file including the attachments. Please visit the URLs below for documentation and sample code:

Display MSG contents: [ ](

Access Attachments: Aspose.Total for Java|Documentation

For MSG to PDF conversion in .NET, it is possible with Aspose.Network for .NET and Aspose.Words for .NET products, as shared by Alex.

But, in Java, it is possible using the following steps:

  1. Using Aspose.Network for Java
  • Load the MSG file

  • Get the RTF body of the message and save it to RTF file

  • Using Aspose.Words for Java

  • Load the RTF file

  • Save to PDF

The sample code is attached, that converts an MSG file to PDF.

Hi Saqib,

Thanks for the info.

As I understand I cannot save an MSG file to MHTML but can I save it to HTML using Java API?

Also can I attach email attachments extracted from MSG to the generated PDF?