Go to main content

Managing sendmail Services in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

How sendmail Works With Programs

Mail services work in combination with different programs. The following figure shows how the programs work together.

Figure 3  How sendmail Works

image:Diagram showing how sendmail works.

The sendmail program performs the following steps when sending a mail message:

  1. The message is sent by using a program such as mailx. For more information, see the mailx(1) man page.

  2. The message is collected by the program that generates the message, and the message is then passed to the sendmail daemon.

  3. The sendmail daemon parses the addresses (divides them into identifiable segments) in the message. The daemon uses information from the configuration file, /etc/mail/sendmail.cf, to determine network name syntax, aliases, forwarding information, and network topology. By using this information, sendmail determines the route the message must follow to get to the recipient.

  4. The sendmail daemon passes the message to the appropriate system.

  5. The /usr/lib/mail.local program on the local system delivers the mail to the mailbox in the /var/mail/username directory of the recipient of the message.

  6. The recipient is notified that mail has arrived and retrieves the mail by using mail, mailx, or a similar program.

Rerouting Mechanisms

The sendmail program supports three mechanisms for mail rerouting: aliasing, forwarding, and inclusion.

The rerouting mechanism that you choose can affect the level of administration that is required.

  • Aliasing can map names to addresses either on a server-wide basis or on a name service-wide basis, depending on the type of file that you use.

    The use of a name service alias file permits mail rerouting changes to be administered from a single source. However, name service aliasing can create lag time when the rerouting change is propagated.

    Name service administration is usually restricted to a select group of system administrators. A normal user would not be able to administer this file.

    Some considerations when using a server alias file:

    • Rerouting can be managed by anyone who becomes the root user on the designated server. Standard users cannot administer the file.

    • Server aliasing should create little or no lag time when the rerouting change is propagated.

    • The change affects only the local server, which might be acceptable if most mail is sent to one server. However, if you need to propagate this change to many mail servers, use a name service.

    For more information, see Mail Alias Files and Administering Mail Alias Files.

  • Forwarding enables users to create .forward files to reroute their incoming mail to another mailbox, a different mailer, or another mail host.

    For more information, see .forward Files and Administering .forward Files.

  • Inclusion

    Inclusion involves users maintaining alias lists instead of requiring root access. To provide this feature, the root user must create an appropriate entry in the alias file on the server. After this entry is created, the user can reroute mail as necessary. For more information, see /etc/mail/aliases File and Administering Mail Alias Files.


    Note -  Programs that read mail, such as /usr/bin/mailx, can have aliases of their own, which are expanded before the message reaches sendmail. The aliases for sendmail can originate from a number of name service sources, such as local files or NIS. The order of the lookup is determined by the svc:/system/name-service/switch service. For more information, see the nsswitch.conf(5) man page.

Mail Addresses and Mail Routing

The path that 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 another alias resolution, but the routing process is the same on most hosts.

You can set up a client system to receive mail locally by running sendmail in local mode. Local mode is the default mode for all mail servers and some clients. In local mode, a mail message is routed as follows:

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

    The mail address is expanded by checking for the mail alias in the name service. If a new value is found, it replaces the old value. The new alias is then checked again.

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

    The mail is delivered to a local mailbox.

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

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

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


Note -  The list assumes that you are using the default rule set in the sendmail.cf file.