How to get correct Delivery Time

Please Find the below attachment

AposeEmail Project.zip (5.6 MB)

Thanks,
Srivignesh

@srivignesh

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

Okay Thanks.

@srivignesh

We have tested the scenario using the latest version of Aspose.Email for .NET 22.6 and have not faced any issue with MapiMessage.DeliveryTime. Please check the attached images for detail.

messge.png (25.6 KB)
code.png (74.4 KB)

Regarding “Exception in myassociationready.com.eml”, we have not faced any exception using the shared code example.

I already said that, In my local It is working fine. But When I tested from another server I gets time differ.

When I deployed my solution into client server, then try to upload the .eml document from India, I gets wrong time.

Note: Client server is in US.

@srivignesh

Aspose.Email returns the MapiMessage.DeliveryTime correctly. Most probably this issue is not related to Aspose.Email. Could you please share the following detail for further testing?

  • The log files that you are creating at your local system and client server.
  • Please only get the MapiMessage.DeliveryTime at your local system can client server and share if both values are different.
  • Please execute the following code example at your local system can client server and check the output values. This code example does not use Aspose.Email.
DateTime localDateTime, univDateTime;
Console.WriteLine("Enter a date and time.");
string strDateTime = "6/27/2022 3:17:41 PM";

localDateTime = DateTime.Parse(strDateTime);
univDateTime = localDateTime.ToUniversalTime();

Console.WriteLine("{0} local time is {1} universal time.",
                    localDateTime,
                        univDateTime);

Testing is going on by Client, Once testing completed, I will Provide the Information of you asked

@srivignesh

Thanks for your feedback. As soon as you get requested information ready, we will start investigation into your issue and provide you more information.

It working fine. Thanks for reply.

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.