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

Free Support Forum - aspose.com

Converting to MHTML with attachments


Is it possible to use this library to attach files with MHTML when converting email to message?

Hi Michael,

Thank you for contacting Aspose support team.

Aspose.Email can be used to render the attachment names, inline images and calendar events in the mhtml file. However the contents of the attachments cannot be rendered to the mhtml file. You may please give a try to the following sample code and share the feedback.

MailMessage msg = MailMessage.Load(@“TestSubject.msg”, new MsgLoadOptions());<o:p></o:p>

MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();

mhtSaveOptions.MhtFormatOptions = MhtFormatOptions.RenderCalendarEvent | MhtFormatOptions.WriteOutlineAttachments;

msg.Save(@"TestSubject.mht", Aspose.Email.Mail.SaveOptions.DefaultMhtml);