E-mail message is saved to pdf as HTML markup

Hello,



We are using next code for conversion of .msg files to PDF:

var message = Aspose.Email.Mail.MailMessage.Load(inputFilePath);

using (var msgStream = new MemoryStream())

{

message.Save(msgStream, new Aspose.Email.Mail.HtmlSaveOptions());

msgStream.Position = 0;

var options = new Aspose.Words.LoadOptions

{

LoadFormat = Aspose.Words.LoadFormat.Mhtml,

Encoding = Encoding.UTF8

};

var document = new Aspose.Words.Document(msgStream, options);

document.Save(outputFilePath, new Aspose.Words.Saving.PdfSaveOptions());

}



The result pdf file contains the html markup instead of presenting e-mail content. See the source and result files in attachment.



We are using Aspose.Email.dll of version 17.2.0.0 and Aspose.Words.dll of version 17.2.0.0.



Thanks in advance.

Valeriy

Hi Valeriy,

Thank you for writing to Aspose support team.

There seems to be some typo mistake in the code. You have used Html instead of Mht as shown below:

message.Save(msgStream, new Aspose.Email.Mail.HtmlSaveOptions());

You may please replace it with following line of code:

message.Save(msgStream, new Aspose.Email.Mail.MhtSaveOptions());