-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need TimeZoneInfo on message #407
Comments
As far as I know, the sent info is always stored as UTC time so that you don't have any problems reading the property in another timezone... so I guess that AWS just uses UTC time and that you have to take into account into what timezone you are reading it. |
Can you sent me your msg file so that I can have a look at it? Please ZIP the file before sending it to sicos2002@hotmail.com |
I can't send the entire email in question because it is sensitive. But I am including the message source data, with some fields removed. but the relevant fields are still there. You can see some of the Received fields contain "Mon, 10 Apr 2023 10:07:23 -0700", with time zone included. Ideally, the time portion of the SentOn field should show "... 10:07 AM PST". Meanwhile I'll try to generate a test email that has this same issue. Thanks for your help on this! Received: from SA1PR08MB7151.namprd08.prod.outlook.com (2603:10b6:806:18a::12) X-Proofpoint-GUID: CPYUuba9QeqCWZEJDhEbBuDdAtcZvJwn |
Hey, I also emailed you a spam message I got containing the time zone data, it would have come from my work email, traridon [a] firstam.com. Thanks! |
I added this code to try to detect the timezone --> 517b495 Get the code from GitHub and try it out and let me know if it does what you need. |
Hey Sicos1977, I reviewed the code, this looks like it will work! Thanks for the quick turnaround on this. I will need some time to test it out. Thanks! |
So unfortunately this builds on an older Dot Net version that I cannot install on my work machine, so I cannot compile it locally. From what I can tell in the code though, this should do what we need it to. Can you go ahead and update the Nuget? Then I can update on my end and test it that way. Thanks! |
Get the latest nuget package |
Hi Sicos1977, Going from my above example, the SentOn field is returning "Mon, 10 Apr 2023 10:09:34" which has the the -0700 time zone. But the TimeZone field is returning -0600, which is coming from this field: So the times are different. The code in the SentOn property has this: But the TimeZone does not, so I believe this is where the discrepancy is. We need to make sure they are pulling the time from the same location. Maybe add the above code to the TimeZone property as well? Thanks! |
There is no timezone info in the PR_CLIENT_SUBMIT_TIME or PR_PROVIDER_SUBMIT_TIME ... this is always local time so I cant use that for timezone information. The only place where I can find timezone information is in the headers. |
Hi Sicos, This has a switch statement to return the various data types, but I found this for the DateTime type: I believe the DateTime.FromFileTime() is what's converting the time to a local time. Is there another method we can use that would allow us to retain the time zone? It just seems to me that since the msg file contains TimeZone info in the source data, that we should be able to get that. When you open the msg file in outlook, you can see the details, you can see the times and time zones, as flat text. It would be nice to have a TimeZone_SentOn and a TimeZone_ReceivedOn. Something like that. Let me know if this is possible. Thanks! |
I changed all DateTime properties to DateTimeOffset properties so you can now do whatever you want with a DateTime field from whatever TimeZone you are in. |
Describe the bug
Hi there! I have a request for this project, I have a few ideas to handle it but I'll leave the implementation to you. We are using this MSGReader library in an AWS Lambda project. We are noticing that when we open an email using this library locally, the SentOn field is correct. But when this runs in an AWS cloud environment, the SentOn is UTC time. Is there any way we can make sure SentOn is always the original time sent from the email? Or, to prevent modifying existing functionality, can you add another field that contains maybe TimeZoneInfo, or a DateTime object that contains the time zone within? I checked the email we are testing with, it does contain time zone info right next to the time being used to populate SentOn.
Our only alternative right now is I have to append "UTC" after the final date time info being rendered, which is not ideal. I can't look at local time to convert because we push this through a msg to PDF converter within the Lambda. So the final output is a read-only PDF.
Let me know what you think, or if you have any other questions. Appreciate the help on this!
Thanks!
-Trevor
To Reproduce
Expected behavior
SentOn field does not get converted to UTC, but retains time zone info
Or
New field with time zone data
Or
New field with original date time with time zone data
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Visual Studio 2022
AWS Lambda
Smartphone (please complete the following information):
none
Additional context
none
The text was updated successfully, but these errors were encountered: