How sendmail Uses DNS

The sendmail program uses DNS in several different ways:

  • When sendmail first starts, it might use DNS to get the canonical name for the local host. That name is then assigned to the $j macro ($j on page 830).[151] If DNS returns additional names for the local host, those names are assigned to the class $=w ($=w on page 876).

  • When sendmail first starts, it looks up the IP address or addresses assigned to each network interface. For each address it finds, it uses DNS to look up the hostname associated with that address.

  • When another host connects to the local host to transfer mail, the local sendmail looks up the other host with DNS to find the other host’s canonical name.

  • Before accepting mail, sendmail can look up the IP address of the connecting host on various blacklist sites (How DNSBL Works on page 260). If that address is listed, the message is rejected.

  • To relay based on MX records (FEATURE(relay_based_on_MX) on page 271), sendmail does a lookup to determine whether the connecting host is listed as an MX server for the local domain.

  • When delivering network SMTP mail, sendmail uses DNS to find the address (or addresses) to which it should connect.

  • When sendmail expands $[ and $] in the RHS of a rule, it looks up the hostname (or IP address) between them.

We discuss each of these uses later in this chapter.

[151] * Prior to V8 sendmail, the canonical name was stored in the $w macro ($w on page 850) and sendmail initialized only the $j macro ($j on page 830). Beginning ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.