When Sendmail starts up, it probes all of your network interfaces both real and virtual.


It gathers up all your IP address information and converts that information into hostnames and then places all of that information into class w.


You can view the contents of class w by using the debugging option d0.4 on the command line.


/usr/lib/sendmail -bt -d0.4 </dev/null


When Sendmail goes to deliver a message, it looks up the mail exchange records, also called mx records, for a host or for a domain name.


When you send a message to alan@emailaddress.com, Sendmail queries the Domain Name Server for emailaddress.com and asks it for a list of mail exchange records. The emailaddress Domain Name Server returns a list of all of its mail exchange records to your MTA. Your MTA then selects the mail exchange record with the lowest cost, and tries to send the message to the host defined for that mail exchange record.


Ok, but what does a mail exchange record look like?


Well, it looks like:


yourdomain.com.    IN    MX    10    yourmailserver.yourdomain.com.


This is the super simplified example. It lists one domain, and exactly one mail server. The domain name, yourdomain.com will have all of its incoming mail sent to the server named yourmailserver.yourdomain.com. Of course later on in the DNS map will be an A record listing the IP address of yourmailserver.yourdomain.com.


There are three cases when Sendmail will not query a DNS server for MX records.


The first is when a hostname is enclosed in square brackets.


The second is when a delivery agent in your sendmail.cf file has the option, F=0 defined.


The third is when your /etc/nsswitch.conf file does not have dns listed in it.


Does emailaddress.com have more than one MX record? Probably. So what happens in that case?


Well, after your MTA gets a list of all of emailaddress's mx records, it sorts them by cost. Lowest cost goes to the top of the list. If there is more than one record with the same cost, they are added to the list in a random order. So if you have the following:


yourdomain.com.    IN   MX    10      yourmailserver.yourdomain.com.
yourdomain.com.    IN   MX    20      othermailserver.yourdomain.com.
yourdomain.com.    IN   MX    20      someothermailserver.yourdomain.com.
yourdomain.com.    IN   MX    30      notamailserver.yourdomain.com.


Then your MTA would create the list of mx records as follows:


yourmailserver.yourdomain.com goes first since it has the lowest cost.


Then either othermailserver.yourdomain.com or someothermailserver.yourdomain.com will be added to the list and then the other one will be added. This is totally random since their cost is the same.


Finally notamailserver.yourdomain.com is added to the list since it has the most expensive cost associated with it.


After this list is created, Sendmail adds the FallbackMXhost to the bottom of the list if you added one to your sendmail.cf file.


After that, the hostname of the recipient is added to the list if it exists.


Then the message is sent to each host in the list one at a time until it succeeds or until all the hosts fail to receive the message. If all the hosts fail to receive the message then the message is queued for retry at a later time. The message stays in the queue until the timeout occurs that removes the message from the queue and discards the message. Sendmail will keep trying to send message before that discard timeout happens.


Sendmail will only do DNS lookups for IPv6 if you included support for NETINET6 when you compiled Sendmail.


If you're trying to resolve IPv6 MX records and your keep getting, temporary failure (SERVFAIL) errors, add the following to your .mc file:


define(`confBIND_OPTS',`+WorkAroundBrokenAAAA')


Then send a message to the postmaster of the site informing them that they need to fix their DNS server.


For your DNS server, the faster your server returns the information that the other MTA is looking for; the faster your site will receive its mail. This will also reduce your traffic load, CPU resources, etc. as less time is spent looking up DNS records on your DNS server.


Sendmail performs host name canonifications by using host name lookups. This process is meant to replace unqualified host name with qualified host names, and CNAMEs with the non-aliased name. However, these lookups can take a while for large address lists, e.g., mailing lists. If you can assure by other means that host names are canonical, you should use


FEATURE(`nocanonify', `canonify_hosts')


in your .mc file. If sendmail is invoked directly to send e-mail then either the -G option should be used or


define(`confDIRECT_SUBMISSION_MODIFIERS', `C')


should be added to the .mc file.


To lookup mx records using nslookup use:


nslookup


set type=mx


hostname or domain name


The results will be sent to your screen.


Next Section: Command Line Options - 30 of 32



This Web Site Copyright © 1997 - 2008
by Alan Pae - All Rights Reserved