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

Free Support Forum - aspose.com

Missing images converting MHT to HTML

We are using Aspose.Email to convert an MHT file to HTML. In the process of doing this, we are seeing that the images are being lost. We have noticed that this happens when the Content-Location in the MHT is missing the protocol portion. For example, if the MHT has html body with an image tag like this: and the Content-Location for that image looks like this:

Content-Location: image001
Content-Transfer-Encoding: base64
Content-Type: image/png

The conversion will fail. However, if we add a protocol like “file://” then it works correctly:

Content-Location: file://image001
Content-Transfer-Encoding: base64
Content-Type: image/png

The code below is the one that we use to convert the file. Is this a bug? Or are there any options to export the file successfully? Thanks.

var loadOptions = new MhtmlLoadOptions();
var mailMessage = MailMessage.Load(stream, loadOptions);
var saveOptions = new HtmlSaveOptions {HtmlFormatOptions = HtmlFormatOptions.WriteHeader | HtmlFormatOptions.DisplayAsOutlook };
mailMessage.Save(memoryStream, saveOptions);


Thank you for writing to Aspose support team.

Could you please send us your sample message for our analysis here? It will help us to observe the issue and provide assistance accordingly.

Sure, please find attached… thanks

Test.zip (9.6 KB)


Thank you for providing the sample file. I have opened it in Google Chrome and Internet Explorer both. I am afraid that I am not able to view any image in this source MHT file. Could you please confirm if any image can be seen in this MHT file and how? It will help us to observe the requirement and provide assistance accordingly.

Please find attached a simpler file. This one opens in IE.
Test2.zip (1.3 KB)


The issue has been logged as EMAILNET-39014 for further investigation. We’ll update you here once there is some information or a fix version available in this regard.

Thanks Kashif. If found a couple more examples that I wanted to share.

MoreExamples.zip (1012.9 KB)


Thank you for sharing additional sample files. We’ll consider these while investigating the issue.

The issues you have found earlier (filed as EMAILNET-39014) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal