How to get correct Delivery Time

same issue comes in Production site, can you check,

Here you can find the details

My orginal Email Delivert Date&Time -> 2022-07-19 07:25:39.227

ASPose.Email Package Start
DeliveryTime -> 7/19/2022 3:25:39 AM
ToUniversalTime -> 7/19/2022 7:25:39 AM
ToFileTimeUtc 133026891392257686
ToLocalTime 7/19/2022 3:25:39 AM
ClientSubmitTime -> 7/19/2022 3:25:25 AM
PR_MESSAGE_DELIVERY_TIME -> 7/19/2022 7:25:39 AM
ASPose.Email Package End

Note : Some .eml and .msg files working fine, But some times it won’t

@srivignesh

Could you please share the EML and MSG files for which you are facing this issue? Please also share the requested detail in this post.

Example 1:

“Exception in myassociationready.com(Aspose.Email Evaluation)”
orginal Delivery date & time : 3/17/2022 9:47 AM
Received date : 3/17/2022 4:17(UTC)
offset value : +530
Received date to univeraltime : 3/17/2022 9:47 AM

Example 2:

“RE: Update of RR2(Aspose.Email Evaluation)”
orginal Delivery date & time : 7/19/2022 3:26 AM
Received date : 7/19/2022 12:55:00 AM
offset value : +000
Received date to univeraltime : 7/19/2022 7:25:00 AM

Note : example 1 sender and receiver will be same country.
example 2 sender and receiver will be different country

ReadyCollect Case Document.zip (48.1 KB)

can you please check this one

@srivignesh

We are investigating this issue and will get back to you soon.

okay thanks @tahir.manzoor

Does this condition needed

if (msg.DeliveryTime.Kind == DateTimeKind.Local)
{
var ToLocalTime = msg.DeliveryTime.ToLocalTime();
}
else
{
var DeliveryTime = msg.DeliveryTime.ToUniversalTime();
}

@srivignesh

In your code, you are using MapiMessage.FromStream method. This method is obsolete now. Please use MapiMessage.Load instead.

We have investigated this issue with your shared files and noticed that the delivery date and time is correct according to files.

Could you please share how are you checking original delivery date and time at your end? Please also share the screenshots of delivery date and time of EML and MSG files.

okay can you sent me full code in c#

image.png (22.8 KB)

image002.png (33.3 KB)

@srivignesh

We used following code example to test your case. Please check the output in attached image. output.jpg (291.2 KB)

MapiMessage msg = new MapiMessage();
msg = MapiMessage.Load(MyDir + "Exception in myassociationready.com.eml");
Console.WriteLine("ASPose.Email Package Start" + DateTime.Now.ToString());
var CAADisplayDate = msg.DeliveryTime.ToUniversalTime();
Console.WriteLine("DeliveryTime " + msg.DeliveryTime + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("ToUniversalTime " + msg.DeliveryTime.ToUniversalTime() + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("ToFileTimeUtc " + msg.DeliveryTime.ToFileTimeUtc() + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("ToLocalTime " + msg.DeliveryTime.ToLocalTime() + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("ClientSubmitTime " + msg.ClientSubmitTime + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("PR_MESSAGE_DELIVERY_TIME " + msg.GetPropertyDateTime(MapiPropertyTag.PR_MESSAGE_DELIVERY_TIME) + " Ended_" + DateTime.Now.ToString());
Console.WriteLine("ASPose.Email Package End" + DateTime.Now.ToString());

However, we have logged an investigation ticket as EMAILNET-40652 in our issue tracking system for your case. We will inform you via this forum thread once there is an update available on it.

okay Thank you very much, I will test from my end and let you know.

which date&time should I use
Either DeliveryTime nor ToUniversalTime

@srivignesh

The MapiMessage.DeliveryTime property is used to get or set the date and time a message was delivered. You can use this property to get the delivery time of EML or MSG file.

@srivignesh

It is to inform you that we have closed the issue EMAILNET-40652 as ‘Not a Bug’.

Different delivery times are not Aspose.Email bug, but expected behavior. The MSG format is a set of Mapi properties where DateTime is always stored in UTC format. But Outlook and Aspose.Email shows DateTime properties in the local time zone of the current computer.