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

Free Support Forum - aspose.com

Saving Email to MHtml

I was wondering if it is possible to change the format of the header of the email when saving it as Mht ?

Hi,

Thank you for inquiry.

We only use the body of the message for converting to MHT format. The header is just written in plain text, each line in

tag.

So there is no way to change the formatting of it?

I have a requirement to make it look roughly the same way Outlook formats it when it is printed.
Is there anyway that can be accomplished using any Aspose library?

Hi,

I have logged this issue in our system (ID: 30925). We will update the header formatting and make it look like similar to the Outlook saved MHT or printed email. Although in print, there is extra heading on sender’s name with a line. I will inform you when it gets resolved.

Any progress on this?


I have also noticed that the text encoding gets messed up in some emails when saved to mht.
The MailMessage.BodyEncoding comes back with UTF-8, however the generated html view in the mht file shows as Windows-1252

Is there a way to correct this encoding?

EDIT:
Also is the MhtMessageFormatter class still used?
I found an example of it, however the MailMessage.Save appears to not have the proper overload that accepts it

Sample:
Dim mail As MailMessage = MailMessage.Load(file, MessageFormat.Msg)
Dim f As New MhtMessageFormatter()

f.FormFormat = "FROM:{0}
"

f.SentFormat = "SENT:{0}
"

f.SubjectFormat = "SUBJECT:{0}
"

f.ToFormat = "TO:{0}
"

f.CcFormat = "CC:{0}
"

f.AttachmentFormat = "ATT:{0}
"

mail.Save(“D:\codestore</span>Aspose.Email\phone2.mht”, MessageFormat.Mht, f)

Hi,


Just to bring in your knowledge that we have recently released Aspose.Email for .NET v1.2.0. Please check out the release notes and test your scenarios with this latest version.

If any of your said issues persists with the latest version then please provide us some sample message files for our review.

Thank you for your cooperation and understanding.