MX Mail Exchanger

The MX record tells the internet which servers accept email for your domain. Learn format, priority values, redundancy, and common mistakes.

Published · Last verified · Maintained by TamingDNS

Record Type
MX
Category
Email Delivery
RFC
RFC 5321
Email Relevant
Yes
Format
MX <priority> <hostname>
Example
MX 10 mail.example.com.
TTL Guidance
3600-86400 s recommended; lower (300 s) only during migrations

💬 What This Record Does

An MX (Mail Exchanger) record tells the world which servers handle inbound mail for your domain. When someone sends you an email, their mail server looks up your domain's MX records to find out where to deliver the message. MX records point to hostnames (never IP addresses), and each has a priority number: the lower the number, the higher the preference. Multiple MX records provide redundancy: if the primary mail exchanger is unreachable, delivery falls back to the next priority host.

Common Uses

  • Receiving email for your domain via a cloud provider (Google Workspace, Microsoft 365)
  • Setting up a backup MX host for redundancy
  • Declaring a null MX (priority 0, target ".") for domains that intentionally receive no email (RFC 7505)

⚠️ Watch Out For

  • MX records must point to hostnames with A/AAAA records, never directly to an IP address.
  • Two hosts with the same priority are tried randomly (load balancing). Different priorities create a failover order.
  • Changing MX records takes effect after the old TTL expires. Plan migrations accordingly.

📋 Complete Example Records

Whole records in zone-file form: name, TTL, class, type, then the data. Most DNS panels ask for the pieces separately. Look them up live with the DNS Lookup tool.

example.com.        3600  IN  MX  10  mail.example.com.

One mail exchanger is all a small domain needs. The target has to be a hostname with its own A or AAAA record, never an IP address.

example.com.        3600  IN  MX   1  smtp.google.com.

This is what a Google Workspace domain publishes: one host at priority 1, so the whole inbound path is Google's.

example.com.        3600  IN  MX  10  mx1.example.com.
example.com.        3600  IN  MX  20  mx2.example.com.

Two hosts in a failover order. Senders try priority 10 first and only fall back to 20 when the first will not accept the connection.

example.com.        3600  IN  MX  10  mx1.example.com.
example.com.        3600  IN  MX  10  mx2.example.com.

Equal priorities instead. RFC 5321 §5.1 tells senders to randomise between equal-preference hosts, which spreads inbound load across both.

example.com.        3600  IN  MX   0  .

A null MX, from RFC 7505 §3. Priority 0 and a bare dot say the domain accepts no mail at all, so senders fail immediately instead of retrying for days. A domain publishing this MUST publish no other MX record.