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

Free Support Forum - aspose.com

Saving message in html format

Hi there, Since I couldn't find a way to convert .msg to .htm as in Outlook, i save as an mht using the MailInterpretor. However, the .mht doesn't display the mail header. Is there a way to load the header information into the mht, and perhaps save it as .htm? Or am I going about this the wrong way? Here is my code snippet :

MapiMessage mapiMsg;

string filename;

using (FileStream fs = new FileStream(

filename,

FileMode.Create))

{

MailMessageInterpretor mi = MailMessageInterpretorFactory.Instance.GetIntepretor(

mapiMsg.MessageClass);

mi.Save(mapiMsg, fs, Aspose.Network.Mail.MessageFormat.Mht);

mi = null;

}

Thanks,

Karen Schmidt

Hi Karen,


Could you please try the following alternative to get the mht with headers?

MapiMessage mapiMsg = MapiMessage.FromFile(“test.msg”);
// get MailMessageInterpretor instance
MailMessageInterpretor mi = MailMessageInterpretorFactory.Instance.GetIntepretor(mapiMsg.MessageClass);

// get MailMessage instance
MailMessage message = mi.Interpret(mapiMsg);
message.Save(“test.mht”, MailMessageSaveType.MHtmlFromat);