Updated 8 hours ago
MX record priority values determine which mail servers receive email and in what order. The system uses inverse numbering—lower numbers are tried first—which seems backwards until you understand what the number actually represents.
The Queue Position Mental Model
Forget "priority" as importance. Think of it as queue position.
Priority 10 means "I'm 10th in line." Priority 20 means "I'm 20th in line." When the line starts at 10, being 10th means you're first.
Sending servers work through the queue in order:
- Try mail1.example.com (position 10—first in line)
- If that fails, try mail2.example.com (position 20)
- If that fails, try mail3.example.com (position 30)
This design has a practical benefit: if you later need a server tried before mail1, assign it position 5. No renumbering required.
Common Configurations
Single server:
Primary with backup:
The backup only receives mail when the primary is unreachable.
Load balanced cluster:
All three share the same queue position. This triggers special behavior.
Tiered load balancing with failover:
Two primaries share load. If both fail, two backups share the load.
Load Balancing Through Chaos
When multiple servers share the same priority, something elegant happens.
Each sending server independently picks one at random. No coordination. No central load balancer. Just a million senders, each flipping a coin.
The result? Your mail distributes roughly evenly between mail1 and mail2. Emergent order from randomness.
This is receiver-side load balancing. You control it entirely through your MX records. Senders don't even know they're participating—they're just following the RFC.
When Failover Actually Happens
Sending servers don't failover on every error. The type of failure matters:
Connection failures → immediate failover: Server doesn't respond, connection times out, connection refused. The sending server immediately tries the next option.
Temporary SMTP errors → queue and retry: Server responds with 4xx codes (mailbox full, greylisting, try again later). The sending server queues the message and retries the same priority level later. It doesn't jump to backups.
Permanent SMTP errors → bounce or try next: Server responds with 5xx codes (user doesn't exist, message rejected). The sending server may try other servers at the same priority or generate a bounce.
This means backup MX servers primarily handle unreachable primaries, not overloaded ones. A primary returning "try again later" keeps receiving retry attempts.
Priority Gaps Are Conventional, Not Magical
Using 10, 20, 30 is tradition, not requirement. It leaves room for insertions:
Priorities 10, 20, 30 behave identically to 1, 2, 3 or 100, 200, 300. Only the relative order matters.
Backup MX and the Spam Problem
Backup servers with higher priority values accept mail when primaries fail:
The backup queues messages and forwards them when the primary recovers.
But there's a catch: spammers know backup servers exist. They intentionally target them, hoping for weaker filtering on the "rarely used" backup. This is called backscatter or backup MX exploitation.
Your backup servers need spam filtering as rigorous as your primaries. "It's just the backup" is exactly what attackers count on.
Spam Filtering Services
Cloud spam filters work by becoming your MX records:
Your actual mail servers aren't in DNS at all. The filtering service receives all mail, scans it, and forwards clean messages to your servers (configured in their admin panel).
Senders never connect directly to your infrastructure. Your servers are invisible to the Internet.
Testing Your Configuration
Verify MX records:
Verify failover works: Temporarily disable your primary server's SMTP service. Send a test message. Check which server received it.
Examine Received headers: After receiving test messages, look at the Received headers to see which server accepted delivery.
Common Mistakes
Reversed priorities:
Expecting immediate failover on temporary errors: Sending servers retry the same priority for 4xx errors. Backups won't help with an overloaded primary returning "try again later."
Equal priority when you wanted failover: Two servers with priority 10 means load balancing, not failover. If you want failover, use different priorities.
Weak backup server security: Backup servers are targeted specifically because administrators assume they don't need full protection.
Frequently Asked Questions About MX Record Priority
Was this page helpful?