Installing and Administering Internet Services

Chapter 4 141
Installing and Administering sendmail
How sendmail Works
;name ttl class MX preference mail exchanger
bling IN MX 0 bling.paf.edu.
IN MX 20 wheo.paf.edu.
IN MX 30 munch.pag.edu.
Ordinarily, mail for bling will go directly to bling. However, if bling is
down, or if the sending host cannot connect to bling, sendmail will
route mail for it to wheo. If wheo is also down or unreachable, sendmail
will route the mail to munch. Naturally, for this to be useful, wheo and
munch must be able to route mail to bling.
Assuming that the host and its mail exchangers see the same MX data
from the name server, each host that has MX records should have an MX
record for itself, and the preference on its own record should be the
highest (that is, the lowest number) in the list.
The following example relays messages through a gateway:
;name ttl class MX preference mail exchanger
*.nz. IN MX 0 gw.dcc.nz.
Messages addressed to hosts in the nz domain will be relayed to the host
gw.dcc.nz. Courtesy suggests that you seek permission from the
administrators of hosts not under your own control before relaying mail
through them.
MX Failures. Several possible failures are associated with MX
configuration:
The name server query for MX records fails.
The query fails because no MX records exist for the target host or
because the name server is not running. You can set the
TryNullMXList option in the /etc/mail/sendmail.cf file if you
want sendmail to always try to connect to the host to which the
message is addressed (see “MX Records” on page 139).
If the query fails temporarily (that is, h_errno is set to TRY_AGAIN)
the message will be queued. The possible values of h_errno are
documented in the header file /usr/include/netdb.h.
Connection attempts to the hosts in the MX list all fail.
sendmail reports the failure attempting to connect to the last MX
host (that is, the highest preference value) in the list that it tried. For
example, with mail exchangers configured as in the paf.edu example
earlier, if the attempts to connect to bling and wheo result in