Quick Answer
MX (Mail Exchange) records are DNS records that tell email servers where to deliver email for your domain. To configure MX records, log into your DNS provider, add MX records pointing to your mail server hostnames with appropriate priority values, and wait for DNS propagation. Each email provider (Google Workspace, Microsoft 365, custom mail server) requires specific MX records. Proper MX configuration is essential for receiving email—without correct MX records, email sent to your domain will bounce or be lost.
Table of Contents
- What Are MX Records?
- How MX Records Work
- MX Record Components Explained
- MX Record Priority System
- Before You Start: Prerequisites
- How to Configure MX Records
- Google Workspace MX Records
- Microsoft 365 MX Records
- Custom Mail Server MX Records
- Popular Email Providers MX Settings
- Testing MX Records
- Common MX Record Mistakes
- Troubleshooting MX Record Issues
- Best Practices for MX Records
- Frequently Asked Questions
- Key Takeaways
- Next Steps
- Research Sources
What Are MX Records?
MX (Mail Exchange) records are DNS records that specify which mail servers are responsible for receiving email on behalf of your domain.
The Role of MX Records
When someone sends email to [email protected], their email server needs to know where to deliver the message. MX records provide this information by listing the mail servers that accept email for example.com.
Without MX records, email sent to your domain will fail with a bounce message like "550 No such domain" or "mail server not found."
MX Records vs. A Records
A records point a domain to an IP address for web hosting:
example.com. A 192.0.2.1
MX records point to mail server hostnames for email delivery:
example.com. MX 10 mail.example.com.
MX records must point to hostnames (not IP addresses), and those hostnames must have A or AAAA records resolving to IP addresses.
Why MX Records Are Critical
Email Delivery: Without MX records, you cannot receive email at your domain. Senders will receive bounce messages and your emails are lost.
Professional Communication: Custom domain email ([email protected]) looks professional compared to free email services ([email protected]).
Business Continuity: Properly configured MX records with backups ensure email continues flowing even if primary mail servers experience issues.
Service Integration: Many business services require verified email at your domain for account creation and notifications.
MX Records Are for Receiving Email
Important distinction: MX records only affect incoming email (receiving). They don't affect your ability to send email. Sending email requires proper SMTP configuration and email authentication (SPF, DKIM, DMARC).
How MX Records Work
Understanding the email delivery process helps you configure MX records correctly.
Email Delivery Flow
Step 1: Sender Composes Email
From: [email protected]
To: [email protected]
Subject: Meeting Tomorrow
Step 2: Sender's Mail Server Queries DNS
The sender's mail server needs to find where to deliver email for example.com:
DNS Query: What are the MX records for example.com?
Step 3: DNS Returns MX Records
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
Step 4: Resolve Mail Server Hostname to IP
The sender's server queries DNS for the A record of the mail server:
DNS Query: What is the IP address of mail1.example.com?
Response: mail1.example.com. A 192.0.2.1
Step 5: Connect to Mail Server
Sender's mail server connects to 192.0.2.1 on port 25 (SMTP):
SMTP Connection: Connecting to 192.0.2.1:25
Step 6: Deliver Email
SMTP conversation delivers the message:
HELO sender.com
MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
[Email content here]
.
Step 7: Recipient's Mail Server Accepts
If recipient exists and no errors:
250 OK: Message accepted for delivery
Email is delivered to [email protected]'s mailbox.
Multiple MX Records and Failover
When multiple MX records exist, the sending server tries them in priority order:
Configuration:
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
example.com. MX 30 mail3.example.com.
Delivery Attempt:
- Try mail1.example.com (priority 10) first
- If mail1 is down or unreachable, try mail2.example.com (priority 20)
- If mail2 is down, try mail3.example.com (priority 30)
- If all fail, sender's server queues the message and retries later
This provides redundancy and ensures email delivery even during server maintenance or outages.
Why Hostnames, Not IP Addresses?
MX records must point to hostnames, not directly to IP addresses:
Incorrect:
❌ example.com. MX 10 192.0.2.1
Correct:
✅ example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1
Reasons for this requirement:
- Flexibility: Change IP addresses without updating MX records
- Certificate validation: SSL/TLS certificates match hostnames, not IPs
- Reverse DNS: PTR records map IPs to hostnames for email reputation
- Protocol compliance: RFC 5321 requires MX records to point to hostnames
- IPv6 support: Hostnames can have both A (IPv4) and AAAA (IPv6) records
MX Record Components Explained
MX records have a specific structure with several components.
MX Record Format
example.com. 3600 IN MX 10 mail.example.com.
Breaking down each component:
1. Domain Name (example.com.)
- The domain receiving email
- Trailing dot (.) indicates fully qualified domain name (FQDN)
- Can be root domain (@) or subdomain
2. TTL (3600)
- Time To Live in seconds
- How long DNS servers cache the record
- 3600 = 1 hour, 86400 = 24 hours
- Lower TTL (300-600) useful before changes
- Higher TTL (3600-86400) for stable configurations
3. Class (IN)
- Internet class (always IN)
- Standard for all DNS records
- Other classes exist but rarely used
4. Type (MX)
- Identifies record as Mail Exchange
- Distinguishes from A, CNAME, TXT records
5. Priority (10)
- Numeric value defining preference order
- Lower numbers = higher priority
- Range: 0-65535
- Mail servers tried in ascending priority order
6. Mail Server Hostname (mail.example.com.)
- Hostname of the mail server
- Must have corresponding A or AAAA record
- Trailing dot indicates FQDN
- Cannot be a CNAME (must point to A/AAAA record)
Multiple MX Records Example
Typical configuration with primary and backup servers:
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
example.com. MX 30 backup-mail.example.com.
mail1.example.com. A 192.0.2.1
mail2.example.com. A 192.0.2.2
backup-mail.example.com. A 192.0.2.3
Email delivery behavior:
- mail1.example.com tried first (priority 10)
- If mail1 unavailable, mail2.example.com tried (priority 20)
- If mail2 unavailable, backup-mail.example.com tried (priority 30)
Subdomain MX Records
Subdomains can have their own MX records:
example.com. MX 10 mail.example.com.
mail.example.com. MX 10 mail.example.com.
subdomain.example.com. MX 10 mail.subdomain.example.com.
Each subdomain's email routes independently. Email to [email protected] goes to mail.subdomain.example.com, not the root domain's mail server.
MX Record Priority System
Priority values determine the order mail servers are contacted.
How Priority Works
Lower numbers = higher priority. Mail servers are tried in ascending numerical order.
Example Configuration:
example.com. MX 5 primary.example.com.
example.com. MX 10 secondary.example.com.
example.com. MX 20 backup.example.com.
Delivery Sequence:
- Try priority 5 (primary) first
- If fails, try priority 10 (secondary)
- If fails, try priority 20 (backup)
Equal Priority Load Balancing
Multiple servers with the same priority create load balancing:
example.com. MX 10 mail1.example.com.
example.com. MX 10 mail2.example.com.
Behavior:
- Sending servers randomly choose between equal-priority servers
- Distributes load across both mail servers
- Both servers must accept all email for the domain
- If one fails, all traffic goes to the other
Use Cases:
- High-volume email requiring load distribution
- Redundant servers in different data centers
- Geographic distribution for performance
Priority Gaps Don't Matter
The absolute values don't matter, only the relative order:
These are equivalent:
# Configuration 1
MX 10 primary.example.com.
MX 20 backup.example.com.
# Configuration 2
MX 5 primary.example.com.
MX 100 backup.example.com.
# Configuration 3
MX 1 primary.example.com.
MX 2 backup.example.com.
All three result in the same delivery behavior: try primary first, then backup.
Best practice: Use gaps (10, 20, 30 or 10, 50, 100) to allow inserting new servers between existing priorities later.
Common Priority Patterns
Single Mail Server:
example.com. MX 10 mail.example.com.
Simple, no redundancy. Downtime means lost email.
Primary and Backup:
example.com. MX 10 primary.example.com.
example.com. MX 20 backup.example.com.
Most common pattern. Backup takes over if primary fails.
Load Balanced with Backup:
example.com. MX 10 mail1.example.com.
example.com. MX 10 mail2.example.com.
example.com. MX 20 backup.example.com.
Traffic distributed between mail1 and mail2. Backup for failures.
Geographic Distribution:
example.com. MX 10 us-mail.example.com.
example.com. MX 10 eu-mail.example.com.
example.com. MX 10 asia-mail.example.com.
example.com. MX 50 global-backup.example.com.
Worldwide distribution with shared backup.
Priority Zero
Priority 0 is valid but has special meaning in some contexts:
example.com. MX 0 mail.example.com.
Microsoft 365 uses priority 0:
example.com. MX 0 example-com.mail.protection.outlook.com.
Priority 0 is the highest possible priority (lowest number). Use it for single server configurations or when explicitly required by provider.
Before You Start: Prerequisites
Ensure you have everything needed before configuring MX records.
1. Access to DNS Management
You need administrative access to manage DNS records for your domain.
Where DNS is managed depends on your setup:
Scenario 1: Domain Registered, DNS at Registrar
- DNS managed at domain registrar (GoDaddy, Namecheap, etc.)
- Log into registrar account
- Navigate to DNS management section
Scenario 2: Domain Uses External DNS (Cloudflare, etc.)
- DNS managed at DNS provider (Cloudflare, Route 53, etc.)
- Log into DNS provider account
- Select your domain
Scenario 3: Custom Nameservers
- DNS managed at your hosting provider or custom location
- Access depends on your specific setup
How to Find Where Your DNS is Managed:
# Check your domain's nameservers
dig example.com NS
nslookup -type=NS example.com
The nameservers (NS records) indicate where DNS is managed.
2. Mail Server Information
Gather MX record details from your email provider:
Information Needed:
- Mail server hostnames (e.g., aspmx.l.google.com)
- Priority values for each server
- Number of MX records required
- Any additional DNS records (A, TXT, CNAME)
Where to Find This:
Email Provider Documentation:
- Google Workspace: "Set up MX records"
- Microsoft 365: "Add DNS records"
- Email hosting provider: "Email setup" or "DNS configuration"
Email Provider Support:
- Contact support if documentation unclear
- They can provide exact records for your account
3. Backup Current DNS Records
Before making changes, document current configuration:
# Export all DNS records
dig example.com ANY > dns-backup.txt
# Or query each record type
dig example.com MX > mx-backup.txt
dig example.com A > a-backup.txt
dig example.com TXT > txt-backup.txt
Take screenshots of DNS management panel as visual backup.
4. Plan for Downtime
DNS propagation takes 1-48 hours. During this time:
- Some users may receive email at old server
- Some users may receive email at new server
- Email may be delayed during transition
Migration Best Practices:
Gradual Transition:
- Keep old mail servers running during transition
- Add new MX records alongside old ones (lower priority)
- After propagation, remove old records
- This ensures no email is lost during migration
Weekend/Off-Hours Changes:
- Make changes during low email volume periods
- Reduces impact if issues occur
Communication:
- Warn team about potential delays
- Have backup communication channel (chat, phone)
5. Understanding TTL
TTL (Time To Live) determines how long DNS servers cache records:
Before Changes:
- Lower TTL to 300-600 seconds (5-10 minutes)
- Wait for old TTL to expire (if current TTL is 3600, wait 1 hour)
- This speeds up propagation when you make changes
After Changes:
- Once verified working, increase TTL to 3600+ seconds
- Reduces DNS query load
- Improves performance
How to Configure MX Records
Step-by-step process for adding MX records regardless of DNS provider.
Step 1: Log Into DNS Management
Access your DNS management panel:
Cloudflare:
- Log into Cloudflare dashboard
- Select your domain from list
- Click "DNS" in the top navigation
GoDaddy:
- Log into GoDaddy account
- Navigate to "My Products"
- Find your domain, click "DNS"
Namecheap:
- Log into Namecheap account
- Domain List → Find domain → "Manage"
- Click "Advanced DNS" tab
Google Domains:
- Log into Google Domains
- Click on your domain
- Click "DNS" in left sidebar
AWS Route 53:
- Log into AWS Console
- Navigate to Route 53
- Click "Hosted zones" → Select your domain
Step 2: Remove Old MX Records (If Any)
If MX records already exist:
- Locate existing MX records in DNS panel
- Note down all values (for backup)
- Delete all existing MX records
Why remove first?
- Prevents conflicts between old and new mail servers
- Ensures clean configuration
- Old records can cause email delivery to wrong servers
Exception: During migration, you may temporarily keep old MX records with higher priority numbers as backup.
Step 3: Add New MX Records
For each MX record provided by your email service:
Cloudflare:
- Click "Add record"
- Type: MX
- Name: @ (or leave blank for root domain)
- Mail server: mail.example.com
- Priority: 10
- TTL: Auto or 3600
- Click "Save"
GoDaddy:
- Click "Add" button
- Type: MX
- Host: @ (root domain) or subdomain name
- Points to: mail.example.com
- Priority: 10
- TTL: 1 hour
- Click "Save"
Namecheap:
- Click "Add New Record"
- Type: MX Record
- Host: @ (or subdomain)
- Value: mail.example.com
- Priority: 10
- TTL: Automatic
- Click green checkmark
Generic DNS Panel:
- Type/Record Type: MX
- Name/Host: @ (root domain) or subdomain
- Value/Points to: mail.example.com (mail server hostname)
- Priority/Preference: 10 (lower = higher priority)
- TTL: 3600 (1 hour) or provider default
Step 4: Add All Required MX Records
Most email providers require multiple MX records for redundancy:
Example (Google Workspace):
Priority Mail 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
Add each record separately following Step 3 process.
Step 5: Verify Record Entry
Before saving, double-check:
- ✅ Type is "MX" (not A, CNAME, or TXT)
- ✅ Priority matches documentation
- ✅ Mail server hostname is spelled correctly
- ✅ No typos in server name
- ✅ Trailing dot (if required by provider) is included or omitted correctly
- ✅ Name/Host is @ for root domain email
Common Entry Errors:
Wrong:
Type: A
Value: mail.example.com
Correct:
Type: MX
Priority: 10
Value: mail.example.com
Step 6: Save Changes
Click "Save," "Add Record," or equivalent button.
Most DNS providers show confirmation:
✓ MX record for example.com added successfully
Step 7: Wait for DNS Propagation
DNS changes don't take effect immediately:
Typical Propagation Times:
- Local DNS cache: 5-15 minutes
- Most DNS servers: 1-4 hours
- Full global propagation: 24-48 hours
During propagation:
- Some email may go to old servers (if still running)
- Some email may go to new servers
- This is normal and expected
Monitoring propagation:
- Use https://www.whatsmydns.net
- Enter your domain
- Select "MX" record type
- Check propagation across multiple locations
Google Workspace MX Records
Configuring MX records for Google Workspace (Gmail for business).
Google Workspace MX Configuration
Required MX Records:
Priority Mail 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
Step-by-Step Google Workspace Setup
Step 1: Access Google Admin Console
- Log into https://admin.google.com
- Go to "Apps" → "Google Workspace" → "Gmail"
- Click "Activate Gmail"
Step 2: Get Your MX Records
- Scroll to "Set up MX records"
- Google provides exact records for your domain
- Note all 5 MX records
Step 3: Remove Old MX Records
- Log into your DNS provider
- Delete all existing MX records
- This prevents email going to old servers
Step 4: Add Google MX Records
Add each record with these exact values:
Record 1:
- Type: MX
- Name: @ (or blank)
- Mail server: aspmx.l.google.com
- Priority: 1
- TTL: 3600
Record 2:
- Type: MX
- Name: @
- Mail server: alt1.aspmx.l.google.com
- Priority: 5
- TTL: 3600
Record 3:
- Type: MX
- Name: @
- Mail server: alt2.aspmx.l.google.com
- Priority: 5
- TTL: 3600
Record 4:
- Type: MX
- Name: @
- Mail server: alt3.aspmx.l.google.com
- Priority: 10
- TTL: 3600
Record 5:
- Type: MX
- Name: @
- Mail server: alt4.aspmx.l.google.com
- Priority: 10
- TTL: 3600
Step 5: Verify in Google Admin
- Return to Google Admin Console
- Click "Activate Gmail"
- Google verifies MX records automatically
- May take up to 72 hours for verification
Additional Google Workspace DNS Records
SPF Record (Required):
Type: TXT
Name: @
Value: v=spf1 include:_spf.google.com ~all
DKIM Setup (Recommended):
- Google Admin → Apps → Gmail → Authenticate email
- Generate new record
- Add provided TXT record to DNS:
Type: TXT Name: google._domainkey Value: v=DKIM1; k=rsa; p=MIGfMA0GCS... (from Google)
DMARC Record (Recommended):
Type: TXT
Name: _dmarc
Value: v=DMARC1; p=quarantine; rua=mailto:[email protected]
Testing Google Workspace Email
Send Test Email:
- Send email to your domain: [email protected]
- Check if received in Gmail
- May take 15-30 minutes during propagation
Verify MX Records:
dig example.com MX
nslookup -type=MX example.com
Expected output:
example.com. MX 1 aspmx.l.google.com.
example.com. MX 5 alt1.aspmx.l.google.com.
example.com. MX 5 alt2.aspmx.l.google.com.
example.com. MX 10 alt3.aspmx.l.google.com.
example.com. MX 10 alt4.aspmx.l.google.com.
Common Google Workspace Issues
Issue: Gmail not activated in Admin Console
- Solution: Navigate to Apps → Gmail → Activate Gmail before testing
Issue: MX records not verified after 72 hours
- Check records exactly match Google's specifications
- Ensure no typos in server hostnames
- Remove any old MX records still present
- Contact Google Workspace support
Issue: Some email received, some not
- DNS still propagating (wait up to 48 hours)
- Old MX records cached somewhere (will expire naturally)
Microsoft 365 MX Records
Configuring MX records for Microsoft 365 (Outlook/Exchange Online).
Microsoft 365 MX Configuration
Required MX Record:
Microsoft 365 uses a single MX record:
Priority: 0
Mail Server: yourdomain-com.mail.protection.outlook.com
Note: Replace "yourdomain-com" with your actual domain name (dashes replace dots).
Example:
- Domain: example.com
- MX Record: example-com.mail.protection.outlook.com
Step-by-Step Microsoft 365 Setup
Step 1: Access Microsoft 365 Admin Center
- Log into https://admin.microsoft.com
- Go to "Settings" → "Domains"
- Select your domain
Step 2: Get Your Specific MX Record
- Click "DNS records" or "Set up DNS"
- Microsoft provides your exact MX record
- Note the format: yourdomain-com.mail.protection.outlook.com
Step 3: Remove Old MX Records
- Log into DNS provider
- Delete all existing MX records
- Ensures clean Microsoft 365 setup
Step 4: Add Microsoft 365 MX Record
Record Details:
- Type: MX
- Name: @ (or blank for root domain)
- Mail server: example-com.mail.protection.outlook.com
- Priority: 0
- TTL: 3600
Important: Microsoft 365 uses priority 0 (highest priority possible).
Step 5: Verify in Microsoft 365 Admin
- Return to Admin Center → Domains
- Click "Verify" or "Continue"
- Microsoft checks MX record
- Verification may take 15 minutes to 72 hours
Additional Microsoft 365 DNS Records
SPF Record (Required):
Type: TXT
Name: @
Value: v=spf1 include:spf.protection.outlook.com -all
Autodiscover CNAME (Required):
Type: CNAME
Name: autodiscover
Value: autodiscover.outlook.com
DKIM CNAMEs (Recommended):
Microsoft provides two CNAME records for DKIM:
Type: CNAME
Name: selector1._domainkey
Value: selector1-yourdomain-com._domainkey.yourdomain.onmicrosoft.com
Type: CNAME
Name: selector2._domainkey
Value: selector2-yourdomain-com._domainkey.yourdomain.onmicrosoft.com
DMARC Record (Recommended):
Type: TXT
Name: _dmarc
Value: v=DMARC1; p=quarantine; rua=mailto:[email protected]
Testing Microsoft 365 Email
Send Test Email:
- Send email to [email protected]
- Check Outlook inbox
- May take 30 minutes during propagation
Verify MX Record:
dig example.com MX
Expected output:
example.com. MX 0 example-com.mail.protection.outlook.com.
Common Microsoft 365 Issues
Issue: Wrong MX format
- Incorrect: example.com.mail.protection.outlook.com
- Correct: example-com.mail.protection.outlook.com (dashes replace dots)
Issue: Multiple MX records when only one needed
- Microsoft 365 only needs one MX record
- Remove additional MX records
- Priority should be 0
Issue: Autodiscover not working
- Ensure autodiscover CNAME record added
- Required for Outlook client configuration
- Format: autodiscover.outlook.com (no trailing dot needed)
Custom Mail Server MX Records
Configuring MX records for self-hosted or custom mail servers.
Custom Mail Server Requirements
Before configuring MX records, ensure your mail server:
- Has a static IP address (dynamic IPs don't work for mail servers)
- Hostname resolves to IP (A record exists)
- Reverse DNS (PTR) configured (IP resolves back to hostname)
- Port 25 open (incoming SMTP connections)
- Valid SSL/TLS certificate (for encrypted connections)
- Proper mail server software (Postfix, Exim, Exchange, etc.)
Step 1: Create A Record for Mail Server
Your mail server needs an A record:
mail.example.com. A 203.0.113.1
DNS Configuration:
- Type: A
- Name: mail (or your chosen hostname)
- Value: 203.0.113.1 (your mail server IP)
- TTL: 3600
Step 2: Configure Reverse DNS (PTR Record)
PTR records are configured by your IP provider (hosting company, ISP):
1.113.0.203.in-addr.arpa. PTR mail.example.com.
How to Set Up PTR:
- Contact your hosting provider or ISP
- Request PTR record pointing to your mail hostname
- Provide: IP address and desired hostname
Why PTR is Critical:
- Major email providers (Gmail, Outlook) check PTR records
- Missing or mismatched PTR = email marked as spam
- FCrDNS (Forward-Confirmed reverse DNS) required for deliverability
Step 3: Add MX Records
Single Mail Server:
example.com. MX 10 mail.example.com.
Primary and Backup Configuration:
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
Add in DNS:
- Type: MX
- Name: @
- Mail server: mail.example.com
- Priority: 10
- TTL: 3600
Step 4: Configure SPF Record
SPF authorizes your mail server:
Type: TXT
Name: @
Value: v=spf1 a mx ip4:203.0.113.1 -all
Explanation:
a: Authorize IPs from A recordmx: Authorize IPs from MX recordsip4:203.0.113.1: Explicitly authorize this IP-all: Reject email from other sources
Step 5: Set Up DKIM
Generate DKIM keys on your mail server:
Using OpenDKIM (Linux):
opendkim-genkey -b 2048 -d example.com -s mail
This creates:
mail.private: Private key (keep on server)mail.txt: Public key (publish in DNS)
Add DKIM DNS Record:
Type: TXT
Name: mail._domainkey
Value: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBA... (from mail.txt)
Step 6: Implement DMARC
Type: TXT
Name: _dmarc
Value: v=DMARC1; p=quarantine; rua=mailto:[email protected]
Complete Custom Mail Server DNS Configuration
Example complete setup:
# Mail server A record
mail.example.com. A 203.0.113.1
# MX records (primary and backup)
example.com. MX 10 mail.example.com.
example.com. MX 20 backup.example.com.
# SPF record
example.com. TXT "v=spf1 mx ip4:203.0.113.1 -all"
# DKIM record
mail._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0..."
# DMARC record
_dmarc.example.com. TXT "v=DMARC1; p=quarantine; rua=mailto:[email protected]"
Testing Custom Mail Server
Test Mail Server Connectivity:
telnet mail.example.com 25
Expected response:
220 mail.example.com ESMTP
Test MX Records:
dig example.com MX
Test Reverse DNS:
dig -x 203.0.113.1
Send Test Email: Use https://www.mail-tester.com
- Send email to provided address
- Review score and diagnostics
- Fix any reported issues
Common Custom Mail Server Issues
Issue: Email marked as spam
- Check PTR record matches forward DNS
- Verify SPF, DKIM, DMARC configured
- Ensure IP not on blacklists (check MXToolbox)
Issue: Port 25 blocked
- Many ISPs block port 25 for residential connections
- Use business hosting with port 25 open
- Or use mail relay service
Issue: SSL certificate errors
- Obtain valid SSL certificate for mail hostname
- Use Let's Encrypt for free certificates
- Certificate hostname must match mail server hostname
Popular Email Providers MX Settings
Quick reference for common email hosting services.
Zoho Mail
MX Records:
Priority: 10 Mail Server: mx.zoho.com
Priority: 20 Mail Server: mx2.zoho.com
Priority: 50 Mail Server: mx3.zoho.com
SPF:
v=spf1 include:zoho.com ~all
DKIM: Configured in Zoho admin panel Documentation: https://www.zoho.com/mail/help/adminconsole/configure-email-delivery.html
ProtonMail
MX Records:
Priority: 10 Mail Server: mail.protonmail.ch
Priority: 20 Mail Server: mailsec.protonmail.ch
SPF:
v=spf1 include:_spf.protonmail.ch ~all
DMARC and DKIM: Configured in ProtonMail settings Documentation: https://protonmail.com/support/knowledge-base/dns-records/
Fastmail
MX Records:
Priority: 10 Mail Server: in1-smtp.messagingengine.com
Priority: 20 Mail Server: in2-smtp.messagingengine.com
SPF:
v=spf1 include:spf.messagingengine.com ~all
Documentation: https://www.fastmail.help/hc/en-us/articles/1500000280261
Amazon WorkMail
MX Records:
Priority: 10 Mail Server: inbound-smtp.region.amazonaws.com
Replace "region" with your AWS region (e.g., us-east-1).
SPF:
v=spf1 include:amazonses.com ~all
Documentation: https://docs.aws.amazon.com/workmail/latest/adminguide/add-domain.html
Rackspace Email
MX Records:
Priority: 10 Mail Server: mx1.emailsrvr.com
Priority: 20 Mail Server: mx2.emailsrvr.com
SPF:
v=spf1 include:emailsrvr.com ~all
Documentation: https://docs.rackspace.com/support/how-to/
ImprovMX (Free Email Forwarding)
MX Records:
Priority: 10 Mail Server: mx1.improvmx.com
Priority: 20 Mail Server: mx2.improvmx.com
Note: ImprovMX is forwarding only (receiving and forwarding to existing email).
Documentation: https://improvmx.com/guides/
Testing MX Records
Verify your MX configuration is working correctly.
Command Line Testing
Check MX Records (Linux/Mac):
dig example.com MX
# Or use nslookup
nslookup -type=MX example.com
Expected Output:
example.com. 3600 IN MX 10 mail.example.com.
example.com. 3600 IN MX 20 backup.example.com.
Check MX Records (Windows):
nslookup -type=MX example.com
Online MX Testing Tools
MXToolbox (https://mxtoolbox.com)
- Visit https://mxtoolbox.com/MXLookup.aspx
- Enter your domain
- Review MX records and configuration
- Check for warnings or errors
What MXToolbox checks:
- MX records exist and are valid
- Mail servers have A records
- Reverse DNS (PTR) configured
- Mail server connectivity (port 25)
- Potential blacklist issues
Google Admin Toolbox
- Visit https://toolbox.googleapps.com/apps/checkmx/
- Enter your domain
- View comprehensive DNS and email configuration
- Identifies issues with MX, SPF, DMARC
IntoDNS (https://intodns.com)
- Comprehensive DNS health check
- Tests MX records, SPF, nameservers
- Provides detailed explanations of issues
Send Test Email
Manual Test:
- Send email from external address (Gmail, Outlook, etc.)
- Send to address at your domain: [email protected]
- Verify email arrives in your mailbox
- Check timing (immediate or delayed indicates issues)
Automated Testing:
Mail-Tester (https://www.mail-tester.com)
- Get unique test address from mail-tester.com
- Send email from your domain to test address
- Review score and diagnostic report
- Includes MX, SPF, DKIM, DMARC, blacklist checks
Port25 Verifier
- Send email to: [email protected]
- Receive detailed authentication report via reply
- Shows MX, SPF, DKIM, DMARC results
Checking DNS Propagation
WhatsmyDNS (https://www.whatsmydns.net)
- Enter your domain
- Select "MX" record type
- View propagation across global DNS servers
- Green checkmarks indicate propagation complete
Propagation Checklist:
- ✅ Records visible in multiple locations (50%+)
- ✅ Same records returned from different DNS servers
- ✅ No old MX records still appearing
- ✅ Complete propagation typically 24-48 hours
Testing Mail Server Connectivity
Telnet Test:
telnet mail.example.com 25
Expected Response:
Trying 192.0.2.1...
Connected to mail.example.com.
220 mail.example.com ESMTP Postfix
Type quit to exit.
What This Tests:
- Mail server is running
- Port 25 is open
- Server accepts connections
- Server responds with valid SMTP greeting
If Connection Fails:
- Mail server may be down
- Port 25 blocked by firewall
- Incorrect hostname or IP in MX record
Checking Email Headers
After receiving test email, view headers:
Gmail:
- Open email
- Click three dots (⋮)
- Select "Show original"
- Review Received headers and authentication
Look For:
Received: from mail.example.com (mail.example.com [192.0.2.1])
Authentication-Results:
mx.google.com;
spf=pass smtp.mailfrom=example.com;
dmarc=pass
Headers Show:
- Which MX record was used
- Mail server that delivered message
- Authentication results (SPF, DKIM, DMARC)
- Delivery path and timing
Common MX Record Mistakes
Avoid these frequent configuration errors.
Mistake 1: MX Pointing to CNAME
Incorrect:
example.com. MX 10 mail.example.com.
mail.example.com. CNAME server.hosting.com.
Why It's Wrong:
- RFC 2181 prohibits MX records pointing to CNAMEs
- Some mail servers reject this configuration
- May cause delivery failures
Correct:
example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1
MX must point to A or AAAA records, never CNAMEs.
Mistake 2: MX Pointing to IP Address
Incorrect:
example.com. MX 10 192.0.2.1
Why It's Wrong:
- MX records must point to hostnames, not IPs
- Protocol violation (RFC 5321)
- Will be rejected by many mail servers
Correct:
example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1
Mistake 3: Missing A Record for Mail Server
Incorrect:
example.com. MX 10 mail.example.com.
# (No A record for mail.example.com)
Why It's Wrong:
- Mail server hostname must resolve to IP
- Senders cannot connect without IP address
- All email delivery fails
Correct:
example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1
Mistake 4: Wrong Priority Values
Incorrect:
example.com. MX 10 primary.example.com.
example.com. MX 5 backup.example.com.
Why It's Wrong:
- Backup has priority 5 (higher priority than primary)
- Backup will be tried first
- Primary will only be used if backup fails
Correct:
example.com. MX 10 primary.example.com.
example.com. MX 20 backup.example.com.
Remember: Lower number = higher priority.
Mistake 5: Typos in Mail Server Hostname
Incorrect:
example.com. MX 10 mal.example.com.
Why It's Wrong:
- Typo: "mal" instead of "mail"
- Hostname doesn't exist
- All email delivery fails
Prevention:
- Copy/paste hostnames from documentation
- Use DNS validation tools
- Test after configuration
Mistake 6: Forgetting Trailing Dot
Context-Dependent Issue:
Some DNS providers require trailing dot for FQDN:
example.com. MX 10 mail.example.com.
Others automatically append your domain:
# In DNS panel, you might enter just:
mail MX 10 mail.example.com
# Provider appends .example.com making it:
mail.example.com MX 10 mail.example.com.example.com (Wrong!)
Solution:
- Read your DNS provider's documentation
- Use @ or blank for root domain
- Use fully qualified names when required
- Test after adding records
Mistake 7: Multiple MX Records When One Needed
Issue (Microsoft 365 Example):
example.com. MX 10 example-com.mail.protection.outlook.com.
example.com. MX 20 backup-mail.example.com.
Why It's Problematic:
- Microsoft 365 should be only MX record
- Backup MX receives some email
- Email split between Microsoft 365 and other server
- Users miss emails going to wrong server
Correct:
example.com. MX 0 example-com.mail.protection.outlook.com.
Remove all other MX records.
Mistake 8: Old MX Records Not Removed
Issue:
# Old mail server
example.com. MX 10 oldmail.example.com.
# New mail server
example.com. MX 5 newmail.example.com.
Why It's Wrong:
- Some email still delivered to old server
- Users missing emails
- Inconsistent delivery during transition
Correct:
# Remove old record, keep only new
example.com. MX 10 newmail.example.com.
Mistake 9: No Backup MX Records
Insufficient:
example.com. MX 10 mail.example.com.
Why It's Risky:
- Single point of failure
- If mail server down, email bounces or is queued
- No redundancy for maintenance or outages
Better:
example.com. MX 10 mail1.example.com.
example.com. MX 20 mail2.example.com.
Mistake 10: Wrong TTL During Migration
Issue:
- High TTL (86400 = 24 hours)
- DNS changes take long to propagate
- Extended transition period
Best Practice:
- Lower TTL to 300-600 before changes
- Wait for old TTL to expire
- Make changes
- Raise TTL after verification
Troubleshooting MX Record Issues
Solutions for common MX record problems.
Problem: Email Not Received
Symptoms:
- Senders receive bounce messages
- Email never arrives
- No messages in spam folder
Diagnostic Steps:
1. Verify MX Records Exist:
dig example.com MX
If no results, MX records aren't published.
2. Check MX Points to Valid Hostname:
dig mail.example.com A
Must return IP address.
3. Test Mail Server Connectivity:
telnet mail.example.com 25
Should connect and show SMTP banner.
Solutions:
- No MX records: Add MX records following provider documentation
- MX hostname doesn't resolve: Add A record for mail server
- Can't connect to mail server: Check firewall, ensure server running
Problem: Some Email Received, Some Not
Symptoms:
- Intermittent delivery
- Some senders successful, others fail
- Inconsistent behavior
Likely Causes:
1. DNS Propagation Incomplete:
- Some DNS servers have new records
- Some DNS servers have old records
- Resolves naturally after 24-48 hours
Check Propagation:
https://www.whatsmydns.net - check MX records globally
2. Multiple MX Records with Conflicts:
- Old and new MX records coexist
- Email split between servers
Solution:
- Remove old MX records
- Keep only current mail server MX records
3. SPF Authentication Failures:
- MX records correct but SPF blocks legitimate senders
Check SPF:
dig example.com TXT | grep spf
Ensure SPF includes all legitimate mail servers.
Problem: Bounce Messages About MX Record
Common Bounce Messages:
"No MX or A records for domain"
- Meaning: Domain has no MX records
- Solution: Add MX records
"Host not found"
- Meaning: MX record points to non-existent hostname
- Solution: Verify mail server hostname, add A record
"Connection refused"
- Meaning: Mail server not accepting connections
- Solution: Check mail server is running, port 25 open
"Temporary DNS failure"
- Meaning: DNS lookup failed temporarily
- Solution: Usually resolves automatically, retry later
Problem: Email Goes to Spam
Symptoms:
- Email delivered but marked as spam
- Not an MX issue, but related to email authentication
Check:
1. Reverse DNS (PTR Record):
dig -x 192.0.2.1 # Your mail server IP
Should return your mail server hostname.
2. SPF Record:
dig example.com TXT | grep spf
Should authorize your mail server.
3. DKIM Configuration:
dig selector._domainkey.example.com TXT
Should return DKIM public key.
4. DMARC Policy:
dig _dmarc.example.com TXT
Should have DMARC policy.
5. Blacklists: Check https://mxtoolbox.com/blacklists.aspx See if your mail server IP is blacklisted.
Problem: MX Priority Ignored
Symptoms:
- Backup server receiving email instead of primary
- Wrong server handling email
Causes:
1. Swapped Priorities:
# Wrong
example.com. MX 20 primary.example.com.
example.com. MX 10 backup.example.com.
Lower number is higher priority—backup tried first.
Solution: Swap priority values.
2. Primary Server Down:
- Sending servers follow priority order
- If primary fails, try backup
- May appear as "priority ignored" but working correctly
Verify Server Status:
telnet primary.example.com 25
Problem: DNS Changes Not Taking Effect
Symptoms:
- Updated MX records hours ago
- Old records still returned by DNS queries
- Email still going to old server
Causes:
1. TTL Not Expired:
- Old records cached based on previous TTL
- If old TTL was 86400 (24 hours), must wait 24 hours
Solution: Wait for TTL expiration, or lower TTL before future changes.
2. Local DNS Cache:
# Flush DNS cache (Mac)
sudo dscacheutil -flushcache
# Flush DNS cache (Windows)
ipconfig /flushdns
# Flush DNS cache (Linux)
sudo systemd-resolve --flush-caches
3. Changed at Wrong Location:
- DNS changes made at old DNS provider
- Domain now uses different nameservers
Verify Current Nameservers:
dig example.com NS
Ensure DNS changes made at current DNS host.
Best Practices for MX Records
1. Always Use Backup MX Records
Minimum Configuration:
example.com. MX 10 primary.example.com.
example.com. MX 20 backup.example.com.
Benefits:
- Redundancy during outages
- No lost email during maintenance
- Better deliverability reputation
2. Use Proper Priority Spacing
Good:
MX 10 primary.example.com.
MX 20 secondary.example.com.
MX 30 backup.example.com.
Why:
- Allows inserting new servers between priorities
- Clear priority hierarchy
- Easy to adjust later
3. Point MX to A Records, Not CNAMEs
Correct:
example.com. MX 10 mail.example.com.
mail.example.com. A 192.0.2.1
Avoid:
example.com. MX 10 mail.example.com.
mail.example.com. CNAME server.host.com.
4. Set Appropriate TTL
During Changes:
- TTL: 300-600 (5-10 minutes)
- Speeds up propagation
Normal Operation:
- TTL: 3600-86400 (1-24 hours)
- Reduces DNS query load
5. Implement Email Authentication
Required DNS Records:
- ✅ MX records (email delivery)
- ✅ SPF record (sender authorization)
- ✅ DKIM record (message signing)
- ✅ DMARC record (policy enforcement)
Complete authentication improves deliverability.
6. Document Your Configuration
Maintain records of:
- Current MX configuration
- Priority values and reasoning
- Mail server purposes (primary, backup, etc.)
- Date of last change
- Provider contacts
7. Test Before and After Changes
Before:
- Verify current configuration working
- Document existing setup
- Lower TTL 24 hours in advance
After:
- Use MXToolbox to verify records
- Send test emails
- Monitor email delivery for 48 hours
8. Monitor MX Records
Regular Checks:
- Verify MX records monthly
- Check for unauthorized changes
- Ensure mail servers operational
- Review DNS provider security
Automated Monitoring:
- Use domain monitoring service
- Set alerts for MX record changes
- Monitor mail server uptime
9. Keep A and MX Records Synchronized
If mail server IP changes:
- Update A record for mail.example.com
- No need to change MX record (still points to hostname)
- Verify connectivity after change
Advantage of hostname-based MX:
- Change IPs without touching MX records
- Cleaner migrations
- Less potential for errors
10. Plan for Migrations
Transition Strategy:
- Lower TTL 48 hours before migration
- Add new MX records with lower priority
- Test new mail server
- Swap priorities (new becomes primary)
- Monitor for 48 hours
- Remove old MX records
- Raise TTL back to normal
This ensures zero downtime and no lost email.
Frequently Asked Questions
What are MX records and why do I need them?
MX (Mail Exchange) records tell email servers where to deliver email for your domain. Without MX records, email sent to addresses at your domain ([email protected]) will bounce with "no mail server found" errors. MX records are required for receiving email—they're not optional. Even if you don't currently use email at your domain, you should configure MX records if you plan to in the future.
How long does it take for MX record changes to take effect?
MX record changes take 1-48 hours for complete global propagation, depending on TTL (Time To Live) values. Most users will see changes within 1-4 hours. Lower TTL values (300-600 seconds) before making changes to speed up propagation. During propagation, some email may be delivered to old servers while other email goes to new servers—this is normal and temporary.
Can I have multiple MX records?
Yes, and it's recommended. Multiple MX records provide redundancy and load balancing. Use different priority values to define which server is tried first (lower number = higher priority). For example, priority 10 is tried before priority 20. Servers with the same priority are selected randomly, distributing load. Most email setups have 2-5 MX records for reliability.
Do MX records affect sending email or just receiving?
MX records only affect receiving email at your domain. They tell other mail servers where to deliver incoming messages. Sending email requires SMTP server configuration on your mail server and email authentication (SPF, DKIM, DMARC) but doesn't use MX records. When you send email, your mail server connects directly to the recipient's MX records.
What's the difference between priority 0 and priority 10?
Priority values determine the order mail servers are tried—lower numbers mean higher priority. Priority 0 is the highest possible priority, while priority 10 is tried after priority 0 but before priority 20. The absolute values don't matter, only relative order. Microsoft 365 uses priority 0 for their single MX record. Most other providers use priority 10 for primary servers. Use gaps (10, 20, 30) to allow inserting new servers between existing priorities later.
Can I point MX records to my website domain?
Technically you could point MX records to your website domain, but it's not recommended. Typically, websites and mail servers run on different servers with different IPs. Best practice is using a dedicated hostname like mail.example.com for mail servers. This allows independent management of web and email infrastructure and clearer separation of services.
What happens if my mail server is down?
If your primary mail server is down and you have backup MX records configured, sending mail servers automatically try the backup server. This provides continued email delivery during outages. Without backup MX records, senders will receive temporary failure messages and their servers will queue the email to retry later (usually for 24-48 hours before giving up).
Do I need to remove old MX records when migrating email providers?
Yes, you should remove old MX records when migrating to a new email provider. Having MX records for both old and new providers causes email to be split between them—some messages go to the old server, some to the new one. This results in users missing emails. Best practice: keep old mail server running during DNS propagation (24-48 hours), then shut down old server and remove its MX records.
Can subdomains have different MX records than the main domain?
Yes, subdomains can have completely separate MX records. For example, example.com and mail.example.com can each have their own MX records pointing to different mail servers. This allows different departments or services to use separate email infrastructure. If a subdomain has no MX record, email will fall back to the parent domain's MX records.
Why does MXToolbox show warnings about my MX configuration?
Common MXToolbox warnings include: reverse DNS (PTR) not configured, mail server in blacklist, no backup MX records, or very high TTL values. Most warnings indicate potential deliverability issues rather than complete failures. Address warnings about PTR records and blacklists immediately, as these significantly impact email reputation. Backup MX warnings are advisable to fix for redundancy but won't prevent email delivery.
Key Takeaways
- MX records specify mail servers that receive email for your domain
- Priority values determine order with lower numbers tried first (10 before 20)
- MX records must point to hostnames (A or AAAA records), never IP addresses or CNAMEs
- Multiple MX records provide redundancy protecting against mail server outages
- Google Workspace requires 5 MX records with specific priorities and hostnames
- Microsoft 365 uses single MX record with priority 0 and unique hostname format
- DNS propagation takes 24-48 hours plan migrations with this timeline in mind
- Lower TTL before changes speeds up propagation when updating MX records
- Test MX records after configuration using dig, MXToolbox, and test emails
- Email authentication is separate but related—configure SPF, DKIM, and DMARC alongside MX
- Backup MX records are essential for professional email reliability
- Document your MX configuration for troubleshooting and future maintenance
Next Steps
Configure Your MX Records
-
Choose Your Email Provider
- Google Workspace for Gmail-based business email
- Microsoft 365 for Outlook/Exchange Online
- Custom mail server for full control
- Third-party email hosting for affordable options
-
Gather Required Information
- Mail server hostnames from provider
- Priority values for each MX record
- Access to DNS management
- Additional required DNS records (SPF, DKIM)
-
Lower TTL 48 Hours Before Changes
- Change TTL to 300-600 seconds
- Wait for old TTL to expire
- Ensures faster propagation during actual changes
-
Add MX Records
- Remove old MX records (if any)
- Add all required MX records
- Verify no typos in hostnames
- Save and verify in DNS panel
-
Wait for Propagation
- Monitor propagation with whatsmydns.net
- Test MX records with dig or MXToolbox
- Send test emails to verify delivery
- Wait 24-48 hours for full propagation
-
Configure Email Authentication
- Add SPF record authorizing mail servers
- Set up DKIM with cryptographic signing
- Implement DMARC with monitoring policy
- Test authentication with mail-tester.com
-
Monitor and Maintain
- Review MX records quarterly
- Check mail server connectivity
- Monitor for DNS changes
- Update when adding email services
Monitor Your Domain with DomainDetails Pro
Upgrade to DomainDetails Pro for advanced DNS and email monitoring:
- Automatic MX record monitoring - Track changes to your mail server configuration
- Email deliverability tracking - Monitor SPF, DKIM, and DMARC records
- Change history - See when DNS records were modified and by whom
- Email alerts - Get notified immediately of MX record or DNS issues
- Bulk domain monitoring - Track MX records across entire domain portfolio
- Export reports - Download MX and email configuration data for audits
Related Articles
- Understanding DMARC, SPF, and DKIM for Email
- Setting Up Email with Your Domain
- DNS Record Types Explained
- How to Change Nameservers
Research Sources
- RFC 5321 - Simple Mail Transfer Protocol (SMTP)
- RFC 1035 - Domain Names - Implementation and Specification
- RFC 2181 - Clarifications to the DNS Specification
- RFC 974 - Mail Routing and the Domain System
- Google Workspace MX Record Documentation - https://support.google.com/a/answer/140034
- Microsoft 365 MX Record Setup - https://learn.microsoft.com/en-us/microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider
- IETF MX Record Best Practices - https://datatracker.ietf.org/doc/html/rfc5321
- DNS OARC MX Record Guidelines - https://www.dns-oarc.net/
- MXToolbox Email Delivery Resources - https://mxtoolbox.com/emailhealth
- ICANN DNS Best Current Practices - https://www.icann.org/resources/pages/dns-best-practices