Coder Social home page Coder Social logo

Comments (12)

Sicos1977 avatar Sicos1977 commented on August 27, 2024

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.

from msgreader.

Sicos1977 avatar Sicos1977 commented on August 27, 2024

Can you sent me your msg file so that I can have a look at it? Please ZIP the file before sending it to [email protected]

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

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)
by BYAPR08MB4903.namprd08.prod.outlook.com with HTTPS; Mon, 10 Apr 2023
17:09:49 +0000
Received: from BN9PR03CA0787.namprd03.prod.outlook.com (2603:10b6:408:13f::12)
by SA1PR08MB7151.namprd08.prod.outlook.com (2603:10b6:806:18a::12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Mon, 10 Apr
2023 17:09:35 +0000
Received: from BN8NAM12FT022.eop-nam12.prod.protection.outlook.com
(2603:10b6:408:13f:cafe::cc) by BN9PR03CA0787.outlook.office365.com
(2603:10b6:408:13f::12) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38 via Frontend
Transport; Mon, 10 Apr 2023 17:09:35 +0000
Authentication-Results: spf=pass (sender IP is 209.85.167.45)
smtp.mailfrom=gmail.com; dkim=pass (signature was verified)
header.d=gmail.com;dmarc=pass action=none header.from=gmail.com;compauth=pass
reason=100
Received-SPF: Pass (protection.outlook.com: domain of gmail.com designates
209.85.167.45 as permitted sender) receiver=protection.outlook.com;
client-ip=209.85.167.45; helo=mail-lf1-f45.google.com; pr=C
Received: from mx0b-00128103.pphosted.com (205.220.172.180) by
BN8NAM12FT022.mail.protection.outlook.com (10.13.183.82) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.6298.27 via Frontend Transport; Mon, 10 Apr 2023 17:09:34 +0000
Received: from pps.filterd (m0352049.ppops.net [127.0.0.1])
by mx0b-00128103.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33AEnBTv004960
for [email protected]; Mon, 10 Apr 2023 10:09:34 -0700
Authentication-Results-Original: ppops.net; spf=pass
smtp.mailfrom=[email protected]; dkim=pass header.s=20210112
header.d=gmail.com; dmarc=pass header.from=gmail.com
Received: from pps.reinject (localhost [127.0.0.1])
by mx0b-00128103.pphosted.com (PPS) with ESMTPS id 3pvm84gt73-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for [email protected]; Mon, 10 Apr 2023 10:09:34 -0700
Received: from pps.reinject (m0352049.ppops.net [127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33AH3Xb7021183
for [email protected]; Mon, 10 Apr 2023 10:09:33 -0700
Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45])
by mx0b-00128103.pphosted.com (PPS) with ESMTPS id 3pvm84gsvr-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)
for [email protected]; Mon, 10 Apr 2023 10:07:23 -0700
Received: by mail-lf1-f45.google.com with SMTP id t20so7150543lfd.5
for [email protected]; Mon, 10 Apr 2023 10:07:22 -0700 (PDT)
X-Google-Smtp-Source: AKy350ah2NJ+OIQyZ3lavCiug0zzjo/iU1C2q9xLFjxi01eIwIhCZr7Vsww3NZBhNSaCDG/lhk6cwMU5rjdh7SL/Pao=
X-Received: by 2002:a19:ac06:0:b0:4eb:1606:48d5 with SMTP id
g6-20020a19ac06000000b004eb160648d5mr2171535lfc.7.1681146440717; Mon, 10 Apr
2023 10:07:20 -0700 (PDT)
MIME-Version: 1.0
From: Bill Hurd [email protected]
Date: Mon, 10 Apr 2023 11:07:08 -0600
Message-ID: CAKmEThsXVO4sXOD-uBP8Jjp3vKUj-sz+NCqvo1G7KRrP2s5xZg@mail.gmail.com
Subject: [External] Buyers Cancellation - 380 Hunters Ridge Cir
To: Jose Ornelas [email protected], Jen Bohn [email protected],
Jeff Bohn [email protected]
Content-Type: multipart/mixed; boundary="0000000000006a353705f8fe687b"

X-Proofpoint-GUID: CPYUuba9QeqCWZEJDhEbBuDdAtcZvJwn
X-Proofpoint-ORIG-GUID: jYIcEjO_9PBsBzdn5MVYP5YUGxq_DtcP
X-CLX-Shades: Deliver
X-External-Message: external
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22
definitions=2023-04-10_12,2023-04-06_03,2023-02-09_01
X-Proofpoint-Spam-Details: rule=inbound_noblock_bulk_notspam policy=inbound_noblock_bulk score=0
mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1005 bulkscore=0
suspectscore=0 mlxscore=0 priorityscore=338 spamscore=0 lowpriorityscore=0
adultscore=0 impostorscore=0 classifier=clx:Deliver adjust=0 reason=mlx
scancount=2 engine=8.12.0-2303200000 definitions=main-2304100147
domainage_hfrom=10102
Return-Path: [email protected]
X-MS-Exchange-Organization-ExpirationStartTime: 10 Apr 2023 17:09:35.1208
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id:
fa7f34a5-c3df-470c-a0f5-08db39e65bf6
X-EOPAttributedMessage: 0
X-EOPTenantAttributedMessage: 4cc65fd6-9c76-4871-a542-eb12a5a7800c:0
X-MS-Exchange-Organization-MessageDirectionality: Incoming
X-MS-Exchange-SkipListedInternetSender:
ip=[209.85.167.45];domain=mail-lf1-f45.google.com
X-MS-Exchange-ExternalOriginalInternetSender:
ip=[209.85.167.45];domain=mail-lf1-f45.google.com
X-MS-PublicTrafficType: Email

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

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!

from msgreader.

Sicos1977 avatar Sicos1977 commented on August 27, 2024

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.
One thing I'm not sure of is if this code also takes day light saving time into account.

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

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!

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

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!

from msgreader.

Sicos1977 avatar Sicos1977 commented on August 27, 2024

Get the latest nuget package

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

Hi Sicos1977,
I believe there is an issue with this. The SentOn time is being pulled from one location, and the TimeZone is being pulled from another.

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:
Date: Mon, 10 Apr 2023 11:07:08 -0600

So the times are different.

The code in the SentOn property has this:
_sentOn = GetMapiPropertyDateTime(MapiTags.PR_CLIENT_SUBMIT_TIME) ??
GetMapiPropertyDateTime(MapiTags.PR_PROVIDER_SUBMIT_TIME);

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!

from msgreader.

Sicos1977 avatar Sicos1977 commented on August 27, 2024

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.

from msgreader.

Xenophage666 avatar Xenophage666 commented on August 27, 2024

Hi Sicos,
I was digging into this more, and I found in the Storage.cs file, the method:
private object GetMapiPropertyFromPropertyStream(string propIdentifier)

This has a switch statement to return the various data types, but I found this for the DateTime type:
case PropertyType.PT_SYSTIME:
var fileTime = BitConverter.ToInt64(propBytes, i + 8);
return DateTime.FromFileTime(fileTime);

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!

from msgreader.

Sicos1977 avatar Sicos1977 commented on August 27, 2024

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.

from msgreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.