How do MX records determine where mail is delivered?

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

When you send an email to captain@deepcurrent.io, your mail server doesn't just know where to deliver it. It has to ask. That asking process is what MX records are for.

MX stands for Mail Exchanger. An MX record is a DNS entry that tells the world which mail server is responsible for accepting incoming email on behalf of a domain. When your mail server wants to deliver a message to deepcurrent.io, it queries DNS and says: "Who handles mail for this domain?" The MX record answers that question.

Here's what the actual lookup process looks like, step by step:

  1. You hit send on an email to captain@deepcurrent.io.
  2. Your outgoing mail server performs a DNS lookup for the MX records on deepcurrent.io.
  3. DNS returns one or more MX records, each pointing to a hostname (like mail.deepcurrent.io or aspmx.l.google.com for Google Workspace).
  4. Your server then resolves that hostname to an IP address using a separate A record lookup.
  5. It opens an SMTP connection to that IP and delivers the message.

That last step is worth noticing. MX records point to hostnames, not IP addresses directly. The mail server does two lookups: first the MX record to get the hostname, then an A record lookup to get the actual IP. (This is by design. It means you can update IP addresses without touching your MX records.)

A real-world example: if your domain uses Google Workspace, your MX records look something like this.

deepcurrent.io MX 1 aspmx.l.google.com
deepercurrent.io MX 5 alt1.aspmx.l.google.com
deepercurrent.io MX 10 alt2.aspmx.l.google.com

The numbers before the hostnames are priority values. Lower numbers mean higher priority. If the first server is unreachable, the sending server tries the next one down the list. That's how fallback delivery works.

Now one thing that trips people up: MX records only control inbound mail routing. They tell other servers where to deliver email addressed to your domain. They have nothing to do with which server you use to send mail outbound. That's handled separately by your ESP or SMTP configuration.

If your MX records are missing or broken, incoming mail has nowhere to go and senders get a delivery failure. You can check what your MX records currently look like using our free Email Header Analyzer, or run a quick MX lookup at your DNS provider. If something looks off, the SOS hotline is free and we're happy to take a look.

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 domain setup.

I read the Email Almanac answer on how MX records determine where mail is delivered. I want help checking or troubleshooting my own MX setup. Please help me with: 1. How to read or verify my current MX records 2. What correct MX records should look like for my email provider 3. Common mistakes that break inbound mail delivery 4. How to fix MX issues if mail is not arriving My details (fill in what applies): - Domain: e.g. example.com - Email provider for inbound mail: e.g. Google Workspace, Microsoft 365, Zoho Mail, self-hosted - DNS / registrar: e.g. Cloudflare, GoDaddy, Namecheap, Route53 - Problem I'm seeing: [e.g. inbound mail not arriving, bounce messages, MX lookup failing] - Number of MX records currently set: 1 / multiple / unsure - Recently changed anything in DNS: yes / no, if yes, what?

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