MailMessage saves to file and changes the maildate to currentdate

Hello

in my example code opened MSG-file in MapiMessage and then converts to MailMessage.
Save the MailMessage to a newFilename.
Open newFilename in Outlook and the maildate is changed to currentdate.

It works korret if I use Aspose.Email version 6.5.

var mapiMessage = MapiMessage.FromFile(msgFilename);
using (MemoryStream stream = new MemoryStream())
{
mapiMessage.Save(stream);
stream.Seek(0, SeekOrigin.Begin);
var msg = MailMessage.Load(stream, new MsgLoadOptions());
msg.Save(newFilename, SaveOptions.DefaultMsgUnicode);
}

Thanks
Zhentao

Welcome back, @zhentaosong!
Thank you for the issue description and code snippet. Could you also share the MSG file for investigating the problem, please?

You can test with any MSG-file.

@zhentaosong,
I have checked your code snippet with Aspose.Email 21.1. I found no problems. Please, share more details for the issue:

  • specify changed properties of MapiMessage object or send screenshots
  • specify the version of Aspose.Email library that has the problem

I build my code snippet in the AsposeEmailTest Console Application.
You get the result in the PNG-files, compare the maildate in NewMailFile with OrgMailFile.AsposeEmailTest.zip (4.4 MB)

@zhentaosong,
Thank you for the additional details. I have reproduced the problem and got the same results. I have logged the issue in our tracking system with ID EMAILNET-40096. Our development team will investigate it. You will be notified when it fixed.

@zhentaosong
We have investigated the issue. Thank you for your patience. To keep original dates, you shoud use PreserveOriginalDates option as below:

var msg = MailMessage.Load(stream, new MsgLoadOptions());
MsgSaveOptions options = SaveOptions.DefaultMsgUnicode;
options.PreserveOriginalDates = true;
msg.Save(dataPath + "NewMsgFile.msg", options);

Documents: Saving as MSG with Preserved Dates
API Reference: MsgSaveOptions Properties

This works for me, thank you