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

Free Support Forum - aspose.com

Can Aspose java API hanldes *.msg files

Hi,

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?

Thanks

Manish


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.

Thanks,

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: http://www.aspose.com/documentation/java-components/aspose.network-for-java/parsing-outlook-message-files.html
Access Attachments: http://www.aspose.com/documentation/java-components/aspose.network-for-java/parsing-and-saving-attachments.html

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.
    You need to download the trial versions of Aspose.Words for Java and Aspose.Network for Java, if you do not have them already.

    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?

    Regards,
    Manish