How a Mail Server Uses DNS

All SMTP mail servers that communicate with other Internet hosts use a DNS server to look up mail addresses. The basic communications between a mail server and a DNS server work as follows for incoming mail and outgoing mail.

Incoming Mail:

To illustrate how a DNS server is used to look up mail addresses, we use the example of what happens when a user on another Internet host sends mail to a user on your IMail Server host (for example to fred@domain.com).

  1. A user sends mail to your user, fred@domain.com.
  2. The sending mail server asks the DNS server on the domain.com network for the host name of the mail server. The MX (Mail eXchanger) record in DNS identifies the Host Name of the mail server.
  3. The DNS server for domain.com returns the value of the MX record, which is the host name of the mail server, in this case, mail.domain.com.
  4. The sending mail server now asks the DNS server on the domain.com network for the address of the mail server host (mail.domain.com). The A record in DNS maps the host name to an IP address.
  5. The DNS server for domain.com returns the value of the A record for the mail server host (mail.domain.com), which is the IP address (156.50.1.5).
  6. The sending mail server connects to the receiving mail server's IP address and sends the mail.

Outgoing Mail:

When one of your IMail Server users sends mail to a user on another Internet host (for example, to sam@widgets.com), the same process occurs, except that it is your mail server that does the lookups for MX and A records on the DNS server for the widgets.com network.

Reverse Lookups

Note that some mail servers, upon receiving mail, will do a "reverse lookup" on the address to make sure it is valid. This is done in an attempt to thwart bulk mailers who may be illegally using someone else's mail server to relay mail. A PTR record attempts to verify that the inbound e-mail is originating from a mail server and not a workstation. To do a reverse lookup, the receiving mail server asks the DNS server on the sending mail server's network to confirm that the IP address of the sending server matches the host name of the sending server.

Reverse lookups are enabled in DNS by creating a PTR record for the mail host. The PTR record maps an IP address to a host name.