An MX (Mail Exchanger) record is the DNS record that tells sending servers which server receives email for your domain. Without a correct MX record your domain cannot receive email; a wrong one sends mail to the wrong server or loses it.
What does an MX record do?
When someone writes to ali@example.com, the sending server first looks up the MX records of example.com in DNS. It resolves the server name in the record to an IP address and delivers the message to that server over SMTP (port 25).
MX records route inbound mail only. Which servers may send mail for your domain is set by SPF, a separate record (see SPF, DKIM and DMARC).
The parts of an MX record
example.com. 3600 IN MX 10 mail.example.com.| Field | Value in the example | Meaning |
|---|---|---|
| Name (host) | example.com. (@ in most DNS consoles) | The domain the record belongs to. |
| TTL | 3600 | How many seconds DNS caches keep the record. |
| Type | MX | The record type. |
| Priority | 10 | Lower numbers are tried first. |
| Target | mail.example.com. | The name of the receiving server. It cannot be an IP address; the name needs its own A or AAAA record. |
How MX priority works
A domain can have several MX records. The sender tries the lowest number first and moves on to the next one if it cannot connect:
example.com. MX 10 mail.example.com.
example.com. MX 20 gate.securawall.com.- The numbers only set the order: 10 and 20 behave like 1 and 2.
- Records with the same number share the load; neither is a backup of the other.
- While the primary server answers, no mail goes to the higher number. That second server can be a backup MX that accepts and holds mail while the primary is unreachable. More detail: MX priorities and multiple mail servers.
How to add an MX record
- Sign in to the console that manages your domain's DNS (your registrar or DNS provider).
- Add a new record and choose type MX.
- Enter @ as the name (host), or leave it empty; this means the domain itself.
- Enter the server name your email provider gives you as the value (target). Some consoles want a trailing dot, others add it themselves.
- Enter the priority your provider specifies.
- Save, then look the record up a few minutes later to confirm it.
When you change email provider, add the new MX records and then remove the old ones. If both providers' records stay, mail is split between two servers.
Lowering the MX TTL to 300 seconds a day before a migration makes the change spread faster. Raise it again once the move is done.
How to check an MX record
The easiest way is our free domain check: it shows your MX records, the IP address of every server, and your SPF, DKIM and DMARC status at the same time.
From the command line:
# Windows (Command Prompt)
nslookup -type=mx example.com
# Windows (PowerShell)
Resolve-DnsName example.com -Type MX
# macOS and Linux
dig MX example.com +shortIf you still see the old answer right after a change, it comes from caches until the old TTL runs out.
Common MX mistakes
| Mistake | Result | Fix |
|---|---|---|
| An IP address as the MX target | Many senders treat the record as invalid. | Use a server name whose A/AAAA record holds the IP. |
| The MX target is a CNAME | Not allowed by the standards; some servers will not deliver. | Point the MX at a name with its own A/AAAA records. |
| The target name has no A/AAAA record | No mail can be delivered to that server. | Add the A (and AAAA if used) record for the server name. |
| The old provider's MX left in place | Mail is split between two servers and some of it goes unseen. | Keep only the records of the provider you use. |
| No MX record at all | Senders try the address in the domain's A record (usually the web server). | Add the correct MX record; use a null MX for domains that receive no mail. |
| A single MX and a server outage | In a long outage some mail bounces back to the sender. | If you run your own server, add a backup MX. |
For a domain that never receives email you can publish a null MX (RFC 7505): a single MX record with the value “0 .” tells senders the domain accepts no mail, so they stop retrying.
Frequently asked questions
How long does an MX change take?
The new record is published at once, but the old one can stay in DNS caches for its TTL. With a TTL of 3600, everyone sees the new record within about an hour.
Can a domain receive mail without an MX record?
Without an MX record, senders try the address in the domain's A record. That is usually a web server that does not accept mail, so the messages bounce.
Do I need more than one MX record?
Cloud services such as Microsoft 365 or Google Workspace are redundant behind a single MX. If you run your own mail server, a second MX as a backup MX stops mail being lost during outages.