We have created extension to get HTML string of outlook email(.msg).
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
When we save it as HTML then images are embedded as base 64-
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.