MailSpecto
Email verification 3 min read

MX record – how to check it and set it up correctly

The MX record tells the world which servers accept mail for your domain. One mistake in it can stop all incoming mail. We show how MX works, how to check it and which configuration mistakes are the most common.

MailSpecto Engineering Team

Mail infrastructure and deliverability

Sending server mail to company.com DNS: MX 10 mx1, 20 mx2 mx1.company.com priority 10 mx2.company.com backup (20)

1. What is the MX record for?

When someone sends a message to [email protected], their mail server asks DNS: "which servers accept mail for company.com?". The answer is the MX records (Mail Exchanger). Each contains two pieces of information:

  • priority (preference): a number; the lower it is, the more preferred the server;
  • the server name, e.g. mx1.company.com, which must have its own A or AAAA record.
company.com.   3600  IN  MX  10 mx1.company.com.
company.com.   3600  IN  MX  20 mx2.company.com.

The sending server tries mx1 (priority 10) first, and if it does not answer, mx2 (priority 20). Servers with the same priority share the traffic.

2. How to check MX records

In a Linux or macOS terminal:

dig +short MX company.com

On Windows:

nslookup -type=mx company.com

You can also check any address in the MailSpecto demo: the result shows whether the domain has MX, implicit MX or Null MX.

3. No MX, implicit MX and Null MX

SituationWhat happens to mail
MX records existMail goes to the listed servers
No MX, an A/AAAA record existsImplicit MX (RFC 5321): the sender may deliver to the address in the A record. It works, but it is rare and not recommended
Null MX: MX 0 .An explicit statement that "this domain does not accept mail" (RFC 7505). Senders reject the message right away
The domain does not existMail is rejected; the address is invalid

If a domain is only used for a website and does not receive mail, publish a Null MX. That way nobody tries to deliver mail to your web server, and spammers find it harder to use the domain as a sender.

4. The most common configuration mistakes

  • MX points to an IP address instead of a name (MX 10 198.51.100.10). An MX record must contain a host name.
  • MX points to a CNAME alias. The specification forbids it; some servers tolerate it, some do not.
  • The MX name has no A/AAAA record or points to a private address (e.g. 10.0.0.5, 192.168.1.10). Such a server is unreachable from the internet.
  • Leftovers from the old provider: after moving mail to a new service, an old MX with a lower priority stays in the zone and some mail gets lost.
  • A typo in the server name, or a missing trailing dot in a hand-written zone (mx1.company.com instead of mx1.company.com. appends the domain name a second time).
  • Too high a TTL before a migration: lower the TTL to a few minutes a day before changing mail providers, so the new records take effect quickly.

5. MX and address verification

The MX record is the first level of checking whether an address can receive mail. MailSpecto verification reads MX, checks implicit MX and Null MX, rejects servers on private addresses, and then asks the listed server about the specific mailbox (see How to check whether an email address is valid). The domain audit in the panel checks MX together with SPF, DKIM and DMARC.

  1. MX points to host names, not IP addresses or CNAME aliases.
  2. Every MX name has a public A or AAAA record.
  3. After a mail migration, remove the old MX records.
  4. A domain without mail has a Null MX (MX 0 .).
  5. Lower the TTL before changing mail providers.

Keep your contact list clean

Verify email addresses before you send, and explore our upcoming SPF/DKIM/DMARC diagnostics module.

Try MailSpecto

MailSpecto Engineering Team

We build tools for email address verification, deliverability monitoring and mail infrastructure security diagnostics for companies in Poland and Europe.

Related articles

Email verification

Role-based addresses (office@, info@) in B2B – send or not?

What role-based addresses are, why they are risky in campaigns and when to keep them in B2B.

Read article →
Email verification

Email verification in online stores – fewer failed orders

How typos in the checkout address end in undelivered invoices, and how to catch them in the cart without losing customers.

Read article →
Email verification

How to check whether an email address is valid

Every stage of validation: syntax, DNS and MX, disposable domains, typos and the limits of SMTP tests.

Read article →