Technical8 min read

MX Records Explained: Email Routing and Configuration Guide

Complete guide to MX records for email routing. Learn how to configure, troubleshoot, and optimize MX records for reliable email delivery.

Published March 29, 2026

MX (Mail Exchange) records are DNS entries that specify which mail servers handle email for your domain. Proper MX record configuration is essential for reliable email delivery and professional email setup.

What Are MX Records?

MX records tell other mail servers where to deliver email for your domain. When someone sends an email to your domain, their mail server looks up your MX records to find your mail server.

  • DNS resource records that specify mail server hostnames
  • Include priority values for failover and load balancing
  • Required for receiving email at your domain
  • Can point to multiple servers for redundancy
  • Work with A/AAAA records to resolve to IP addresses

MX Record Structure

MX records consist of several components:

# MX Record Format
example.com.    IN    MX    10    mail1.example.com.
example.com.    IN    MX    20    mail2.example.com.
example.com.    IN    MX    30    backup.example.com.

Breakdown:
- example.com.: Domain name (with trailing dot)
- IN: Internet class
- MX: Record type
- 10, 20, 30: Priority values (lower = higher priority)
- mail1.example.com.: Mail server hostname

Priority Values

MX priority determines which servers handle email first:

  • Lower numbers = higher priority (0-65535 range)
  • Servers with same priority share load randomly
  • Higher priority servers used as backups
  • Common patterns: 10, 20, 30 or 0, 10, 20

Common MX Record Configurations

Single Mail Server

# Simple single server setup
example.com.    IN    MX    10    mail.example.com.

# Corresponding A record
mail.example.com.    IN    A    203.0.113.1

Multiple Servers with Failover

# Primary and backup servers
example.com.    IN    MX    10    mail1.example.com.
example.com.    IN    MX    20    mail2.example.com.
example.com.    IN    MX    30    backup.example.com.

# A records for each server
mail1.example.com.    IN    A    203.0.113.1
mail2.example.com.    IN    A    203.0.113.2
backup.example.com.   IN    A    203.0.113.3

Load Balancing

# Equal priority for load distribution
example.com.    IN    MX    10    mail1.example.com.
example.com.    IN    MX    10    mail2.example.com.
example.com.    IN    MX    10    mail3.example.com.

# Senders will randomly choose among equal priority servers

Popular Email Service Providers

Google Workspace

# Google Workspace MX records
example.com.    IN    MX    1     aspmx.l.google.com.
example.com.    IN    MX    5     alt1.aspmx.l.google.com.
example.com.    IN    MX    5     alt2.aspmx.l.google.com.
example.com.    IN    MX    10    alt3.aspmx.l.google.com.
example.com.    IN    MX    10    alt4.aspmx.l.google.com.

Microsoft 365

# Microsoft 365 MX record
example.com.    IN    MX    0     example-com.mail.protection.outlook.com.

Proton Mail

# Proton Mail MX records
example.com.    IN    MX    10    mail.protonmail.ch.
example.com.    IN    MX    20    mailsec.protonmail.ch.

MX Record Best Practices

  • Use multiple MX records for redundancy
  • Set appropriate TTL values (300-3600 seconds)
  • Ensure MX records point to A/AAAA records, not CNAME
  • Test from multiple locations after changes
  • Document your configuration for troubleshooting
  • Monitor mail server health and availability

Common MX Record Mistakes

  • Pointing MX to CNAME records instead of A records
  • Missing trailing dots in DNS entries
  • Incorrect priority ordering
  • Not configuring backup servers
  • Using same priority for all servers unintentionally
  • Forgetting to update A records when changing servers

Testing MX Records

Verify your MX records are working correctly:

# Check MX records
dig MX example.com
nslookup -type=MX example.com

# Test from specific DNS server
dig @8.8.8.8 MX example.com

# Check with online tools
# - MX Toolbox
# - DNS Checker
# - Our MX Record Checker

Troubleshooting MX Issues

Email Not Being Received

  • Verify MX records exist and are correct
  • Check DNS propagation across regions
  • Ensure mail servers are running and accessible
  • Test SMTP connectivity to each MX server
  • Review firewall rules and port accessibility

Intermittent Delivery Issues

  • Check if backup servers are properly configured
  • Monitor server health and response times
  • Verify all MX servers accept mail for domain
  • Test failover behavior during server outages
  • Review load distribution among equal priority servers

Advanced MX Configurations

Subdomain Mail Routing

# Route different subdomains to different servers
support.example.com.    IN    MX    10    support-mail.example.com.
sales.example.com.      IN    MX    10    sales-mail.example.com.
marketing.example.com.  IN    MX    10    marketing-mail.example.com.

Null MX Records

# Explicitly indicate domain does not accept mail
noreply.example.com.    IN    MX    0     .

Null MX records (pointing to ".") explicitly indicate a domain does not accept email, which is cleaner than having no MX record.

MX Records and Email Security

  • MX records themselves don't provide security
  • Combine with SPF records to authorize sending servers
  • Use DMARC to specify handling of authentication failures
  • Consider MTA-STS for enforced TLS connections
  • Monitor for unauthorized MX record changes

Use our MX Record Checker tool to verify your configuration and test email routing from multiple global locations.

#mx records#email routing#dns#mail servers#email configuration

Related Articles

Related Tools

Check Your IP Address

Use our free tools to check your IP address and test for leaks.