Exploring MX Record

DZone 's Guide to

Exploring MX Record

Ever wonder how email works? We take a quick look at a few of the components that make this pervasive communication technology tick.

· Web Dev Zone ·
Free Resource

When you send an email, Gmail, Yahoo, or whatever your email server is will automatically know which email service to deliver your email to. It knows this via MX records. Your domain’s MX record consists of a list of mail servers that tell email services like Gmail where to deliver your incoming mail to. That’s pretty much it. It’s just like being listed in a virtual directory book, where your email address is your name, your MX record is your phone number, and the Internet itself is the book.

MX record (Mail Exchanger record) is a type of DNS record that tells email services where your email is hosted, allowing you to receive emails. MX record refers to certain types of resource records (RRs) in the Domain Name System (DNS) and it is used to gather domain information from a received email. In other words, when an email is received, the sending mail transfer agent requests the DNS for MX records. This produces a list of host names concerning the domain name of incoming mail, as well as its set preferences. Each record involves a type identification (A, MX, NS, etc.), DNS class (Internet, CHAOS, etc.), as well as a name field and a number.

To understand MX records, one needs to understand DNS first. DNS translates domain names into IP addresses in order to facilitate network communications. For instance, if we type www.example.com into our web browser, DNS determines the domain’s IP address in order to connect to its server. When somebody sends an email to @example.com, then the sending mail server will look up the MX record in DNS by looking up authoritative name servers, as well as looking up the names of MX records in DNS to get their IP addresses. MX records contain an expiration date that indicates when the information provided should be refreshed from an authoritative name server.

The DNSInspect.com’s MX record tool allows one to run several mail servers for a single domain, which is very practical for high-availability clusters of inexpensive mail gateways as they can process hundreds of messages per second. When executing an MX lookup for a domain name, you’ll receive a list of servers and their preference numbers. Normally, you have multiple MX records assigned to every domain name. Each MX record has a priority, or a number to designate the order in which your domain name’s incoming mail servers receive your email messages. The smallest preference number has the highest priority and any server with the smallest preference number should be tried first.

dns, email, web dev

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}