MailMessage has UTC Time instead of Local time

Hi.

The current version of Aspose.Email has a problem mit email date.
MailMessage.Date ist the UTC time instead of Local time when I load mail from msg-file.

In the old version 6.5 of Aspose.Email it shows the corret Local time.
I need a solution for our customer. How can this be resolved?

Tanks
Zhentao

@zhentaosong,

I have observed the issue shared by you and request you to please share the working sample project along with source MSG file and snapshot. We will be able to investigate the issue further on our end on provision of requested information.

Hi,
You can reproduce the bug with this code.
Save a email from outlook as msg file and load in MailMessag, then you see the date ist UTC time.
With the version 6.5 you get local time. Our customers have a lot of isssues with our new version and we need a solution ASAP.

var msg = Aspose.Email.MailMessage.Load(msgFilename);
var date = msg.Date;

Thanks
Zhentao

@zhentaosong,

I have observed your requirements and like to share that in latest versions we have deliberately changed the date to UTC. You need to convert that to your local time using following:

var date = msg.Date.ToLocalTime();

Hi @mudassir.fayyaz, Thank you.
I have a requirement where we need to Convert email to PDF.
here we are using Aspose.mail to convert email to
Dim msg As Aspose.Email.MailMessage = Aspose.Email.MailMessage.Load(Request.Files(0).InputStream, New MsgLoadOptions())
The Date is showing in UTC.
I tried to use the below code
msg.Date=msg.Date.ToLocalTime()
But in PDF converted date is still showing in UTC.

Please advise.

Hello @RAJASHM,

To investigate your issue, could you share the message file and a more detailed code sample on loading and converting the file.

Thank you.

Hi @margarita.samodurova, Thank you so much.
Please find the zip file containing the input email and Out put PDf with the sample code we are using.

Kindly advise.
Thank youInput and output with sample code.zip (52.5 KB)

@RAJASHM,

Thanks for providing the file and sample code. We will check your problem and share the results.

Hello @RAJASHM,

Please use the following code to set Local time:

Dim msg As Aspose.Email.MailMessage = Aspose.Email.MailMessage.Load(Request.Files(0).InputStream, New MsgLoadOptions())
msg.TimeZoneOffset = TimeZoneInfo.Local.BaseUtcOffset

Thank you so much @margarita.samodurova, it worked

@RAJASHM,

Thank you for using our product.

If you have any other questions, please, feel free to ask.