New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
TroubleshootingUpdated 26 Oct 2026

The Date Header and Clock Problems: Why Wrong Times Cause Spam Filtering, Failed Signatures and Confusion

How the Date header and server clocks affect email: format rules, time zone offsets, filters that penalise future or very old dates, DKIM timestamp and expiry, SPF and TLS clock dependencies, NTP fixes and how to diagnose problems.

TK
Written by Tomasz Kowalski
Infrastructure and Reliability Engineer
Reviewed by Mei Lin Tan
  • Published8 May 2025
  • Read time7 min
  • Length1,357 words
Share this guide

Time looks like the least interesting part of an email, yet a surprising number of delivery problems come from it. A message dated three years in the future is a classic spam signal. A server whose clock has drifted by ten minutes produces DKIM signatures that look expired or created in the future to the receiver, and TLS handshakes that fail because certificates appear to be invalid. A script that sets the Date header in the wrong format makes messages appear at the top of the inbox for ever, or at the bottom. This guide explains how the Date header works and what the standards require, which systems depend on accurate clocks, how filters and clients react to bad dates, how to diagnose problems from message headers and how to fix them with time synchronisation and sending-code changes. It relates to reading headers and debugging delivery with headers.

FormatDay, DD Mon YYYY HH:MM:SS +zzzz, as defined in RFC 5322
Who sets itThe sending client or system; mail servers add Received lines with their own timestamps
RisksFuture dates, very old dates, wrong offsets and clock drift cause filtering and verification failures
FixSynchronise all servers with NTP and let your mail library generate the header

What the Date header is

RFC 5322 requires every message to have an origination date header, which records when the sender finished composing the message. The format is fixed:

Date: Tue, 06 May 2025 14:32:08 +0530
Received: from mail.example.com (mail.example.com [203.0.113.10])
        by mx.example.net with ESMTPS id abc123
        for <[email protected]>; Tue, 6 May 2025 09:02:09 +0000

The Date header uses the sender's local time with a numeric offset from UTC; here +0530 means five hours and thirty minutes ahead of UTC. The Received lines are added by each server that handles the message and use that server's clock. Comparing them reveals delays and clock disagreements. In the example, 14:32:08 at +0530 equals 09:02:08 UTC, and the receiving server stamped 09:02:09: consistent. A big gap would be suspicious.

What can go wrong

ProblemCauseEffect
Date in the futureWrong system clock, wrong time zone setting, bug in the sending codeSpam filters penalise; clients sort the message at the top of the list or show odd times
Date far in the pastTemplate or script reuses a fixed date; a message resent from a stored copy keeps the original dateSome filters distrust old dates; recipients are confused
Missing Date headerCustom script writes raw SMTP without headersSome servers add one; others reject or score the message down
Invalid formatLocale-specific month names, missing day of week mismatch, wrong zone abbreviationsParsing errors; clients may show epoch time (1970) or no date
Wrong time zone offsetServer in one zone but labelled with anotherMessages appear hours early or late
Clock drift on the sending serverNTP not running; virtual machine paused; battery-backed clock failureDKIM, TLS and token checks fail intermittently
Daylight saving errorsLocal time with a stale offset after a changeOff-by-one-hour times twice a year
Date header not matching Received timelineMessage injected with an old Date; mailing list resendOften harmless, but a pattern used by spammers, so filters take note

Systems that depend on accurate clocks

  • DKIM. Signatures may include a timestamp (t=) and an expiry (x=). A receiver rejects or distrusts a signature that has expired, or whose timestamp lies in the future beyond a small tolerance. A fast or slow clock on the signing server therefore breaks authentication. See DKIM failures and DKIM key rotation.
  • TLS. Certificates have start and end dates. A server whose clock is behind sees a valid certificate as "not yet valid"; one that is ahead sees it as expired. Symptoms include sudden TLS errors that clear after correcting the time. See SMTP certificates and certificate errors.
  • Time-limited tokens. Signed URLs, webhook timestamps and one-time passwords include timestamps; drift of a few minutes makes them fail. See webhook signature verification and OTP email.
  • SPF, DMARC and DNS do not use message time, but DNS caching and TTLs interact with changes you make.
  • Greylisting and rate limits. These use the receiver's clock, which is usually accurate.
  • Logs and tracing. If servers disagree about the time, you cannot correlate events across systems. See tracing messages.

How filters and clients treat dates

Spam filters compare the Date header with the time they received the message. A message that claims to be from a few days earlier can be a legitimate delay; one from the future or from many years ago is suspicious. Many rule sets assign a small penalty for these cases, which can tip a borderline message into spam. Mail clients sort by the date they received or by the Date header, depending on settings, so a bad value can place a message out of order. Notification systems may show "in 3 hours" for a future date. None of this is dramatic on its own, but it adds to the overall score, and for new or low-reputation senders every point counts. See how content filters work.

Diagnosing a date problem

  1. Open the original message source of a bad example. Find the Date header and each Received line.
  2. Convert all times to UTC and compare. The first Received line (the oldest, at the bottom) should be close to the Date header. Large differences suggest a wrong Date, a delayed queue or a clock problem.
  3. Check the sending server's clock with the date command and compare with a trusted time source. Check whether the NTP service is running and synchronised.
  4. Check the application: does it set Date itself, or leave it to the mail library or server? Does it reuse a stored date when resending?
  5. Check the time zone configuration of the server, container and application. Containers often default to UTC while the application assumes local time.
  6. Check authentication results. Look at the Authentication-Results header for DKIM failures with messages about expiry or timestamps.
  7. Check TLS errors in logs for "certificate not yet valid" or "expired" messages that coincide with clock drift.
# Linux: check clock and synchronisation
timedatectl status
chronyc tracking          # or: ntpq -p
date -u
# Compare with a reference
curl -sI https://www.example.org | grep -i '^date:' 

Fixing it

CauseFix
No time synchronisationInstall and enable chrony or ntpd (or the platform's time service); use several reliable sources; monitor offset
Virtual machines drifting after pause or migrationEnable host time sync or guest agent sync, and NTP inside the guest
Container using the wrong zoneSet the container time zone explicitly and keep application times in UTC
Application builds Date by handRemove custom code; use the library's function that formats RFC 5322 dates, or let the MTA add the header
Resending stored messages with old DateRegenerate the Date header on resend, or send a new message
Locale problems in date formattingUse a library that formats in English month and day names regardless of the locale
Daylight saving errorsCompute offsets from a time zone database, or use UTC (+0000)
DKIM expiry too shortUse an expiry long enough for delays, or omit x= unless you need it
# Correct Date header generation
Python:   from email.utils import formatdate; formatdate(localtime=False, usegmt=False)
Node.js:  new Date().toUTCString()   # then adjust to the RFC 5322 style if the library requires it
PHP:      date(DATE_RFC2822)
Java:     DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now())

Best practices

  • Keep all servers on UTC and let clients display local time.
  • Run time synchronisation everywhere, including build agents, containers and any server that signs mail or issues tokens.
  • Alert when clock offset exceeds a small threshold, such as a second or a few seconds.
  • Let the mail library or the MTA add the Date header unless you have a strong reason to do otherwise.
  • Test messages by sending to a few mailboxes and verifying the displayed time against reality.
  • Include a time check in your incident runbook for sudden authentication or TLS failures. See incident runbook.
  • Document the time zone and the NTP sources in your infrastructure notes.

A correct clock is invisible when it works and baffling when it does not. A few minutes of setup, monitoring and good library use protects authentication, encryption and reputation from a class of problems that are easy to avoid.

Debug your headers Check authentication results for a sample message.

Open the checker

References and further reading

Frequently asked questions

Why does my email show the wrong time?

The Date header may carry a wrong time or offset, often because of a server clock, time zone or code error. Check the message source.

Do wrong dates cause spam filtering?

They can add a penalty, especially dates in the future or far in the past, and can tip borderline messages into spam.

How does clock drift affect DKIM?

Signatures with timestamps or expiry may be treated as expired or future-dated if the signing server's clock is wrong.

Should I set the Date header myself?

Usually not. Let the mail library or MTA generate it in the correct RFC 5322 format.

How do I keep server clocks accurate?

Run NTP or chrony on every server and container host, monitor the offset and alert on drift.

Topics#date header#clock skew#ntp#dkim#headers
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales