// how to fix
Missing or wrong Date and Message-ID headers
Every email should carry a correct Date and a unique Message-ID. Without them, spam filters add points and Gmail can refuse the email.
What it means
Each email has hidden lines at the top called headers. Two of them are expected in every message:
- Date: when the email was written, with the time zone. Example:
Date: Tue, 14 Oct 2025 09:30:00 +0200 - Message-ID: a unique identifier, like a serial number. Example:
Message-ID: <7f3a91c2@mail.yourdomain.com>
Normal email programs add them automatically. They are usually missing or wrong when emails are sent by a script, a website plugin, a printer or an old application that builds the email by hand.
Why it matters
- SpamAssassin adds points for a missing date (
MISSING_DATE), a missing Message-ID (MISSING_MID), or a date far in the past or future (DATE_IN_PAST_...,DATE_IN_FUTURE_...). - Gmail can refuse emails that have no valid Message-ID, and expects messages to follow the email format standard (RFC 5322).
- Mail programs use these headers to sort messages and build conversations.
How to check
Send an email from the tool or script that has the problem to your test address on the home page (/). In the report, the SpamAssassin section lists the rules that matched. You can also open the email's original source in any mailbox ("Show original" in Gmail) and look at the first lines.
How to fix it
1. Let a mail library build the email
The best fix is to stop writing headers by hand. Libraries such as PHPMailer or Symfony Mailer (PHP), Nodemailer (Node.js) or the email module (Python) add both headers correctly. In Python, for example:
from email.utils import formatdate, make_msgid msg["Date"] = formatdate(localtime=True) msg["Message-ID"] = make_msgid(domain="yourdomain.com")
2. If you write headers yourself
- Date must use the exact format
Day, DD Mon YYYY HH:MM:SS +ZZZZin English, with the real time zone offset. - Message-ID must be unique for every email, surrounded by
<and>, and contain an@followed by your domain or server name. Never reuse the same ID. - Use only one Date and one Message-ID per email.
3. Fix the clock
A wrong date often comes from a server whose clock is off or set to the wrong time zone. On Linux, enable time synchronisation (for example with timedatectl set-ntp true) and check the time zone.
4. Let your mail server add what is missing
Some servers can add a missing Date or Message-ID for messages they send. Postfix, for example, does this for emails submitted on the server itself, but not always for emails coming from other machines. This is a safety net, not a replacement for fixing the application.
Check that it is fixed
Send a new email from the same tool to the home page address. The SpamAssassin section should no longer list MISSING_DATE, MISSING_MID or date rules, and the date shown should match the real sending time.
Check that it is fixed
DNS changes can take from a few minutes to a few hours. Then send a new test email or scan your domain again.
Related guides
- High SpamAssassin spam scoreSpamAssassin scores the content of your email. Above 5, it is treated as spam. Learn what raises the score and how to bring it down.
- Gmail and Yahoo bulk sender requirementsSince 2024, Gmail and Yahoo require large senders to authenticate their emails, offer one-click unsubscribe and keep spam complaints very low. Here is the checklist.
- Your emails land in Gmail's spam folderWhen Gmail sends your emails to spam, the cause is almost always authentication, reputation or content. Here is how to find which one and fix it.
- Gmail bounce "550 5.7.26": unauthenticated emailGmail refused your email because it could not confirm it comes from your domain. SPF, DKIM or DMARC is missing or failing. Here is how to fix it.
- Add a List-Unsubscribe header (one-click unsubscribe)The List-Unsubscribe header lets Gmail, Yahoo and Outlook show an Unsubscribe button next to your sender name. Bulk senders must offer it in one click.