What’s a message ID and how is it generated?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

And every Every email you've ever sent has a fingerprint. It's called the Message-ID, and it's a unique identifier stamped into the email's headers before it leaves the sending server. You'll never see it in your inbox view, but it's there, quietly doing important work behind the scenes.

A Message-ID looks something like this: <20240315142301.abc123@mail.deepcurrent.io>. That string has two parts separated by an @ sign. The left side is a unique local identifier (often a timestamp plus random characters). The right side is the sending domain. Together they form something that should be globally unique across the entire email ecosystem.

How it gets generated depends on who's doing the sending. If you use an ESP like Postmark or Twilio SendGrid, their servers generate it automatically the moment your message enters their system. If you're running your own mail server (Postfix, for example), your MTA generates it using a combination of the current timestamp, a random component, and your server's hostname. Either way, you usually don't need to set this manually.

Why does it matter? A few reasons.

  • Deduplication. Mail servers use Message-IDs to avoid delivering the same message twice if it gets retried in transit.
  • Threading. Email clients like Gmail and Outlook use Message-IDs (along with In-Reply-To and References headers) to group conversations into threads.
  • Bounce tracking. When a message bounces, the bounce notification typically includes the original Message-ID, which is how your ESP matches the bounce back to the specific send event.
  • Debugging delivery issues. If something goes wrong in transit, the Message-ID is the reference number support teams use to trace a message through server logs.

One thing to watch out for: if your sending setup generates duplicate or malformed Message-IDs, some receiving servers will flag it as suspicious. A missing Message-ID is also a small red flag that spam filters notice. Modern ESPs handle this correctly by default, but if you're on a custom or self-hosted setup, it's worth checking how your bounce tracking lines up with your Message-ID generation.

You can inspect the Message-ID of any email you receive by viewing the full headers. In Gmail, open a message, click the three-dot menu, and choose "Show original". It'll be near the top.

Want to dig deeper into what's inside your email headers? Our free Email Header Analyzer parses them for you in seconds.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Paste your details above and get specific guidance for your setup

I just read about Message-IDs in email headers on the Email Almanac. I want to understand how this applies to my sending setup. Here's my situation (fill in what applies): - Email platform or MTA: ESP name, or self-hosted Postfix/PowerMTA (now Bird)/etc. - Sending domain: your domain - Are you seeing bounce issues or threading problems? yes/no, describe - Are you on a shared or dedicated sending infrastructure? - Any custom header configuration? yes/no Based on my setup, please tell me: 1. Is my Message-ID likely being generated correctly, or are there risks I should check? 2. How can I verify my Message-IDs look well-formed? 3. If I'm on a self-hosted MTA, what should I confirm about my hostname configuration? 4. Are there any common mistakes in my type of setup I should watch for?

Edit the yellow boxes, then send to the AI of your choice.