Skip to main content


Home DNS MX record

DNS MX record

(also MX record, mail exchange record)

What is DNS MX record?

A DNS MX (or mail exchange) record is a type of DNS record that specifies the mail servers responsible for receiving incoming email messages. In other words, a DNS MX record points to the IP addresses of a specific mail server’s domain so that the emails reach the appropriate mail server. A DNS MX record can also differentiate email and web servers, making it useful for people who host their emails or lease emails. A DNS MX record specifies how emails are supposed to be routed. It functions in accordance with SMTP (Simple Mail Transfer Protocol), which is the standard email protocol that virtually all emails use. Also, a DNS MX record always needs to point to a domain for the transfers to be successful.

See also: web server security, DNS cache, DNS filtering, DNS record

What type of information is contained in a DNS MX record?

A DNS MX record contains the hostname of the mail server designated to handle email for the domain and a priority value. The priority determines the order in which mail servers are contacted when multiple servers are listed.

What is the MX record priority order?

The MX record priority order is determined by the priority value assigned to each mail server, with lower values indicating higher priority. Mail servers with the lowest priority number are tried first, and if they are unavailable, servers with higher numbers are used in sequence. This ensures redundancy in case of server failure.

Mail exchange record examples

Imagine you're sending an email to someone@example.com. Your email server would look up the MX records for example.com. Those records might look something like this:

  • example.com. 3600 IN MX 10 mail1.example.com.
  • example.com. 3600 IN MX 20 mail2.example.com.

This tells your email server that it can deliver the email to either mail1.example.com or mail2.example.com, but it should try to deliver it to mail1.example.com first because it has a higher preference value.

These records would typically be managed by whoever administers the domain, usually through a control panel provided by the domain registrar or DNS provider. It's important to have correct and up-to-date MX records to ensure that emails are delivered properly.

The DNS MX record process

  • An email user writes an email, clicks “send,” and the email client forwards the email to a server.
  • The sending MTA (message transfer agent) sends a DNS request so that it can identify the DNS MX record.
  • The DNS MX record specifies which email server is the appropriate destination for the email.
  • The sending MTA establishes an SMTP connection with the email server that was specified.
  • The email is delivered to the recipient.