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

Posted by John Sibly on Stack Overflow See other posts from Stack Overflow or by John Sibly
Published on 2010-04-13T14:14:11Z Indexed on 2010/04/13 14:22 UTC
Read the original article Hit count: 226

Filed under:
|
|

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

Looking at the header information of an email includes information like:

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
 <[email protected]>; 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 a date, time and timezone indicated on the end.

Which one of these should I attempt to parse? Is this a reliable way to figure out the sender's timezone, or anyone recommend a better way?

© Stack Overflow or respective owner

Related posts about c#

Related posts about email