DigiCert KnowledgeBase - Technical Support-hero

Knowledge Base

MX Record

Solution ID : SO104
Last Modified : 10/21/2023

What is an MX Record?

MX, or Mail Exchange, records are used by mail servers to determine where to deliver email.

MX records must be used in conjunction with A records. The A record will point to the mail server(s). When another mail server wants to communicate with your mail server, it will look for an MX record. That MX record must point to the A record which points to the mail server’s IP address.

(MX record points to the mail A record)

If an MX record is missing for the domain, then the mail for the domain will normally be attempted to be delivered to the matching A record. So for the domain “yourdomain.com” if there were no MX records for “yourdomain.com” then the mail would be attempted to be delivered to the apex/root record of “yourdomain.com”.

MX Record Failover

MX records do not support DNS Failover, however, they have a sort of failover service built-in. You’ll notice that when you create an MX record you have the option to set an MX Level for the record. 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 have 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 an 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 to the mail server at level 30.
  • If the mail servers at levels 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 set up a round-robin configuration for your email.
  • The sending email server will not send emails to both email servers.


How to Set Up MX Records

1. Navigate to Managed DNS

2. Select your Domain 

3. Click the Plus Button
Under the MX records section, click the + icon to add a new MX record. 

4. Enter your desired record values
Please note the tooltip at the top of the page. This helps envision how the data populated in the fields will resolve.
Notice with the root record, we leave the name field blank.

  • 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 an 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 in 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.
  • TTL: The TTL (Time to Live) is the amount of time your record will stay in a cache on systems requesting your record (resolving nameservers, browsers, etc.). The TTL is set in seconds, so 60 is one minute, 1800 is in 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 or 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. Whereas a very high TTL can cause downtime when you need to switch your IPs quickly.

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.
  • Click Submit
    You can also create MX records that point to external providers. Here we will create a higher priority MX record that points to a backup DNS Made Easy mail server. If mail.example.com is offline or not accepting email, mail will be sent to mx1.dnsmadeeasy.com.

Examples

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:

A record: For the A record configuration explanation please read more on 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 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): 1800 indicates how often (in seconds) 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 an email to username@example.com it will be delivered to the email server at the IP 192.168.1.2.


Advanced MX record configuration with email in the same domain and a 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. 30


Configuration:


A record: For the A record configuration explanation please read more on 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: 1800 indicates how often (in seconds) this record will exist (will be cached) in other systems.
  • Name 2: Same as the 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: 1800 indicates how often (in seconds) 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: 1800 indicates how often (in seconds) this record will exist (will be cached) in other systems.