Free Support Forum - aspose.com

Sent date set to current date when converting .eml to .msg

Aspose Email for .Net version 20.11.0.0

Code sample :

MailMessage mail = MailMessage.Load("testemail.eml");
        using (var ms = new MemoryStream())
        {
            mail.Save(ms, new MsgSaveOptions(MailMessageSaveType.OutlookMessageFormat));
            var tmpfilename = "testemail.msg";
            File.WriteAllBytes(tmpfilename, ms.ToArray());
        }

When opening with outlook, the sent date is Mon 16/11/2020 06:24
Wenconverted to .msg, the sent date becomes today’s date

testemail.zip (3.9 KB)

@pnocera

After observing the stated issue, I have created a ticket with ID EMAILNET-39998 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi, I see that the ticket is closed, but this is still an issue in version 20.12.
Any news ?

Thanks,
Pierre

@pnocera

Can you please try using option to set PreserveOriginalDates to True on your end using latest version.

MailMessage mail = MailMessage.Load("testemail.eml");
        using (var ms = new MemoryStream())
        {
            MsgSaveOptions options = new MsgSaveOptions(MailMessageSaveType.OutlookMessageFormat);
            options.PreserveOriginalDates = true;
            mail.Save(ms, options);
            var tmpfilename = "testemail.msg";
            File.WriteAllBytes(tmpfilename, ms.ToArray());
        }

It works. Thanks !

@pnocera

It’s good to know that suggest option worked on your end.