Mail Administration Guide

How Mail Addressing Works

The path a mail message follows during delivery depends on the setup of the client system and the topology of the mail domain. Each additional level of mail hosts or mail domains can add one more round of alias resolution, but the routing process is basically the same on most hosts.

You can set up a client system to receive mail locally or select a remote to receive the mail for the client system. Receiving mail locally is known as running sendmail in local mode. Local is the default mode for all mail servers and some clients. If the client is mounting /var/mail from a server, then the client is running sendmail in remote mode.

Assuming that you are using the default rule set in the sendmail.cf file, the following examples show the route an email message takes.

On a mail client in remote mode, a mail message will go through the following routing process:

  1. Expand the mail alias, if possible, and restart the local routing process.

    The mail address is expanded by looking up the mail alias in the name space, according to entry in /etc/nsswitch.conf, and substituting the new value, if one is found. This new alias is then checked again.

  2. If the address cannot be expanded, forward it to the mail server.

    If the mail address can not be expanded, then there could be a problem with the address or the address is not local. In both cases, the mail server needs to resolve the problem.

  3. If the expanded alias loops back to the original address, forward the mail to the mail server.

    The process keeps a history of all of the lookups and if the original alias is generated again, the mail is forwarded to the mail server to resolve.

On the mail server or a mail client in local mode, a mail message goes through the following routing process:

  1. Expand the mail alias, if possible, and restart the local routing process.

    The mail address is expanded by looking up the mail alias in the name space and substituting the new value, if one is found. This new alias is then checked again.

  2. If the mail is local, deliver it to /usr/lib/mail.local.

    The mail will be delivered to a local mailbox.

  3. If the mail address includes a host in this mail domain, deliver the mail to that host.

  4. If the address does not include a host in this domain, forward the mail to the mail host.

    The mail host uses the same routing process as the mail server, but the mail host can receive mail addressed to the domain name as well as to the host name.