MX record or mail exchange record carries the information that direct emails to mail servers. It indicates how emails should be routed by the simple mail transfer protocol (SMTP), and the end goal is to make sure emails are delivered to the right recipient successfully.
DNS system plays a major role in making sure an MX record can fulfil its purpose; for example, if you send an email, the DNS system will check the MX record associated with the recipient’s mailbox to determine which mail server will handle the message.
So when you send an email your email client will locate the MX records associated with the recipient domain through the DNS system.
Critical Elements of an MX Record
Mail Server
The mail server indicates the name of the host that will handle the incoming emails from a domain. For example, if the domain name is forever.com, the mail server could be mail.forever.com. It may involve multiple mail servers, but they will still work together to ensure that emails are delivered seamlessly regardless of traffic or volume.
Domain Name
The domain name is the specific domain in which the MX record is configured for example, a domain name can be example.org or example.com.
Priority
The priority is the order in which email servers will be contacted when delivering emails; it assigns a numerical value to each mx record, and lower values indicate higher priority while higher value indicates lower priority. So servers with low priority are tried first. Some email servers like Gmail set their MX record at 0 to make sure that the mail server is always given top priority in the mail routing process.
Record Type
The record is always set to MX as seen in the example above, this allows you to easily identify the records as email exchange records.
TTL (Time-to-live)
Time-to-live is the total duration for which the MX record will be cached by the DNS resolvers. When this time elapses, the resolvers will query the DNS servers again to refresh the record.