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

Free Support Forum - aspose.com

Embedding images in html


Regarding the post “Images are not displaying in Emails”, is there a way to embed the images into html in the form of base64 (src=“data:image/png;base64…”)?

Thank you,

Hi Huseyin,

Thank you for writing to Aspose support team.

Aspose.Email deals all the images/contents in the body as linked resources which can then be rendered to various output formats including HTML.

1. The following code sample converts the message to HTML with linked resources embedded inside the HTML as Base64 data.

MailMessage msg = MailMessage.Load(“Input.msg”);

msg.Save(“output.html”, Aspose.Email.Mail.SaveOptions.DefaultHtml);

2. The following code sample doesn't include the linked resources embedded to the output HTML.

Aspose.Email.Mail.HtmlSaveOptions options = Aspose.Email.Mail.SaveOptions.DefaultHtml;
options.EmbedResources = false;
eml.Save("Output.html", options);

Thank you Kashif, it solved my case.

Hi Huseyin,

We are glad to know that the provided sample code met your requirements. Please feel free to contact us in case you have any other query/inquiry related to Aspose.Email. We’ll be glad to assist you further in this regard.