MX records have been around since they were introduced in Internet Request For Comments (RFC) 973 in January of 1986, replacing two other DNS record types, MD (Mail Delivery) and MF (Mail Forwarding). MX stands for “mail exchanger” and simply put, establishes alternate hosts, which can be used for delivering mail to a domain. MX records have two components, a numeric preference and a host name. The host name itself must have an A (address) record.
Typically another mail server, which has received an email for a domain that it doesn’t know how to directly deliver, queries DNS for a list of MX records that match the domain of the To: address in the email. It looks for the lowest preference number and contacts that mail server via SMTP. If there are two MX records with the same preference number, any of them that share the lowest number may be used. If mail delivery is not successful with the first host, the host with the second lowest preference number is used for the next attempt at mail delivery, typically after a timeout.
All of this provides a level of redundancy and backup to ensure emails can be successfully delivered, even if one or more mail servers are inaccessible.