DNS Record Types

MX Record

MX Record (Mail Exchange Record)
These records is used by mail servers to determine where to deliver email. MX records should only map to A records (not CNAME records). If an MX record is missing for the domain the mail for the domain will normally be attempted to be delivered to the matching A record. So for the domain “example.com” if there were no MX records for “example.com” then the mail would be attempted to delivered to the apex / root record of “example.com”.

Name: This is normally always left blank for MX records. This will be the host for your domain which is actually a computer within your domain. Your domain name is automatically appended to your name. So if you leave it blank it will be the instructions on where to send email for your domain (ie. username@example.com).

Server: This will be the host (the mail server) that will accept mail for the host that is specified in the name field. Your domain name is automatically appended to your value if it does not end it a dot.

MX Level: The MX level determines the order (which mail server) that your mail will be attempted to be delivered. The mail server with the lowest MX level will first be attempted to have the email delivered.

So if you hade three MX records with levels 10, 20, 30 the following would occur:
Mail would always be first tried to be delivered to the MX record with MX Level of 10. If that mail server is down then the mail will try to be delivered to the mail server at 20. If the mail server at level 20 is down then the mail will be attempted to be delivered at the mail server at level 30. If the mail servers at level 20 and 30 are backup mail servers then the mail will be delivered to the mail server at level 10 when it comes back online.If you have multiple MX records with the same MX level then it will setup a round robin configuration for your email. The sending email server will not send email to both email servers.

TTL: The TTL (Time to Live) is the amount of time your record will stay in cache on systems requesting your record (resolving nameservers, browsers, etc.). The TTL is set in seconds, so 60 is one minute, 1800 is 30 minutes, etc..

Systems that have a static IP should usually have a TTL of 1800 or higher. Systems that have a dynamic IP should usually have a TTL of 1800 of less.

The lower the TTL the more often a client will need to query the name servers for your host’s (record’s) IP address this will result in higher query traffic for your domain name. Where as a very high TTL can cause downtime when you need to switch your IPs quickly.

Best Practice Tip
If you plan on changing your IP you should set your TTL to a low value a few hours before you make the change. This way you won’t have any downtime during the change. Once your IP is changed you can always raise your TTL to a higher value again.

Example 1 – Simple MX record within the same domain:

NAME TTL TYPE DATA MX LEVEL
mail1.example.com. 1800 A 192.168.1.2
example.com. 1800 MX mail1.example.com. 10

Configuration:

1

2

A record: For the A record configuration explanation please read more in the A – Data Entry page.

MX record details:

  • Name: example.com. is the host which we are making the MX rule for. In the data entry screen we leave the name field blank for the base domain.  For most MX record configurations the name is left blank.
  • Server: mail1.example.com. is the server that will accept email for example.com..  Since the domain name is appended to the end of the server value you just need to enter mail1.  If your mail server is in a domain that is outside your domain then you will want to append your FQDN with a dot (see the next example).
  • MX Level: 10
  • TTL (time to live): The 1800 indicates how often (in seconds) that this record will exist (will be cached) in other systems.
  • The end result of this record is that email for example.com. will go to mail.example.com which is located at 192.168.1.2.  So if you send email to username@example.com it will be delivered to the email server at the IP 192.168.1.2.

 

Example 2 – Advanced MX record configuration with email in same domain and different domain:

NAME TTL TYPE DATA MX LEVEL
mail1.example.com. 1800 A 192.168.1.2
mail2.example.com. 1800 A 192.168.1.4
example.com. 1800 MX mail1.example.com. 10
example.com. 1800 MX mail2.example.com. 20
example.com. 1800 MX mail100.backupexample.com.

Configuration:

3

4

5

6

7

A record: For the A record configuration explanation please read more in the A – Data Entry page.

MX record details:

  • Name 1 : example.com. is the host which we are making the MX rule for. In the data entry screen we leave the name field blank for the base domain.  For most MX record configurations the name is left blank.
  • Server 1: mail1.example.com. is the server that will accept email for example.com..
  • MX Level 1: 10
  • TTL (time to live) 1: The 1800 indicates how often (in seconds) that this record will exist (will be cached) in other systems.
  • Name 2 : Same as previous MX record.
  • Server 2: mail2.example.com. is the server that will accept email for example.com..
  • MX Level 2: 20 – Since this is the second lowest MX level this email server will be tried second (after the lowest MX record which is set at MX level 10).
  • TTL (time to live) 2: The 1800 indicates how often (in seconds) that this record will exist (will be cached) in other systems.
  • Name 3 : Same as previous MX record.
  • Server 3: mail1.example.com. is the server that will accept email for example.com..
  • MX Level 3: 30 – Since this is the third lowest MX level this email server will be tried third.
  • TTL (time to live) 3: The 1800 indicates how often (in seconds) that this record will exist (will be cached) in other systems.
  • The end result of these records determine where the email for example.com. is delivered.  At first the sending email server will send email to mail1.example.com. (at IP 192.168.1.2).  If that email server is unreachable it will try to send email to mail2.example.com. (at 192.168.1.4).  If that email server is not reachable then the sending email server will then try to send email to the final email server (at level 30) which is mail100.backupexample.com..