How to determine the timezone where an email was sent in C #

Can anyone recommend a way to determine the timezone where the email was sent in C #?

Looking at the header information in the email, you can specify the following information:

Received: from mail-ew0-f211.google.com (123.85.219.211) by UKExchange
 (10.1.10.99) with Microsoft SMTP Server id 1.2.345.6; Tue, 13 Apr 2010
 14:26:24 +0100
Received: by ewy3 with SMTP id 3so288857ewy.6        for
 <john.sibly@mycompany.com>; Tue, 13 Apr 2010 06:26:23 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.103.213.2 with HTTP; Tue, 13 Apr 2010 06:26:23 -0700 (PDT)
X-Originating-IP: [83.244.243.210]
Date: Tue, 13 Apr 2010 14:26:23 +0100
Received: by 10.103.3.17 with SMTP id f17mr3087878mui.123.1271165183473; Tue,
13 Apr 2010 06:26:23 -0700 (PDT)

      

There are a number of "Received: from" and "Received: by" keys with the date, time and time zone at the end.

Which one should I try to make out? Is this a reliable way to determine the sender's timezone, or is someone recommending a better way?

+2


a source to share


2 answers


The various "accepted" entries are the times when each subsequent server received the email in reverse order (ie the last server to receive mail is on top of the stack). However, this is not the date the message was sent, it is the date when the message was received by the server.

The date of compilation of the message is indicated by the heading "Date", which must be unique.



Thus, depending on what you want to do exactly, you should either take the LAST "received" header (which should be the date the message was sent according to the first SMTP server) or the "date" header (which should be the time, when the user clicked the "new mail" or "reply" button and contained the client's timezone - assuming you are dealing with a real client, not webmail).

If you are dealing with webmail, then the content of the time zone can be anything from the real original TZ user to what was set by the default web server.

+3


a source


In theory, the timestamp in the Received field is accurate. Here's the documentation:

http://cr.yp.to/immhf/date.html#timestamp



The only problem in this part:

In practice, SMTP servers put all kinds of poorly formatted information on Received lines. It is probably best for readers to view everything up to the final semicolon as unstructured text, solely for human consumption.

+2


a source







All Articles