Timezone issue with sent mail

0 votes
asked Dec 30, 2015 by mrblint (340 points)
edited Dec 30, 2015 by mrblint

When I create the mail message, I am doing this:

mail.Date =  System.DateTime.UtcNow;

Is that the proper way? My mail is showing up on the recipient's end as if it had been sent five hours after it was actually sent. Mail sent at 3:53PM is being displayed in the mail clients as mail sent at 8:53PM.

Sender and Recipient are in the same timezone, and the timezone is correctly set in the recipients' mail clients to US/Eastern.

Here's an example header (with some of the values xxx'd or 000'd)

Delivered-To: xxxxxxx@xxxxxxxxxx.com
Return-Path: <xxxxxxx@xxxxxxxxxx.com>
Received: from smtp42.gate.ord1c (smtp42.gate.ord1c.rsapps.net [172.28.146.42])
    by store252a.mail.ord1c (SMTP Server) with ESMTP id 9A4A924804E
    for <xxxxxxx@xxxxxxxxxx.com>; Mon, 28 Dec 2015 15:53:07 -0500 (EST)
X-Spam-Exception: WHITELISTED
X-Spam-Threshold: 95
X-Spam-Score: 0
X-Spam-Flag: NO
X-Virus-Scanned: OK
X-MessageSniffer-Scan-Result: 0
X-MessageSniffer-Rules: 0-0-0-17604-c
X-CMAE-Scan-Result: 0
X-CNFS-Analysis: v=2.1 cv=U6OrU4bu c=1 sm=0 tr=0 a=E3KZ53FmvAFxQtyWo729Vw==:117 a=E3KZ53FmvAFxQtyWo729Vw==:17 a=eUUv1Kr9AAAA:8 a=GF4HiIEFAAAA:8 a=gJXaGKmUAAAA:8 a=j_THLXQgAAAA:8 a=9aB_464TkPoA:10 a=ZF5xyRqM_rsA:10 a=wUQvQvOEmiQA:10 a=XldT38RWNwACPDQzwzUA:9 a=a6TuipSTKi9_n9gZ5wgA:9 a=rxU8d5E9zrHUl-Wq:21 a=CjuIK1q_8ugA:10 a=-e9UblrzyaYA:10 a=VZUV-xAXAcgA:10 a=hokfEHsddmAA:10 a=tUgD1FESsEOEsYIsAIkA:9 a=c9A9mnKb6z0JHuZG:18 a=HXjIzolwW10A:10
X-Orig-To: xxxxxxx@xxxxxxxxxx.com
X-Originating-Ip: [173.000.000.63]
Received: from [173.000.000.63] ([173.000.000.63:57692] helo=smtp3.relay.iad3a.emailsrvr.com)
    by smtp42.gate.ord1c.rsapps.net (envelope-from <noreply@xxxxxxxxxx.com>)
    (ecelerity 2.2.3.49 r(42060/42061)) with ESMTPS (cipher=AES256-SHA) 
    id 1A/6C-09519-331A1865; Mon, 28 Dec 2015 15:53:07 -0500
Received: from smtp3.relay.iad3a.emailsrvr.com (localhost.localdomain [127.0.0.1])
    by smtp3.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 1410030024A
    for <xxxxxxx@xxxxxxxxxx.com>; Mon, 28 Dec 2015 15:53:07 -0500 (EST)
X-SMTPDoctor-Processed: csmtpprox beta
Received: from smtp3.relay.iad3a.emailsrvr.com (localhost.localdomain [127.0.0.1])
    by smtp3.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 114DE3001F9
    for <xxxxxxx@xxxxxxxxxx.com>; Mon, 28 Dec 2015 15:53:07 -0500 (EST)
X-Auth-ID: noreply@xxxxxxxxxx.com
Received: by smtp3.relay.iad3a.emailsrvr.com (Authenticated sender: noreply-AT-xxxxxxxxxx.com) with ESMTPSA id EAC46300259
    for <xxxxxxx@xxxxxxxxxx.com>; Mon, 28 Dec 2015 15:53:06 -0500 (EST)
X-Sender-Id: xxxxxxx@xxxxxxxxxx.com
Received: from xxxxxx.xxxxxxxxxx.net ([UNAVAILABLE]. [96.00.00.65])
    (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256)
    by 0.0.0.0:465 (trex/5.5.4);
    Mon, 28 Dec 2015 15:53:07 -0500
Message-ID: <ff74253df5d366f8ea5ad56334b8c5ba@puget64>
Date: Mon, 28 Dec 2015 20:53:02 -0500
Subject: Event Confirmation
To: <xxxxxxx@xxxxxxxxxx.com>
Reply-To: "noreply"
From: <noreply@xxxxxxxxxx.com>
MIME-Version: 1.0
Content-Type: multipart/related;
    type="text/html";
    boundary="------_=_NextPart_001_1A10E33F.09B40FBA"

This is a multipart MIME message.

--------_=_NextPart_001_1A10E33F.09B40FBA
Content-Type: text/html;
    charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Dec 30, 2015 by Lukas Matyska (52,850 points)
selected Dec 30, 2015 by mrblint
 
Best answer

The mail.Date property is taken in local time.

Please use this code instead:

mail.Date = DateTime.Now;
...