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

Free Support Forum - aspose.com

Export MHT without sender information?

This is my code…


Dim opt As New MsgLoadOptions()
Dim msg As MailMessage = MailMessage.Load(mailPath + “email.msg”, opt)
msg.Save(mailPath + “email.mht”, SaveOptions.DefaultMhtml)


When I open up the mht file, I can see the sender (name, date etc). Is it possible to hide this when saving?

I load the MHT file into a webbrowsercontrol and I only want to show the html body.

Thanks

Hi,


Thank you for posting your inquiry.

You can use the MhtSaveOptions to avoid writing email headers to output MHTML. Please have a look at the following code sample and let us know if we could be of any additional help to you in this regard.

Sample Code

MailMessage eml = MailMessage.Load(“828929\Re- AFT good progress[16].eml”);

MhtSaveOptions options = new MhtSaveOptions();
options.MhtFormatOptions = MhtFormatOptions.None;

eml.Save(“828929\Re- AFT good progress[16].mhtml”, options);

Super - perfect! Thanks.

Is it possible to load a MailMessage (MSG) with inline images and show it in a DotNet WebBrowserControl without having to save it as MHT file first (and then load the MHT file in the WebBrowserControl)?


Thanks.

Hi,


You can save the MailMessage to MemoryStream (using the overloaded version of Save method) and then load the stream in browser as byte array. A simple search on Google resulted in this help over StackOverflow and will be sufficient for your requirements. Please let us know if you need any further assistance in this regard.
Cool thanks!

This worked...

Dim message As MailMessage = MailMessage.Load("email.msg")
Using msgStream As New MemoryStream
Dim opt As New HtmlSaveOptions
message.Save(msgStream, opt)
msgStream.Position = 0
Dim arr As Byte() = msgStream.ToArray
web.DocumentStream = New MemoryStream(arr)
End Using

:)

You are welcome.