DNSFly
DNS 5 min read

What is an MX Record?

MX records tell the internet where to deliver email for your domain. Without them, you can't receive email. Here's everything you need to know.

Quick Answer

An MX (Mail Exchange) record is a DNS record that specifies which mail server handles email for your domain. When someone sends email to you@yourdomain.com, their email server looks up your MX record to find where to deliver the message.

How MX Records Work

When someone sends an email to your domain, here's what happens behind the scenes:

1

Sender's server looks up MX record

The sending mail server queries DNS for your domain's MX records.

2

DNS returns mail server hostname

The MX record tells it "deliver mail to mail.yourdomain.com".

3

Server looks up A record

It then queries the A record for mail.yourdomain.com to get the IP address.

4

Email is delivered

The sending server connects to that IP and delivers your email via SMTP.

From my sysadmin experience, I've seen countless email delivery issues caused by misconfigured MX records. Getting them right is essential for reliable email.

Understanding MX Priority

Each MX record has a priority value (also called preference). This determines which mail server should be tried first.

Key Rule

Lower number = Higher priority. A server with priority 10 will be tried before a server with priority 20.

PriorityMail ServerRole
10mail1.example.comPrimary (tried first)
20mail2.example.comSecondary (backup)
30mail3.example.comTertiary (last resort)

If two MX records have the same priority, email servers will randomly distribute mail between them. This is useful for load balancing.

MX Record Examples

Here's what MX records look like for popular email providers:

Google Workspace (Gmail)

1 ASPMX.L.GOOGLE.COM 5 ALT1.ASPMX.L.GOOGLE.COM 5 ALT2.ASPMX.L.GOOGLE.COM 10 ALT3.ASPMX.L.GOOGLE.COM 10 ALT4.ASPMX.L.GOOGLE.COM

Microsoft 365 (Outlook)

0 yourdomain-com.mail.protection.outlook.com

Replace "yourdomain-com" with your actual domain (dots become dashes).

Zoho Mail

10 mx.zoho.com 20 mx2.zoho.com 50 mx3.zoho.com

How to Check MX Records

You can check MX records using command line tools or online checkers:

# Using nslookup (Windows/Mac/Linux)

nslookup -type=mx example.com

# Using dig (Mac/Linux)

dig example.com MX +short

Check MX Records Online

Use DNSFly to check your MX records from 20+ global locations. See if your mail server configuration has propagated worldwide.

Check MX Records

How to Set Up MX Records

Setting up MX records is done in your DNS provider's control panel:

1

Log into your DNS provider (Cloudflare, GoDaddy, Namecheap, etc.)

2

Navigate to DNS settings or DNS zone editor

3

Add a new record and select "MX" as the type

4

Enter the priority (e.g., 10) and mail server hostname

5

Save and wait for propagation (usually 1-4 hours)

Important: Delete any old MX records before adding new ones if you're switching email providers. Having conflicting MX records can cause mail delivery issues.

Common MX Record Issues

MX record points to IP address

Problem: MX records must point to a hostname, not an IP.

Fix: Use mail.example.com instead of 192.168.1.1

MX record points to CNAME

Problem: MX records should not point to CNAME records.

Fix: Point MX directly to an A record hostname.

Missing A record for mail server

Problem: MX points to mail.example.com but no A record exists for it.

Fix: Create an A record for your mail server hostname.

Old MX records not removed

Problem: After switching providers, old records cause some mail to go to the wrong server.

Fix: Delete all old MX records when changing email providers.

? Frequently Asked Questions