LookMyIPLookMyIP
Blog/MX Records Explained: How Email Routing Works
Email & DNS7 min read

MX Records Explained: How Email Routing Works

By LookMyIP Editorial

Understand what MX records are, how they route email, how to check and configure them, and how to troubleshoot common email delivery issues.

What Are MX Records?

MX (Mail Exchange) records are DNS records that specify which mail servers are responsible for receiving email for a domain. When someone sends an email to user@example.com, the sending mail server queries the DNS for example.com's MX records to find out where to deliver the message.

Without properly configured MX records, email sent to your domain will bounce or fail to deliver. MX records are one of the most critical DNS configurations for any domain that receives email.

How MX Records Work

Here's what happens when an email is sent:

  1. The sender's mail server extracts the domain from the recipient's email address (everything after the @).
  2. It queries DNS for the MX records of that domain.
  3. DNS returns one or more MX records, each containing a mail server hostname and a priority value.
  4. The sending server connects to the mail server with the lowest priority number (highest priority) first.
  5. If that server is unavailable, it tries the next one in order of priority.
  6. The email is delivered to the first available mail server.

Priority values determine the order in which mail servers are tried. A lower number means higher priority. For example:

PriorityMail Server
10mail1.example.com
20mail2.example.com
30mail3.example.com

In this setup, mail1 is the primary server. If it's down, mail2 is tried, then mail3. This provides redundancy and ensures emails are delivered even during server outages.

Common MX Record Configurations

Google Workspace (Gmail): Google Workspace uses five MX records with different priorities, all pointing to Google's mail servers (ASPMX.L.GOOGLE.COM, ALT1.ASPMX.L.GOOGLE.COM, etc.). This provides high availability across multiple data centers.

Microsoft 365 (Outlook): Microsoft 365 typically uses a single MX record pointing to your-domain.mail.protection.outlook.com. Microsoft handles redundancy internally.

Custom mail servers: Organizations running their own mail servers typically configure a primary MX record pointing to their main mail server and one or more backup MX records pointing to secondary servers.

Third-party email services (Zoho, ProtonMail, Fastmail): Each provider has their own specific MX records that you configure in your DNS settings. Always follow the exact instructions provided by your email service.

How to Check MX Records

Use LookMyIP's free MX checker tool at lookmyip.com/mx. Enter any domain name to instantly see all configured MX records, their priorities, and the IP addresses they resolve to.

Command line methods:

On macOS/Linux: nslookup -type=mx example.com or dig mx example.com

On Windows: nslookup -type=mx example.com

These commands return the MX records along with their priority values and TTL (Time to Live).

Troubleshooting MX Record Issues

Emails not being received: Check that MX records exist and point to the correct mail servers. A missing or misconfigured MX record is the most common cause of email delivery failure.

Emails going to the wrong server: Verify the priority values. The server with the lowest priority number receives mail first. If you recently switched email providers, old MX records pointing to the previous provider may still be cached.

Delayed email delivery: If the primary mail server is slow to respond, the sending server may queue the message and retry. Check whether your primary MX server is operational and responding on port 25.

SPF and DKIM failures: While not directly related to MX records, email authentication issues often accompany MX changes. Make sure your SPF, DKIM, and DMARC records are updated to match your current mail server configuration.

DNS propagation delays: After changing MX records, allow up to 48 hours for the changes to propagate globally. During this window, some emails may still be sent to the old servers.

Try It Yourself

Use LookMyIP's free tools to look up IP addresses, check DNS records, verify SSL certificates, and more.