MapiMessage.SetBodyContent does not change HtmlBody

Dear Aspose team,

If I use the MapiMessage.SetBodyContent with BodyContentType.Html, then the HtmlBody property of the message is not updated.

The sample code that I can use to reproduce this:

            MailMessage message = MailMessage.Load(args[0]);
            MapiMessage mapi = MapiMessage.FromMailMessage(message);

            Console.WriteLine("Old body:");
            Console.WriteLine(mapi.BodyHtml);

            mapi.SetBodyContent("This is the new content.", BodyContentType.Html);

            Console.WriteLine("New body:");
            Console.WriteLine(mapi.BodyHtml);

At the end of execution, still the old body is written out. I could reproduce this with the most recent version of Aspose.

Can you confirm that this is a bug and you will fix it in the future, or am I missing something and this is expected behavior?

Best regards,

Gergely Vándor

@gergelyv,

Thank you for contacting Aspose support team.

I have tried the following sample but could not reproduce the issue. Your sample message file is required to analyze the problem and provide assistance accordingly, therefore please share the sample file for our testing.

MailMessage message = new MailMessage("user@gmail.com", "to@gmail.com", "Test Subject", "Test Body");
MapiMessage mapi = MapiMessage.FromMailMessage(message);

Console.WriteLine("Old body:");
Console.WriteLine(mapi.BodyHtml);

mapi.SetBodyContent("This is the new content.", BodyContentType.Html);

Console.WriteLine("New body:");
Console.WriteLine(mapi.BodyHtml);

Dear Kashif Iqbal,

I uploaded the program code and the sample e-mail I used for the test: pack.zip (22.6 KB)

Please let me know if I can add anything more to this.

Best regards,

Gergely Vándor

@gergelyv,

Thank you for providing the sample file. It is observed that body is updated and displayed fine by Outlook, however Aspose.Email does not show it properly. This issue is logged under Id:EMAILNET-38827 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

Perfect. Thanks.

@gergelyv,

This issue has been fixed in the latest release of Aspose.Email for .NET 17.10 which is available for download now.

@kashif.iqbal,
Thanks, we will check it.

@gergelyv,

Thank you for the feedback.

Thank you, the issue is not reproducible anymore.

Best Regards

@gergelyv,

You are welcome.