Aspose Email C#: Get HTML string with inline images

122 Views Asked by At

We have created extension code in .NET to get HTML string of outlook email(.msg). We are using Aspose.Email .net library. We are rendering this HTML string in web application. Our email is rendered as HTML correctly except inline images.

Below is our code.

    var fileBytes = File.ReadAllBytes("Sample.msg");
    Stream stream = new MemoryStream(fileBytes);         
    MailMessage message = MailMessage.Load(stream);
    var htmlString = message.HtmlBody;

Above code is giving HTML string as - <img src="cid:[email protected]" >

When we use below code then images are embedded as base 64- message.Save(“output.html”, SaveOptions.DefaultHtml);

This is saving HTML as - <img src="data:image/png;base64,.....>

But we don’t want to save as HTML file we need HTML string with embedded images as base 64.

Best Regards, Nitin

0

There are 0 best solutions below