Knowledge Base/Domain Name Management/DNS

What is an MX record?

Jeremiah Stanley -
posted this on March 2, 2012, 10:39 AM

The MX record defines how email will be routed for your domain. These are read by mail servers to determine where to send messages to, but not directly. MX records require that you point them at a hostname not an IP address. With many hosting plans your web server and your mail server are the same physical device; it is not required that this be the case however. Let's take a look at a quick example. We'll need to establish an A record first, then we can define an MX record to associate with it.    IN    A    IN    MX    10

In this example we have established a host name for the bare record and given it the address Since we can't set an MX record to be just an IP, we reference it with the second record. You'll notice the number 10 in there however. This is what is known as priority, and the lower the number the more important the record is.

You can have many MX records for a domain. The mail server will attempt to contact them in numeric order starting at the lowest number. This lets you set up multiple values if you need more than one nameserver. If you had two records with the same value it will choose between them randomly for which record gets used. And if a lower valued record isn't available the next highest value will be used. Often times higher values are configured to only save the messages and then forward them on to the lower values when they come available again.    IN    MX    1   IN    MX    5   IN    MX    5   IN    MX    10    IN    MX    10

With this example we see the values that Google suggests to use with their Google Apps service. You can see the cascading priority values all the way down to one.

Trivia: MX stands for Mail eXchanger.

Topic is closed for comments