What Is an MX Record?

Last updated

An MX record (record type 15), short for Mail eXchange record, is a crucial type of DNS record that specifies which mail servers are responsible for accepting email messages on your domain’s behalf. MX records tell other mail servers on the internet where they should deliver your email.

Without correct MX records, email sent to your domain (e.g., you@yourdomain.com) would not know where to go, and would not be delivered. These essential directory entries guide incoming emails to their correct destination.

How MX records guide email delivery

When someone sends an email to an address at your domain, the sending mail server performs a DNS lookup for your domain’s MX records to find the designated mail exchange servers. Only if the domain has no MX records at all does the sender fall back to the domain’s A record or AAAA record. To declare that a domain does not receive email, publish a null MX record.

A domain can have multiple MX records. These records work together to ensure reliable email delivery. Each MX record includes two key pieces of information:

A priority value: This numerical value indicates the preference for using a particular mail server. Lower numbers indicate higher priority (they are preferred first).

A mail server hostname: The domain name of the mail server responsible for accepting email (for example, mx1.mail-provider.example). This hostname must resolve to an A or AAAA record to get the actual IP address of the mail server.

The sending mail server tries the server with the lowest priority value first. If that server cannot be reached or returns a temporary error, the sender tries the next lowest priority server, and so on. If a server permanently rejects the message, the sender does not try the others, and the email bounces.

Example: MX priorities

Your email provider tells you which MX records to add. Here is an example set with priorities, using placeholder hostnames:

Mail server hostname Priority
mx1.mail-provider.example 10
mx2.mail-provider.example 20
mx3.mail-provider.example 20

In this setup:

  1. A sending mail server first tries to deliver to mx1.mail-provider.example (priority 10).
  2. If that server cannot be reached or returns a temporary error, the sender tries mx2 or mx3 (both priority 20). Servers with equal priority are tried in random order, which spreads the load between them.

This lets mail keep arriving even when one mail server is temporarily unavailable.

Some providers need only one MX record. For example, Google Workspace now gives a single record, smtp.google.com with priority 1, for new setups. Older Google setups use five aspmx.l.google.com and alt*.aspmx.l.google.com records, and Google still supports those.

The behavior and format of MX records are specified in RFC 5321, Section 5.1 (for mail transfer protocol) and RFC 1035, Section 3.3.9 (for the record type).

Managing MX records in DNSimple

With DNS hosting at DNSimple, you add, remove, or update MX records and their priorities in your domain’s record editor. For the steps, see Set Up MX Records for Email Hosting.

Have more questions?

If you have additional questions or need any assistance with your MX records, just contact support, and we will be happy to help. You can also read more about email forwarding at DNSimple.