"Mail exchange" is just another name for the machine whose primary function is receiving and sending email. Also known as mailhost, mailhub, or even postoffice, this machine usually has a mail server (software written specifically for distributing files) listening on port 25 to receive incoming email.
A Mail Delivery Agent (MDA) is the "postal worker" software that looks at the address and either drops it into the local user's mailbox or tosses it back on the "truck" for delivery elsewhere. In other words, the MDA reads the header and decides whether it needs to be put in a mailbox on its own machine or sent back out over the Internet to a remote machine.
An MX (Mail eXchange) record will redirect email sent to any user's machine ([email protected], for example) to a designated mailhost. It tells the MDA where to route email.
The MX record uses preference values to specify the routing order--low value = high priority. In the example below, when mail is sent to norbert.dept1.cornell.edu the MDA (see Mail Delivery Agent above) tries to reroute the mail to mailhost.dept1.cornell.edu which has the lowest value, and therefore the highest priority. If that fails, it tries mailhost2.dept1.cornell.edu and finally mailhost3.dept1.cornell.edu.
norbert.dept1.cornell.edu | 86400 | A | 128.253.180.254 | ||||||
norbert.dept1.cornell.edu | 86400 | MX | 10 | mailhost.dept1.cornell.edu | |||||
norbert.dept1.cornell.edu | 86400 | MX | 20 | mailhost2.dept1.cornell.edu | |||||
norbert.dept1.cornell.edu | 86400 | MX | 30 | mailhost3.dept1.cornell.edu |
These records can be added on the host page for norbert.dept1.cornell.edu.
An MX record can exist for a host that is not registered or no longer registered. For example, if people have become used to sending email to Joe at [email protected], and the host norbert dies or is decommissioned, Joe can still receive mail at his old address if you retain an MX record for norbert that redirects the mail to a new address. We recommend this option be used sparingly because it may cause confusion in users who don't have understand how mail to a non-existant host can still be delivered.
A domain MX record will redirect mail sent to [email protected] to a designated mailhost. The MX record is attached only to the domain name (dept1.cornell.edu). If a host exists with the same name as the domain, a "dangling" MX record is created which is not attached to any existing host. In either case, mail directed to the domain name is redirected to the mail exchange defined in the MX record. This does not effect mail sent directly to individual hosts in the domain..
For example, if a domain MX exists for dept1.cornell.edu, with a mail exchange of mailhost.dept1.cornell.edu, then mail to [email protected] will be delivered to [email protected]
A domain-wide MX record gets attached to every registered host in the domain. This function allows mail to be delivered to a central mailhost when incorrectly configured hosts may direct the reply mail back to the local machine. Some administrators discourage the use of incoming sendmail service on individual machines as this has been historically a method for system compromise. Frequently, sendmail is turned off on individual machines and mail is redirected back to a more secure central mailhost. Since users may have published a local version of their email address, it is important to redirect the email to prevent a break in mail service.
For example, if a domain-wide MX record exists for dept1.cornell.edu, with a mail exchange of mailhost.dept1.cornell.edu, then mail to [email protected] will be delivered to [email protected].