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:
- You hit send on an email to captain@deepcurrent.io.
- Your outgoing mail server performs a DNS lookup for the MX records on deepcurrent.io.
- DNS returns one or more MX records, each pointing to a hostname (like
mail.deepcurrent.iooraspmx.l.google.comfor Google Workspace). - Your server then resolves that hostname to an IP address using a separate A record lookup.
- 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.