Glossary term

What is an MX record?

An MX record (mail exchanger record) is a DNS record that tells other mail servers which host accepts email for a domain. Each MX record holds a priority number and a host name; senders try the lowest number first. A domain with no MX records can still receive mail through its address record, and a domain that wants no mail at all publishes a "null MX".

Reading time
4 min

What an MX record looks like

An MX record has two parts after the type: the preference (a number, lower means preferred) and the exchange (the host name of a mail server).

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

Here, servers sending to anyone at example.com try mx1.example.com first. If it does not answer, they try mx2.example.com. The 3600 is the time to live: how many seconds resolvers may cache the answer.

How senders use MX records

RFC 5321, section 5.1, sets the order a sending server follows:

  1. Look up the MX records of the domain after the @.
  2. Try the hosts in order of preference, lowest number first.
  3. Where several records share the same preference, pick among them at random, which spreads the load.
  4. If the domain has no MX records at all, treat the domain's own address record (A or AAAA) as an implicit MX with preference 0.

The exchange must be a host name that resolves to at least one address. It must not be an alias (a CNAME): RFC 2181, section 10.3, forbids it, and RFC 5321 places it outside its scope. Point MX records at a host with its own A or AAAA record.

How to look up an MX record

On macOS or Linux, dig prints a domain's MX records with their preferences:

dig MX example.com +short

On Windows, nslookup -type=mx example.com gives the same answer. Our free MX lookup shows them in a browser and checks that each mail server has a public address. An empty answer means the domain publishes no MX records; whether it can still receive mail then depends on its address record, as described above.

Common MX mistakes

MX records and email verification

An email check starts with the domain: if no server is set up to take mail for it, no address there can receive a message. Our check reports such an address as invalid, with the reason no_dns when the domain has no records that tell senders where to deliver, or no_inbound_mail when it turns incoming mail away. A working MX record is not proof that a mailbox exists: the next step asks the mail server about the address itself, as verifying an email without sending one explains.

MX records only receive mail. Which servers may send mail for a domain is a different record, SPF: check it with our SPF checker.

Questions

Can a domain receive email without an MX record?

Yes, if it has an A or AAAA record and a mail server listens at that address: senders then use the address record as an implicit MX (RFC 5321, section 5.1). Most domains that receive mail publish MX records anyway, so the mail host can differ from the web host.

Why have more than one MX record?

For backup and load sharing. Records with a higher number take mail when the preferred hosts do not answer; records with the same number share the load. A backup host must accept mail for the same addresses as the main one, or it turns a delay into a bounce.

How long does an MX change take to work?

Resolvers that cached the old answer keep using it until its time to live runs out. Lowering the TTL ahead of a planned move, at least one old TTL before it, shortens the overlap.

Sources

How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.

Get up to 500 free credits. No card needed.

New accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service). Try it on your own list before you buy.

Updated · Maintained by: Email Validation LLC