Issue in mapiMessage.ToMailMessage API

mapiMessage.ToMailMessage loses some of the email text when converting a MapiMessage
to a MailMessage.
As a result when we save this email to a PDF the PDF does not have some of the text included
in the email.

To Repro. run the following code:

            string filePath = @"C:\tmp\Re Catch up over next few weeks - Copy.msg";

            using (var stream = File.OpenRead(filePath))
            {
                MapiMessage mapiMessage = MapiMessage.FromStream(stream);
                MailMessage mailMessage = mapiMessage.ToMailMessage(new MailConversionOptions());

                if (mapiMessage.BodyHtml.Contains("6/21: 10:00-3:00pm PT") &&
                    !mailMessage.HtmlBody.Contains("6/21: 10:00-3:00pm PT"))
                {
                    Console.WriteLine("MapiMessage HTML has more text than MailMessage HTML");
                }
           }

On this file:
https://www.dropbox.com/s/tdavy0cislspskd/Re%20Catch%20up%20over%20next%20few%20weeks%20-%20Copy.msg?dl=0

@PeteLee

We have tested the sample code provided and it worked fine. Moreover, we have converted mailMessage to PDF as well and the generated PDF is showing complete text. Please have a look on the generated PDFSaveEmailAsPDF_out.pdf (119.8 KB).

For generating PDF, you may follow the code sample given below:

string filePath = @"D:\sample\" + "Re-Catch-up.msg";
            
using (var stream = File.OpenRead(filePath))
{
    MapiMessage mapiMessage = MapiMessage.FromStream(stream);
    MailMessage mailMessage = mapiMessage.ToMailMessage(new MailConversionOptions());

    if (mapiMessage.BodyHtml.Contains("6/21: 10:00-3:00pm PT") &&
        !mailMessage.HtmlBody.Contains("6/21: 10:00-3:00pm PT"))
    {
        Console.WriteLine("MapiMessage HTML has more text than MailMessage HTML");
    }
    else
    {
        MemoryStream ms = new MemoryStream();
        mailMessage.Save(ms, Aspose.Email.SaveOptions.DefaultMhtml);

        // create an instance of LoadOptions and set the LoadFormat to Mhtml
        var loadOptions = new Aspose.Words.LoadOptions();
        loadOptions.LoadFormat = LoadFormat.Mhtml;

        // create an instance of Document and load the MTHML from MemoryStream
        var document = new Aspose.Words.Document(ms, loadOptions);

        // create an instance of HtmlSaveOptions and set the SaveFormat to Html
        var saveOptions = new Aspose.Words.Saving.PdfSaveOptions();
        document.Save(@"D:\sample\" + "SaveEmailAsPDF_out.pdf", saveOptions);
    }
}

Did you change the file I sent you? Any modifications to the msg will make the problem go away.

To further investigate I created a stand-alone Visual Studio 2017 console App
referencing Aspose Email 18.8 and Aspose Words 18.9.
This is the app:
https://www.dropbox.com/s/uo3cbu6y96eswq5/AsposeEmailTest.zip?dl=0

The app includes the repro file and the code below.

When running this app I get the message:
MapiMessage HTML has more text than MailMessage HTML

And the resulting PDF does not include the line:
6/21: 10:00-3:00pm PT

If you want to try the app, you will need to do a nuget restore, as I did not include the packages
to make the app smaller.

I did not include the license in the test app … as I don’t think it matters ( I can repro the problem when using
a license)

This is the full app:

using System;
using System.IO;
using Aspose.Email;
using Aspose.Email.Mapi;

namespace AsposeEmailTest
{
class Program
{
static void Main(string[] args)
{
string filePath = @“Re-Catch-up.msg”;
using (var stream = File.OpenRead(filePath))
{

            MapiMessage mapiMessage = MapiMessage.FromStream(stream);
            MailMessage mailMessage = mapiMessage.ToMailMessage(new MailConversionOptions());

            if (mapiMessage.BodyHtml.Contains("6/21: 10:00-3:00pm PT") &&
                !mailMessage.HtmlBody.Contains("6/21: 10:00-3:00pm PT"))
            {
                Console.WriteLine("MapiMessage HTML has more text than MailMessage HTML");
            }

            MemoryStream ms = new MemoryStream();
            mailMessage.Save(ms, Aspose.Email.SaveOptions.DefaultMhtml);

            // create an instance of LoadOptions and set the LoadFormat to Mhtml
            var loadOptions = new Aspose.Words.LoadOptions();
            loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;

            // create an instance of Document and load the MTHML from MemoryStream
            var document = new Aspose.Words.Document(ms, loadOptions);

            // create an instance of HtmlSaveOptions and set the SaveFormat to Html
            var saveOptions = new Aspose.Words.Saving.PdfSaveOptions();
            document.Save(filePath + ".pdf", saveOptions);
        }

    }
}

}

@PeteLee

In previous observation, we just renamed the file. Now we have reproduced this issue at our end and it has been logged with issue ID “EMAILNET-39118” for further investigation.
You will automatically be notified here once we have more information to share.

The issues you have found earlier (filed as EMAILNET-39118) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan