Skip to content

MX record: Definition, Syntax, and Examples

TL;DR:

MX (Mail Exchange) is a DNS record type that specifies mail servers for a domain. It contains a priority (lower number = higher priority) and the hostname of a mail server. Without MX records a domain cannot receive email. Multiple MX records are used for failover.

Check your site →

What is a MX record

MX (Mail Exchange) is a DNS record type that specifies mail servers for a domain. It contains a priority (lower number = higher priority) and the hostname of a mail server. Without MX records a domain cannot receive email. Multiple MX records are used for failover.

Check MX record online

Use the Enterno.io tool — enter a domain, get results in 1-2 seconds. Free, no signup.

Check →

Understanding MX Record Priorities

MX records are essential for directing email traffic for a domain, and one of the critical components of an MX record is its priority value. The priority indicates the order in which mail servers should be used when delivering email. A lower number signifies a higher priority, meaning that mail servers with lower priority numbers will be tried first.

For instance, if a domain has two MX records: one with a priority of 10 and another with a priority of 20, the mail server associated with the priority 10 record will be contacted first. If that server is unreachable, the email will then be routed to the server with priority 20.

This prioritization is crucial for ensuring reliable email delivery. In scenarios where a primary mail server fails, having multiple MX records with different priorities allows for seamless failover. If you are configuring your domain's email settings, it's vital to set your MX records correctly to avoid email delivery issues.

Here’s an example of how you might configure MX records:

  • 10 mail1.example.com
  • 20 mail2.example.com

In this configuration, mail1.example.com is the primary mail server, and mail2.example.com serves as a backup.

How to Check MX Records Using Command Line Tools

To verify the MX records for a domain, you can use several command-line tools that are available on most operating systems. The most common tools include nslookup, dig, and host. Each of these tools can provide detailed information about the MX records associated with a domain.

Here’s how to use each tool:

  • Using nslookup: Open your command prompt or terminal and type:
nslookup -type=MX example.com

This command will return the MX records for example.com.

  • Using dig: If you have dig installed, you can run:
dig MX example.com

This will provide a detailed output including the priority and mail server names.

  • Using host: Another option is to use the host command:
host -t MX example.com

This command will also display the MX records for the specified domain.

Checking MX records regularly is a good practice to ensure that your email configuration is correct and functioning as intended, especially after making changes.

Common MX Record Misconfigurations and Troubleshooting

Misconfigurations of MX records can lead to significant email delivery issues. Understanding common pitfalls can help you troubleshoot and resolve problems effectively.

Here are some common misconfigurations:

  • Missing MX Records: If a domain lacks MX records, it won't be able to receive emails. Always ensure that at least one MX record is present.
  • Incorrect Priority Settings: If multiple MX records are set but the priorities are not configured correctly, emails may not reach the intended destination. Ensure that the primary server has the lowest priority number.
  • Typographical Errors: A simple typo in the mail server hostname can cause email delivery failures. Double-check the spelling and format of the hostnames.
  • Expired DNS Records: Sometimes, DNS records may not propagate or may have expired. Use command-line tools to check the current state of your MX records and verify they are as expected.
  • Firewall Issues: Ensure that your mail server is accessible and that no firewall rules are blocking incoming connections on the necessary ports (usually port 25 for SMTP).

If you encounter issues, start by verifying your MX records using the command-line tools described earlier. Review the output for discrepancies and consult your DNS provider's documentation for proper configuration guidelines.

Domain MX RecordsAll domain mail servers
MX PriorityMail delivery order
Record TTLMX record caching time
MX Server A RecordsIP addresses of mail servers

Why teams trust us

MX
all servers with priorities
SPF
compatibility check
<1s
DNS query
Free
no limits

How it works

1

Enter domain

2

Query MX DNS records

3

Get servers and IPs

What are MX Records?

MX (Mail Exchanger) records specify which server receives email for a domain. When there are email problems, MX records and their priorities are the first thing to check.

All MX Records

Complete list of MX servers with priorities and TTL.

Server A Records

Resolve MX hostnames to IP addresses for the full picture.

SPF Compatibility

Check if MX servers are included in the domain's SPF record.

Real DNS Query

Direct query to authoritative DNS without caching.

Who uses this

Email marketers

deliverability diagnostics

Sysadmins

mail server setup

Developers

email API integration

DevOps

post-mail migration check

Common Mistakes

Single MX serverIf the only MX fails, email is rejected. Use 2+ MX servers with different priorities.
MX not in SPFMX servers must be allowed by the SPF record to send on behalf of the domain.
Wrong priorityLower number = higher priority. 10 = primary server, 20 = backup.
CNAME as MX hostnameRFC 2181 forbids CNAME as MX value. Use only A/AAAA records.

Best Practices

Use 2+ MX serversPrimary with priority 10, backup with priority 20.
Sync MX and SPFAfter adding a new MX server, update the SPF record.
Monitor MX TTLTTL 3600 is optimal. Lower to 300 before changing mail providers.
Check after mail migrationAfter migrating to a new provider, ensure MX records updated globally.

Monitor MX records automatically

DNS monitor notifies when your domain MX records change.

Sign up free

Learn more

Frequently Asked Questions

How does MX record differ from similar concepts?

See the full breakdown in the article above. For a quick check, use our online tool.

Does this need manual updates?

Usually no — most modern services configure it automatically. Manual setup is only needed for migrations or exotic configurations.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.