MX (Mail Exchange) records tell the internet which server handles email for your domain. When MX records are missing, incorrect, or misconfigured, incoming emails will bounce, get delayed, or simply disappear. This is one of the most common causes of email delivery failure.
This guide covers how to diagnose and fix MX record issues step by step.
Quick Fix Checklist
- ✅ Verify MX records exist:
dig MX yourdomain.com +short - ✅ Check MX records point to a valid mail server hostname
- ✅ Ensure the MX target has a valid A record
- ✅ Verify MX priority values are correct
- ✅ MX should NOT point to a CNAME or IP address
- ✅ Check DNS propagation if recently changed
- ✅ Test that port 25 is open on the mail server
How MX Records Work
When someone sends an email to [email protected], their mail server:
- Queries DNS for MX records of yourdomain.com
- Gets a list of mail servers with priority values
- Connects to the lowest-priority (highest preference) server first
- If that fails, tries the next server in priority order
# Example MX record output
dig MX example.com +short
10 mail.example.com.
20 backup-mail.example.com.
# Priority 10 = primary (tried first)
# Priority 20 = backup (tried if primary fails)
Common MX Record Problems
1. No MX Records Set
# Check for MX records
dig MX yourdomain.com +short
# Empty result = NO MX records!
# Senders will get: "No MX or A record found for domain"
# Some mail servers fall back to A record, but this is unreliable
Fix: Add an MX record in your DNS management panel pointing to your mail server.
2. MX Points to Wrong Server
# Common mistake: MX points to web server instead of mail server
dig MX yourdomain.com +short
10 yourdomain.com. ← WRONG if this is just a web server
# Correct: Should point to dedicated mail server
10 mail.yourdomain.com.
3. MX Points to IP Address
# WRONG — MX must point to a hostname, never an IP
10 203.0.113.10 ← INVALID!
# CORRECT
10 mail.example.com. ← Hostname that resolves to an IP via A record
4. MX Points to CNAME
# WRONG — MX target should NOT be a CNAME
dig MX example.com +short
10 mail.example.com.
dig mail.example.com
# If this returns a CNAME → PROBLEM!
# mail.example.com. CNAME somehost.provider.com.
# CORRECT — MX target must have an A record
dig A mail.example.com +short
203.0.113.10
5. DNS Propagation Delay
After changing MX records, DNS propagation takes time:
# Check propagation by querying different DNS servers
dig MX yourdomain.com @8.8.8.8 +short # Google DNS
dig MX yourdomain.com @1.1.1.1 +short # Cloudflare DNS
dig MX yourdomain.com @208.67.222.222 +short # OpenDNS
# Check TTL (Time To Live) — this is how long old records are cached
dig MX yourdomain.com | grep -i "MX" | awk '{print $2}'
# Lower TTL = faster propagation (set to 300 before changes)
Step-by-Step Fix
Step 1: Identify Your Mail Server
First, determine which server should handle your email:
- Self-hosted (cPanel/Plesk): Your server's hostname, e.g.,
mail.yourdomain.com - Google Workspace: Google's MX servers (see below)
- Microsoft 365: Microsoft's MX servers
- Zoho Mail: Zoho's MX servers
Step 2: Set Correct MX Records
For Self-Hosted Mail (cPanel / VPS)
# Add these DNS records:
# Type | Name | Value | Priority
# MX | yourdomain.com| mail.yourdomain.com | 10
# A | mail | YOUR_SERVER_IP | -
# Verify:
dig MX yourdomain.com +short
# Should show: 10 mail.yourdomain.com.
For Google Workspace
# Google Workspace MX records (all required):
# Priority | Server
# 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
For Microsoft 365
# Microsoft 365 MX record:
# Priority | Server
# 0 | yourdomain-com.mail.protection.outlook.com
# (Replace dots in domain with dashes)
Step 3: Verify A Record for MX Target
# The hostname in your MX record must resolve to an IP
dig A mail.yourdomain.com +short
# Should return your server's IP: 203.0.113.10
# If empty, add an A record:
# Type | Name | Value
# A | mail | 203.0.113.10
Step 4: Test Mail Server Connectivity
# Test if the mail server is accepting connections on port 25
telnet mail.yourdomain.com 25
# Should respond with: 220 mail.yourdomain.com ESMTP ...
# If connection refused:
# - Check firewall rules
# - Ensure mail service is running
# - Check if port 25 is blocked by hosting provider
# Alternative test with nc (netcat):
nc -zv mail.yourdomain.com 25
Step 5: Test Email Delivery
# Send a test email from external service
# Use: https://www.mail-tester.com
# Or send from Gmail to your domain
# Check mail server logs for delivery:
# Exim:
tail -f /var/log/exim_mainlog | grep "yourdomain.com"
# Postfix:
tail -f /var/log/mail.log | grep "yourdomain.com"
Cloudflare DNS + MX Records
If you use Cloudflare, MX records need special attention:
# IMPORTANT: The MX target hostname must NOT be proxied (orange cloud)
# mail.yourdomain.com → DNS Only (grey cloud) ✅
# mail.yourdomain.com → Proxied (orange cloud) ❌
# In Cloudflare dashboard:
# 1. Add MX record: yourdomain.com → mail.yourdomain.com (priority 10)
# 2. Add A record: mail → YOUR_IP (DNS Only / grey cloud)
# 3. Make sure the A record is NOT proxied
Common Mistakes
- MX pointing to an IP: MX records MUST point to a hostname, not an IP address
- MX target is a CNAME: The MX target must have an A record, not a CNAME (RFC 2181)
- Missing trailing dot: In zone files, hostnames should end with a dot:
mail.example.com. - Conflicting MX records: Having both old and new MX records causes split delivery
- Proxied mail hostname in Cloudflare: Mail hostnames must be DNS Only (grey cloud)
- Not testing after changes: Always verify with
dig MXafter making changes
🚀 Need Reliable Email Hosting?
QIW Host VPS servers come with full DNS control, proper PTR records, and expert support to get your MX records working perfectly.
Get Email-Ready Hosting →Frequently Asked Questions
How long do MX record changes take to propagate?
MX record propagation depends on the TTL (Time To Live) set on the record. With a TTL of 3600 (1 hour), most DNS servers will pick up changes within 1-4 hours. For critical changes, lower the TTL to 300 (5 minutes) at least 24 hours before making the change. Check propagation at whatsmydns.net.
Can I have MX records and still use email forwarding?
MX records and email forwarding can conflict. If you set MX records to point to Google Workspace but also have email forwarding set up at your registrar, emails may go to the wrong place. Remove forwarding when you set up MX records for an external mail service.
What priority number should I use for MX records?
Lower numbers = higher priority. The mail server with the lowest priority number is tried first. Common convention is 10 for primary, 20 for secondary backup. If you only have one mail server, just use 10. See also our guide on setting up PTR records for complete mail server configuration.
My MX records are correct but I'm still not receiving email — why?
If MX records are correct, check: (1) Is the mail service actually running? (2) Is port 25 open on your firewall? (3) Is your IP blacklisted? (4) Is disk space full? (5) Are there spam filter issues?