close button

What are MX Records?

Published by

Previously in our series about DNS, we had a broad overview of how the domain name system works, and what a DNS server is. This time we’ll take a look at what MX records are and what they are used for.

What are MX records?

If you’ve ever gone through the process of registering a domain and getting your business online, you may have come across the term MX record before. MX records are a piece of the DNS that allows a domain to receive email. So if you’ve recently registed your new business domain mywidgets.info and you want to set up an email address sales@mywidgets.info, then you (or your technical help) is going to have to deal with MX records at some point.

What does MX record stand for?

The MX in MX record stands for Mail eXchanger.

How do MX records work?

An MX record is basically an entry in the DNS for a domain, that specifies what email server or computer will handle email for that domain.

It’s not uncommon for multiple mail servers to be specified to handle the email for a domain, so each MX record also includes a priority, to determine what order to try each of the mail servers. Multiple mail servers offers robustness and redundancy, to ensure that the email service is always up and running.

What do MX records look like?

[image of domain/zone control panel idomains?]

MX records contain the following fields:

  • Name: The domain name
  • Class: This value is always set to IN (which stands for Internet)
  • Type: Always set to MX for MX records
  • TTL: Time To Live. This sets how long in seconds it will take to update the record. A low value means it can be updated quickly, but will increase the DNS server traffic as other servers must check the records more often
  • Priority (or preference): When there are multiple records, mail servers should always try the highest priority server (i.e. the lowest number) first
  • Data: The hostname of the mailserver

So now we know the fields that make up an MX record, let’s see an example:

internet.com. IN MX 86400 1 mail.internet.com.

How do I update my MX records

Generally you will need to log into the domain registrar where the domain was registered, and from there look for DNS management or DNS Zone management or something similar. Then you should look for MX records management.

Each registrar has its own interface for changing MX records. They generally allow you to pick the domain you want to change the MX record for, and then you may be able to change some or all the fields mentioned above.

Sometimes it is possible to change the TTL value, and sometimes not. Sometimes the class and type fields will already be set, and unchangeable, and other times not.

When updating your MX records to the values required, if you can only change some of the fields, then change these to the required values, and ignore the others. Chances are the registrar has chosen sensible defaults for the remaining fields, and your mail service will work fine with no adjustment to those fields.

The interface from a popular DNS management provider is shown below.  It’s a two step process. In the first image you see a list of current MX records.

In the next image, you see the actual MX record editing screen. Note there only four of the seven fields mentioned above above are editable:

update-mx-record-godaddy

For comparison, the interface from another popular DNS management provider is shown below. Note that the changes happen inline on this one. And while the previous interface allowed us to modify the TTL value, it isn’t possible in this interface.

update-mx-record-zoneedit

What happens after I update my MX records

Once any change is made, email will start to be routed to the new email service specified in the new MX records, and it will stop being routed to the old email service. No email will be lost, but where any individual piece of email ends up will depend on the TTL.

So that’s all on MX records for now. You should have enough information to make changes yourself, or at least be able to explain what you need to your technical help. Stay tuned for more in our series on DNS for beginners.

Related content: What is a DNS server?

Main image: gajman