How to get correct Delivery Time from email

I have a case where we are storing emails into system X and i need to get the UTC delivery time from the email.

The Delivery time property contains the time based on the Outlook clients timezone, meaning that if the mail is stored from +0900 time zone the delivery date is in the future.

'example
Aspose.Email.Outlook.MapiMessage Mail = Aspose.Email.Outlook.MapiMessage.FromFile(file.SourceFilePath);
DateTime Dtime = Mail.DeliveryTime;

i could parse the header information to get the time zone (Mail.TransportMessageHeaders) but as its a huge string, parsing the information from this really feels a bit clumsy.
Is there a better way to get real delivery time?

@aghaemma,

Please try:

Mail.DeliveryTime.ToUniversalTime()

to get UTC time from the message’s delivery time.

1 Like

Thank you Kashif, that does the trick!

I wonder how have i missed that, I feel a bit stupid right now :smiley:

@aghaemma,

You are welcome and please feel free to write to us in case of any further query in this regard.

A post was split to a new topic: How to get correct Delivery Time