MX Priority Explained: How Mail Servers Decide Where Email Goes

The single number that determines which mail server gets tried first, what happens when it doesn't answer, and why getting it wrong quietly breaks inbound email.

📅 Published July 2026· ⏳ 19 min read· ✍️ ToolsNovaHub Editorial Team
🛠️ Related tool: Open MX Lookup →

The Number Nobody Explains Properly

Every MX record carries two pieces of information: a hostname, and a small integer sitting right next to it that most people glance past. That integer is the priority value (RFC 5321 calls it "preference"), and it is the entire routing logic for inbound email in a single field. Get it right and a domain survives a mail server outage without anyone noticing. Get it wrong — or leave every host at the same value without meaning to, or point the lowest number at a decommissioned box — and messages either pile up in a sender's retry queue or land somewhere nobody is watching.

This guide is about that number specifically: what it does mechanically inside a sending server's decision loop, how it behaves when things go wrong, and how experienced administrators actually assign it across primary and backup infrastructure. If you're looking for a general introduction to MX records as a DNS record type, our MX Record Complete Guide covers that ground; this article goes deeper specifically on the priority mechanic and the routing decisions built on top of it.

ToolsNovaHub Pro Tip
Don't assign priority values 1, 2, 3, 4… sequentially. Space them out — 10, 20, 30 — so you can insert a new mail host between two existing ones later (priority 15) without renumbering everything.
⚠️
Common Beginner Mistake
Assuming a "backup" MX host at a higher priority number is only contacted during an outage. In reality it's contacted constantly — every time a sender randomly retries, every time the primary is momentarily slow, every time greylisting triggers a requeue.

How the Preference Value Actually Works

An MX record's priority is an unsigned 16-bit integer, so it can technically be anything from 0 to 65535, though in practice almost every deployment you'll ever see uses small, round numbers: 5, 10, 20, 50. The value itself is meaningless in isolation — what matters is how it compares to the other MX priorities published for the same domain. A sending mail transfer agent (MTA) that needs to deliver a message queries the recipient domain's MX records, sorts the returned list by priority ascending, and works down that list starting from the lowest number.

Say a domain publishes three MX records: mail1.example.com at priority 10, mail2.example.com at priority 20, and mail3.example.com at priority 30. A sending server always attempts mail1 first. Only if the connection to mail1 fails outright, times out, or is refused at the SMTP protocol level does the sender move on to mail2. mail3 is essentially never touched unless both of the higher-preference hosts are unreachable. This is a strict ordering, not a suggestion — well-behaved MTAs (Postfix, Exim, Exchange, sendmail) all implement it the same way because it's specified precisely in RFC 5321 section 5.1.

What "Failure" Actually Means to a Sending Server

This is where a lot of assumptions go wrong. Administrators sometimes picture priority failover as something that only kicks in during a dramatic outage — the server is unplugged, the data center is on fire. In practice, sending MTAs treat a much broader set of conditions as reasons to try the next MX host:

  • TCP connection refused — nothing is listening on port 25 at that host.
  • TCP connection timeout — the host doesn't respond within the sender's connect timeout window, typically somewhere between 30 and 60 seconds depending on the MTA.
  • SMTP-level 4xx or 5xx rejection during the greeting or EHLO stage — the server answered, but refused to proceed. A 421 "service not available" is common when a host is intentionally shedding load.
  • STARTTLS negotiation failure — for domains enforcing MTA-STS or DANE, a broken or expired certificate on the primary host can cause the sender to abandon the attempt and fall through, depending on policy strictness.
  • DNS resolution failure for the MX hostname itself — if mail1.example.com has no A or AAAA record, the sender can't even get an IP to connect to, so it moves on.

None of these require the primary server to be fully "down" in the conventional sense. A server that's alive but overloaded, mid-restart, or serving an expired TLS certificate can trigger exactly the same fallback behavior as a server that's been powered off. That's a feature, not a bug — it's precisely the resilience the priority system is designed to provide — but it means your secondary MX host will see real production traffic far more often than most people expect.

Equal Priority: Load Distribution, Not Failover

When two or more MX records share the exact same priority number, the behavior changes from strict ordering to distribution. RFC 5321 leaves the exact selection method up to the sending implementation, but the near-universal convention is randomized selection among the tied hosts, sometimes weighted, sometimes not. Google Workspace's default MX set is the textbook example of this pattern in production:

example.com.  3600  IN  MX  1   ASPMX.L.GOOGLE.COM.
example.com.  3600  IN  MX  5   ALT1.ASPMX.L.GOOGLE.COM.
example.com.  3600  IN  MX  5   ALT2.ASPMX.L.GOOGLE.COM.
example.com.  3600  IN  MX  10  ALT3.ASPMX.L.GOOGLE.COM.
example.com.  3600  IN  MX  10  ALT4.ASPMX.L.GOOGLE.COM.

Here, ALT1 and ALT2 sit at the same priority tier. Sending servers won't consistently favor one over the other — over a large enough volume of mail, both receive roughly equal inbound connection load. This is genuinely useful for spreading traffic across geographically distributed front-end servers that all belong to the same underlying platform, but it is not the same mechanism as backup MX, where a distinctly higher priority number marks a host as a fallback rather than a peer. Confusing the two is one of the more common configuration mistakes we cover later in this guide.

AspectEqual-Priority HostsBackup MX (Higher Number)
Traffic under normal conditionsBoth/all hosts receive live traffic continuouslyRarely receives traffic while primary is healthy
PurposeHorizontal load distribution across peer serversFallback continuity when primary is unreachable
Infrastructure expectationBoth hosts must be equally capable and currentCan be a lighter-weight queueing relay, not a full mailbox store
Monitoring priorityBoth monitored identically — either can fail independentlyMust be actively tested; silent failure goes unnoticed for months
Typical operatorSame organization, same mail platformSometimes a different vendor entirely (e.g. ISP backup MX service)

Assigning Priority Across Primary and Backup Infrastructure

There's no protocol requirement dictating specific numbers, which is exactly why real-world deployments vary so much. What matters is relative ordering and leaving room to maneuver. A pattern we see hold up well across small business and enterprise deployments alike:

  • Priority 10 — primary mail platform (Google Workspace, Microsoft 365, or an on-prem cluster's public-facing edge transport servers).
  • Priority 20 — a secondary edge transport instance, either geographically separate or on different underlying infrastructure than priority 10.
  • Priority 50 — a dedicated backup MX / spool-and-forward relay, whether self-hosted or from a specialist provider, that queues mail and retries delivery to the primary once it recovers.

Leaving gaps between values (10/20/50 instead of 1/2/3) isn't cosmetic. When you eventually add a fourth host — a disaster-recovery region, a migration target you're phasing in — you want to be able to slot it in at priority 15 or 30 without touching the values already in production and risking a typo that silently reorders your entire routing hierarchy.

Behavior During Migrations

Priority becomes a genuinely useful migration tool, not just a resilience mechanism. When moving from an on-premises Exchange server to Microsoft 365 or Google Workspace, a common technique is to publish both mail systems as MX records simultaneously during the cutover window, with the new platform at a lower (preferred) priority and the legacy system temporarily left at a higher number as a safety net. Because DNS changes propagate gradually as cached records expire across the internet's resolvers, some senders will keep hitting the old priority ordering for a period defined by TTL — running both live in parallel avoids a hard cutover where any mail sent during the transition window has nowhere reliable to land.

This only works cleanly if the legacy system is still actually capable of accepting and forwarding mail during the overlap period, and if someone remembers to decommission it afterward. We've seen more than one domain still quietly listing a mail server that was powered off eighteen months earlier, sitting there at priority 50, contributing nothing but a slightly longer sender timeout on the rare occasion a stale resolver cache points at it.

Real-World Platform Examples

How priority gets configured differs by platform mainly in where the knob lives, not in the underlying behavior.

Postfix doesn't set MX priority itself — that lives entirely in DNS, at the zone file or DNS provider level, external to Postfix's own configuration. Postfix's relayhost and transport_maps settings control outbound routing decisions, but inbound priority is purely a DNS artifact that Postfix, as a receiving server, has no say in.

Exim is the same story on the receiving side — priority is a DNS-layer decision — but on the sending side, Exim's dns_ipv4_lookup and related routing options determine how it interprets and sorts the MX list it receives, including how it handles ties and IPv6 versus IPv4 preference among equally-prioritized hosts.

Microsoft Exchange (on-premises) exposes MX priority indirectly through the Accepted Domains and Send Connector configuration when Exchange is doing the sending, but for a domain's own inbound MX, priority is again set wherever that domain's authoritative DNS is hosted — Exchange doesn't publish its own DNS zone by default.

Microsoft 365 auto-provisions a single MX record for a verified domain, typically formatted as domain-com.mail.protection.outlook.com at priority 0, and generally expects to be the sole inbound path unless you deliberately layer additional records for hybrid or backup scenarios.

Google Workspace auto-provisions the five-record ASPMX pattern shown earlier, spreading load across two priority tiers by design, which is part of why Workspace domains rarely need a third-party backup MX for basic redundancy — Google has already built tiered redundancy into the default set.

PlatformWhere Priority LivesDefault Redundancy
PostfixExternal DNS zone, not Postfix configNone by default — admin must add records
EximExternal DNS zone, not Exim configNone by default — admin must add records
Exchange (on-prem)External DNS zone the org managesNone by default — admin must add records
Microsoft 365Auto-provisioned single recordSingle host, Microsoft-side HA behind it
Google WorkspaceAuto-provisioned five-record setTwo priority tiers built in

How Priority Interacts With SPF, DKIM and DMARC

MX priority governs where mail arrives, not whether it's trusted once it does — but the two systems brush against each other in a couple of practical ways. SPF's mx mechanism (v=spf1 mx -all) authorizes the IP addresses that a domain's MX hostnames resolve to, regardless of their priority tier — a low-priority backup host is just as authorized as the primary under this mechanism, which is worth remembering if that backup relay ever needs to originate outbound mail (bounce messages, for instance) on the domain's behalf. DKIM and DMARC don't reference MX priority at all; they operate on the message's signed headers and the domain in the From address, independent of which physical server happened to accept the connection. Where priority does matter for authentication is operational: if your backup MX at priority 50 is a different vendor or platform than your primary, make sure that backup host is also covered by your SPF record and configured not to strip or modify DKIM signatures in transit, or mail arriving via the fallback path can fail authentication checks that would have passed through the primary.

TTL, Propagation and the Timing of Priority Changes

Changing priority values doesn't take effect instantly across the internet — it takes effect as fast as the TTL on the record allows caching resolvers to notice the change. A record cached with a 24-hour TTL means some fraction of senders worldwide will keep using the old priority ordering for up to 24 hours after you've updated DNS, simply because their resolver hasn't re-queried yet. For a routine reordering with no urgency, this is a non-issue. For an emergency reprioritization — say, demoting a compromised host out of the primary slot — it's a real constraint, and it's the reason experienced administrators keep MX TTLs lower (300–600 seconds) than they might otherwise default to, specifically to preserve the ability to react quickly.

ScenarioRecommended TTL Approach
Stable, no changes planned3600–86400s — reduce query load, propagation speed isn't a concern
Planned migration in 24–48 hoursLower to 300s a day ahead of the change
Emergency reprioritizationChange immediately even at high TTL — impact is delayed but not blocked; follow up by lowering TTL going forward
Frequent priority experimentationKeep TTL low permanently (300–600s) if you adjust routing often

Queue Retry Behavior When the Preferred Host Is Down

It's worth being precise about what happens on the sending side when a message can't be delivered to any MX host at all — every priority tier unreachable. The sending MTA doesn't drop the message. It queues it locally and retries on a schedule, typically with exponential backoff: attempts every few minutes initially, stretching to hourly, then to every few hours, continuing for a configurable period before finally bouncing with a non-delivery report. Postfix's default is roughly five days of retry before a permanent bounce; Exchange Online's default queue retry window is similar in spirit though implemented differently. This retry window is precisely why a domain with properly staggered priority values rarely loses mail even during extended primary outages — the sender will keep trying the secondary and tertiary hosts throughout that multi-day window, not just once.

Troubleshooting a Priority Misconfiguration

When inbound mail is arriving inconsistently, delayed, or not at all, priority is one of the first things worth checking alongside the more commonly suspected culprits like spam filtering or DNS resolution. A practical diagnostic sequence:

  1. Pull the current MX record set with MX Lookup and confirm the priority values match what you expect — it's surprisingly common for a stale record to have survived a platform migration.
  2. Verify every MX hostname resolves to a live A or AAAA record — a priority value pointing at a hostname with no address record is effectively a dead end that sending servers will skip past, silently degrading you to whatever's next in line.
  3. Confirm the lowest-priority host actually accepts SMTP connections on port 25 from external networks — internal firewall rules sometimes block inbound port 25 while permitting everything else, which looks identical to a DNS problem from the outside.
  4. Check whether two hosts you intended to be primary/backup are accidentally sharing the same priority number — this silently turns your fallback into a load-balanced pair, splitting traffic to a host that may not be provisioned to handle it.
  5. Test from multiple external vantage points, since local resolver caching can make a change look like it hasn't taken effect when it actually has everywhere except your own network.
SymptomLikely CauseWhere to Check
Mail delayed by hours, arrives eventuallyPrimary host rejecting/timing out, sender falling through to backup after retriesPrimary host's SMTP logs around the delay window
Mail bounces immediately, no delayNo usable MX host at any priority — likely a broken A record chainMX Lookup + A record check on each MX hostname
Mail arrives, but not at the platform you expectedTwo hosts unintentionally sharing priority, or stale record from old platform still lowestFull MX record dump, not just the top result
Works from home network, fails from officeLocal resolver cache still serving old records, or corporate DNS overrideQuery from an external resolver directly, bypass local cache

A Best-Practice Checklist

PracticeWhy It Matters
Never run with a single MX record in productionZero redundancy — one outage is total inbound mail loss
Space priority values out (10/20/50, not 1/2/3)Room to insert hosts later without renumbering
Actively test backup MX hosts, don't assume they workA backup that's never received real traffic often has a broken configuration nobody noticed
Keep SPF records aligned with every MX host, including backupsPrevents authentication failures on mail routed through the fallback path
Lower TTL ahead of planned changesFaster, more predictable propagation when it matters
Decommission old MX records after migrations, don't leave them at a high priority indefinitelyReduces confusion and eliminates a rarely-tested dead path

Related Tools

Pull a domain's live MX priority set with MX Lookup. Confirm SPF authorizes every mail host you've configured with SPF Lookup. Check how quickly a priority change is propagating globally with DNS Propagation Checker. For the broader picture of how MX records function as a DNS record type, see the MX Record Complete Guide. For how a backup host should actually be built — not just declared in DNS — read Backup MX Configuration, and for what actually triggers the fallback, see MX Failover: How Automatic Mail Rerouting Works.

FAQ

Lower means higher preference. Priority 1 is tried before priority 10. This is the single most common point of confusion for anyone new to MX records.
Yes. Tied hosts are treated as peers and sending servers distribute connections between them roughly at random, functioning as basic load balancing rather than strict failover.
No. It's used any time the primary host doesn't respond fast enough, is mid-restart, rejects the connection, or has a certificate problem — situations far more common than a full outage.
There's no fixed rule, but 10 is a common convention, leaving room below it (like 0 or 5) if a lower-priority host is ever needed, and gaps above it for secondary hosts.
No. MX priority only governs inbound delivery — which server accepts mail addressed to your domain. Outbound routing is controlled separately, e.g. by a Postfix relayhost or an Exchange send connector.
No. MX priority is a DNS-layer setting configured wherever your domain's authoritative DNS is hosted. Mail server software has no control over it for inbound purposes.
Sending servers queue the message locally and retry on a backoff schedule for several days before bouncing. With no secondary host, there's no fallback path during that window.
A minimum of two at different priority tiers for basic redundancy. Google Workspace ships five across two tiers by default; that level of built-in redundancy is a reasonable target for self-managed infrastructure too.
No — it takes effect as caching resolvers expire their cached copy of the record, governed by TTL. Lower TTL means faster, more predictable propagation.
Not necessarily. A common pattern is a lightweight spool-and-forward relay that accepts and queues mail, then forwards it to the primary once it's reachable again, rather than duplicating full mailbox infrastructure.
Indirectly, through the SPF mx mechanism, which authorizes the IPs of every listed MX host regardless of priority tier — including backup hosts, which should be kept in sync with your SPF policy.
Because "failure" from a sender's perspective includes brief timeouts, momentary overload, and mid-restart states — not just full outages. Occasional traffic on a backup host with a healthy primary is normal.
Yes, 0 is a valid and commonly used value, often seen on Microsoft 365's auto-provisioned MX record. It simply represents the highest possible preference on the standard integer scale.
No. The field is an unsigned 16-bit integer, so valid values range from 0 to 65535 only.
Run dig MX yourdomain.com +short from a terminal, or use the free MX Lookup tool for an instant browser-based check with no signup required.
Reviewed by: ToolsNovaHub Editorial Team📅 Last updated: July 2026📜 Sourced from: RFC 5321 and platform vendor documentation

ToolsNovaHub tools are built and independently maintained with a focus on accurate, no-signup network and security utilities. Spotted an error? Let us know.

📋 Related Tools & Guides Comparison

ResourceTypeLink
MX LookupToolOpen Tool →
SPF LookupToolOpen Tool →
DNS Propagation CheckerToolOpen Tool →
MX Record Complete GuideGuideRead Guide →
What is DKIM?GuideRead Guide →
SPF vs DKIM vs DMARCGuideRead Guide →
Try it yourself — 100% free
🚀 Open MX Lookup

🔗 More Guides