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

Free Support Forum - aspose.com

Export gmail email body part into HTML file using java


My requirement is to export the email body part (from gmail ) to HTML document using java.
Kindly provide help as its urgent.

Thanks in advance

Hi Pankaj,

Thank you for writing to Aspose Support team.

Aspose.Email for Java API lets you retreive messages from any host server in MailMessage object. Once the email is retrieved, it can be converted to HTML using the following sample code. Please try it at your end and let us know your feedback.

Sample Code:

MailMessage eml = MailMessage.load(dataDir + “test.eml”);//this can be retrieved from server as well using POP3 or IMAP
HtmlSaveOptions options = SaveOptions.getDefaultHtml();
options.setHtmlFormatOptions(HtmlFormatOptions.WriteHeader | HtmlFormatOptions.WriteCompleteEmailAddress);
eml.save(dataDir + “SavingMessageAsHTML_out2.html”, options);

can i export the mail directly from gmail a/c to html file using aspose API. i don’t want to use outlook/ tool to retrive/ save the mail in my system.

Hi Pankaj,

Aspose.Email API is not dependent on Microsoft Outlook and does not require Oultook for working with email servers. You can use the API without installing MS Outlook or any other Microsoft product for this purpose. Please feel free to write to us for any further query in this regard.

In your reply on 12-16-2016, 1:33 PM you provide the code in which we are generating the excel using test.eml.

In my previous reply I wanted to ask the way to generate the excel without generating of any .eml or any other type file and want to generate the excel from gmail’s email directly.


Hi Pankaj,

Could you please share what do you mean by “generate the excel without generating of any .eml or any other type file and want to generate the excel from gmail’s email directly”?

Aspose.Email API doesn’t support any conversion to Excel formats. The supported conversion formats are as mentioned here: http://www.aspose.com/docs/display/emailjava/Converting+Email+Messages .Please have a look at these and let us know if we could be of any help to you in this regard.