Table of Contents

About

The MX DNS is a DNS record that defines the mail delivery smtp server. You can only use one mail exchange server at a time for a specific domain name (ie domain or subdomain).

The name of the MX record is the last part of an email address and designates the host where the email should be delivered.

When an email is send:

Set

When you add multiple MX records, the servers they point to must belong to the same service provider.

Query

You can query them. For instance, the mail server of gmail can be found with a dns client such as nslookup command or Network - dig ( DNS tool)

nslookup -type=MX gmail.com
# or
dig gmail.com MX
  • if the MX record exists
gmail.com       MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com
gmail.com       MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com       MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com
gmail.com       MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com
gmail.com       MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com

  • if the MX record does not exist, the DNS server returns the CNAME records if they exist (as specified in the reference)