New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Domains and DNSUpdated 4 Nov 2026

MX record explained: what it is, priority values, how to check and how to set it

An MX record tells the internet which mail servers accept email for your domain. This guide explains priority values, how to look up MX records with dig and nslookup, how to set them correctly and how to fix common errors.

KM
Written by Kwame Mensah
Billing and Account Specialist
Reviewed by Ishita Rao
  • Published1 Jul 2024
  • Read time7 min
  • Length1,338 words
Share this guide

An MX record (mail exchanger record) is a DNS record that names the servers that accept incoming email for a domain. When someone sends a message to [email protected], their mail server looks up the MX records for example.com and delivers to the host with the lowest priority number first, falling back to the others if it is unavailable. Without a working MX record, a domain generally cannot receive mail reliably.

Each MX record has two parts: a priority (preference) number and a hostname. The hostname must itself resolve to an IP address through an A or AAAA record. MX records control only where incoming mail goes. They do not affect where you send from, which is governed by SPF, DKIM and the sending server's IP address.

PurposeTells senders which servers receive mail for the domain
PriorityLower number means higher priority; equal numbers share load
TargetA hostname with A or AAAA records, never an IP address and never a CNAME
ScopeIncoming mail only; it does not authenticate outgoing mail

How an MX record looks

example.com.   3600   IN   MX   10   mx1.mailhost.example.
example.com.   3600   IN   MX   20   mx2.mailhost.example.
FieldMeaning
example.com.The domain receiving mail. In many DNS panels the host field is shown as @ for the root
3600TTL in seconds: how long resolvers may cache the answer
MXRecord type
10Priority (preference)
mx1.mailhost.example.The mail server hostname; the trailing dot marks a fully qualified name

Panels differ. Some ask for the hostname with a trailing dot, some add it for you, and some append your domain if you omit it. Entering mx1.mailhost.example in a panel that appends the domain can produce mx1.mailhost.example.example.com, which is a common cause of mail failing. Check the saved result after you save. See registrar quirks.

How priority values work

The number is only a ranking. A sending server sorts the MX records by priority and tries the lowest first. If it cannot connect, or the server returns a temporary failure, it moves to the next. Records with the same number are equal, and senders spread attempts among them, which gives simple load sharing. The absolute value has no meaning, so 10 and 20 behave the same as 1 and 2.

SetupExampleBehaviour
One server10 mx.host.exampleAll mail goes there; if it is down, senders queue and retry
Primary and backup10 primary, 20 backupBackup used only when the primary fails. See backup MX risks
Equal priority10 mx1, 10 mx2Senders spread mail between both
Hosted provider setProvider specific valuesCopy exactly what the provider gives you

A backup MX that does not validate recipients can accept mail for addresses that do not exist and then bounce it later, which creates backscatter. Only add one if you know how it behaves, and remember that senders retry for days anyway.

How to check MX records

# Linux and macOS
dig +short MX example.com

# Query a specific resolver
dig +short MX example.com @1.1.1.1

# Windows and cross-platform
nslookup -type=MX example.com

# Confirm the target resolves
dig +short A mx1.mailhost.example
dig +short AAAA mx1.mailhost.example

The output lists priority and hostname, for example 10 mx1.mailhost.example.. Check three things: the right provider's hostnames are present, no old records remain, and every hostname has an A or AAAA record. If your results differ from the panel, you may be seeing a cached answer. Compare with an authoritative query, dig MX example.com @ns1.yourdns.example, using a nameserver from dig NS example.com. For wider DNS context see DNS records for email.

How to set MX records

  1. Get the exact MX hostnames and priorities from your mail provider. Do not guess or reuse an old provider's values.
  2. Open the DNS zone of your domain at the registrar or DNS host. Make sure you edit the zone that your nameservers actually serve.
  3. Delete the old MX records unless the provider says to keep them. Leftover records from a previous provider cause mail to split between two systems.
  4. Add each new record: type MX, host @ (or blank), the priority and the hostname. Set a TTL of 3600 or the provider's recommendation.
  5. Save, then verify with dig MX and a test message from an outside account. See adding DNS records at common DNS hosts.

Lower the TTL a day before a planned migration so changes take effect sooner, and raise it afterwards. See DNS TTL for email. Provider values for hosted mail change from time to time, so always take them from the provider's current documentation. For Google Workspace and Microsoft 365, see their MX records.

What happens when a sender looks up your MX

  1. The sending server asks DNS for the MX records of the recipient's domain.
  2. It sorts them by priority and resolves each target hostname to IP addresses.
  3. It connects to the first address on port 25 and starts the SMTP conversation with EHLO.
  4. If the connection fails or the reply is a temporary 4xx, it tries the next address or MX record, and later retries the whole list.
  5. If the reply is a permanent 5xx for the recipient, it stops and sends a bounce to the sender.

This is why a single missing A record or a typo in one MX hostname may not break everything immediately: mail flows through whichever entry works, and the fault shows up as delays or uneven delivery. Test every MX host individually. A short script that loops over the output of dig +short MX and runs a port 25 check on each host is a useful periodic monitor, as is alerting when the record set changes unexpectedly, because MX changes are a common step in domain hijacking.

Rules every MX record must follow

  • The target must be a hostname, not an IP address.
  • The target must not be a CNAME. RFC 2181 forbids pointing MX at an alias, and some senders fail on it. See CNAME versus A records.
  • The target needs an A or AAAA record that resolves publicly.
  • The server on that host must accept SMTP on port 25 from the internet and handle mail for your domain.
  • If no MX record exists, senders fall back to the domain's A or AAAA record as an implicit MX. This works, but is better avoided because it is unclear and fragile.
  • A domain that must never receive mail can publish a null MX, 0 ., defined in RFC 7505, which tells senders to stop immediately. See parked domains.
example.net.   3600   IN   MX   0   .

MX records and sending

MX records do not authenticate outgoing email. Receivers check SPF, DKIM and DMARC for that, and they check the sending IP's reverse DNS. Some systems also verify that the sender's domain has an MX or address record before accepting mail from it, which is why a domain that only sends should still have valid DNS. See sender domain not found errors and authenticating your sending domain.

Troubleshooting MX problems

SymptomLikely causeFix
Mail bounces with domain not found or no MXNo MX or A record, or wrong zone editedAdd MX records to the zone served by your nameservers
Some mail goes to the old providerOld MX records still present, or cachedRemove them and wait for the old TTL to expire
Delivery fails with 5.4.4 unable to routeMX target does not resolveFix the A or AAAA record of the target
Mail delayed for hoursPrimary down and backup misconfiguredTest each MX host on port 25. See email delay causes
Wrong hostname like host.example.example.comDNS panel appended the domainEdit the record and check the saved value
Dig shows records, mail still failsServer not accepting the domain, or port 25 blocked inboundTest with swaks. See command line SMTP tests

Next steps

After the MX records are right, publish SPF, DKIM and DMARC for the domain, set reverse DNS on any servers you operate and test inbound and outbound mail. You can verify your records with the SPF, DKIM and DMARC checker. A shorter overview of the same topic is in MX records in brief.

Sending from your domain too? Verify the domain and send through authenticated SMTP on ports 587 or 465, separate from your inbound MX setup.

Explore the SMTP relay

References and further reading

Frequently asked questions

What is an MX record?

It is a DNS record that lists the mail servers responsible for receiving email for a domain, each with a priority number.

What does MX priority mean?

Senders try the lowest number first and move to higher numbers if it fails. Equal numbers share mail between servers.

How do I check my MX record?

Run dig +short MX yourdomain.com or nslookup -type=MX yourdomain.com, and confirm the hostnames and priorities match your provider.

Can an MX record point to an IP address or a CNAME?

No. It must point to a hostname that has an A or AAAA record, and it must not be an alias.

Do I need an MX record to send email?

Not strictly, but a domain should have valid DNS, and you need MX records to receive replies and bounces on that domain.

Topics#mx record#dns#email routing#priority#dig
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales