Sendmail Foundations

by Mike on November 7, 2008

in Sendmail Mail Server

Sendmail is built upon three basic foundations.

Foundation #1: Configuration Files
When sendmail starts it will read two major files, /etc/sendmail.cf for managing email addresses, spam and mail transfer and /etc/submit.cf for managing outgoing mail. The configuration files are the heart of the sendmail program. All of the configurations for the server to function correctly including; file locations, permissions, and modes of operation are included in these files. The configuration files include rules and rulesets for sendmail to use in operation. These rules and ruelsets can drive you nuts at first glance. They seem very complex. Part of the complexity is that the information in these rulesets is designed to be read quickly by sendmail so they are written for the program not for humans to read. However, with a little training writing and understanding this configuration file can be a rewarding experience.

The configuration of sendmail.cf is reduced to /etc/sendmail.mc. This file which is made up of macros will help you more easily define the sendmail.cf configuration. You will configure the sendmail.mc and then use make to compile a new sendmail.cf file. The sendmail.mc file is made up of macros, the most basic being dnl which is used as a comment line and is not read by m4. The sendmail.mc file creates changes to the sendmail.cf file by using the include directive which directs sendmail to read a file and place the information from the file in a specific location in the sendmail configuration. The define directive is used to enable specific features that you may need in your sendmail.cf file or to set file paths. The FEATURE directive is the main method of setting up aspects of sendmail that you would like to use. The DAEMON_OPTIONS in a sendmail.mc file works with the daemon that is active with sendmail SMTP.

Foundation #2: The Queue
The queue holds mail until it can be delivered to the appropriate user. The queue is used when the the destination is not available because the destination server is down for some reason or the recipientĀ“s mailbox is full. The messages that are held are placed in the mqueue where they wait to be delivered. The queue may be used when the sending of the message is delayed until a connection can be made by the sendmail server as it may be delayed because the server may be set to send mail every 15 minutes for example. The queue may be used when sendmail is configured to use the queue as a storage location until the delivery of mail is assured.

Check the Mail Queue
The command mailq provides information about the mail that is waiting to be delivered and is sitting in the queue.

# mailq
/var/spool/mqueue is empty
Total requests: 0

Foundation #3: Aliases
Aliases allow mail to be sent to one email address and redirected to another address. By default sendmail has two specific aliases, postmaster and MAILER-DAEMON. RFC822, an Internet standard, requires that postmaster not only exists but is delivered to a human. In addition, aliases provide a way to pipe addresses through a program for sending mailing lists for example.

Previous post:

Next post: