Background

The 'MX' Resource Record (RR) defines the mail servers for the domain. There may be zero or more MX RRs defined for a domain. If the domain does not provide email services, there is no need for any MX RRs. An MX RR may reference a mail server in the domain or in a foreign or external domain.


Details

RR Type: MX
ID: 15 (0x000F)
Defining RFC: RFC 1035,  Section 3.3.9,  Page 17 and RFC 7505
Description: Mail Exchange Record
Function: Maps a domain name to a list of message transfer agents for that domain.
Status: Active

'MX' RR Syntax

name ttl class type rdata {preference, exchange}

RR Field Example Description
name By default, DNS uses the parent domain name when creating a Mail Exchange record. You can specify a host or child name, but in most deployments, the field is left blank.
ttl This is the records time to live value (in seconds). If there is no TTL specified, the zone's default $TTL Directive will be used.
class IN Specifies the class to be 'Internet'.
type MX Specifies the RDATA field will contain data in the MX RDATA format.
rdata preference 10 A 16 bit integer between 0 and 65535 which specifies the relative preference or priority given to this RR among others at the same domain.
Lower values are preferred.
exchange mail.yourdomain.com. A fully qualified domain name (FQDN) which specifies a host willing to act as a mail exchange for the domain.

Examples

Snippets from a fictitious forward lookup 'yourdomain.com' zone file

Typical 'MX' Record Entry

;
;   Zone records
;
IN MX 10 mail.yourdomain.com.
mail IN A 65.22.6.79

Backup Mail Servers

To implement a backup mail server, simply add an additional MX record with a higher relative preference value to your DNS zone (aka Backup MX).

;
;   Zone records
;
IN MX 10 mail.yourdomain.com.
IN MX 20 backup-mail.yourdomain.com.
mail IN A 65.22.6.79
backup-mail IN A 173.194.207.27

Invalid Configurations

CNAME records should not be used with either NS or MX records.
Although the following example may work, its technically invalid and should be avoided.

;
;   Zone records
;
IN MX mail.yourdomain.com
mail IN CNAME server01.yourdomain.com
server01 IN A 104.16.44.99


See Also




This content was last updated on December 9, 2020
An error has occurred. This application may no longer respond until reloaded. Reload 🗙