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

Free Support Forum - aspose.com

Load EML file and save as HTML?

If I need to load a EML file from disc, and then save it out as HTML, would Aspose.Email be the correct SDK to use?

Or would I maybe use Aspose.Words and somehow specify a EML format?

In any case, anybody have any ideas how to convert EML=>HTML with the Aspose SDKs?

Thanks much!


Hi Andrew,

Thank you for considering Aspose products.

There is no predefined method available to save a message file as HTML. However, you can use the following code sample to save an EML file as HTML. Please let us know if you have any additional inquiry/query in this regard.

Sample Code:

MailMessage eml = MailMessage.Load(“InlineImage.eml”);<o:p></o:p>

// Save all embedded images

foreach (LinkedResource res in eml.LinkedResources)


res.Save("EMAIL_487490\\" + res.ContentId);


String strHtmlContents = eml.HtmlBody.Replace("cid:", "");

//Save the HTML contents to file

System.IO.File.WriteAllText("EMAIL_487490\\" + "Test.html", strHtmlContents);

Thanks so much for the quick reply! I’ve tested your code, and I do have a question about how the images are saved out. When I run my test code, I end up with a bunch of image files with names such as:


The suffix after the @ token is based on the value of ContentId. So if I go to the Windows explorer and delete the suffix so I have a file named:


I am unable to open the image.

Any idea what I might be doing wrong? My hope is that if the email has embedded images, they will each be saved out as a separate image file which can be opened for viewing.

Thanks again for your help.

Hi Andrew,

Thanks for the feedback.

I have tested this scenario at my end by renaming the saved image file name from companylogo (this is the content ID) to companylogo.jpg and the image opens fine from windows explorer. It should work as Aspose.Email is doing nothing else other than saving the linked resources to disc. Could you please send us a sample EML file that we could use to investigate this issue further? We’ll look into it and assist you further.