2.2 Where is everything?

In this section we will be discussing the contents of the three sendmail RPMs included with Red Hat Linux. We will start with the RPM which contains the essential sendmail binaries.

2.2.1 sendmail-8.9.3-15.i386.rpm

The best way to the RPMs contents is to execute a simple RPM command:

rpm -qpil /path/to/sendmail-8.9.3-15.i386.rpm

    Name : sendmail                         Relocations: (not relocateable) 
    Version : 8.9.3                         Vendor: Red Hat Software 
    Release : 15                            Build Date: Wed Sep 1 09:40:39 1999 
    Install date: (not installed)           Build Host: porky.devel.redhat.com 
    Group : System Environment/Daemons      Source RPM: sendmail-8.9.3-15.src.rpm 
    Size : 540121                           License: BSD 
    Packager : Red Hat Software <http://developer.redhat.com/bugzilla> 
    Summary : A widely used Mail Transport Agent (MTA). 
    Description : The Sendmail program is a very widely used Mail Transport Agent (MTA). MTAs send mail from one machine to another. Sendmail is not a client program, which you use to read your e-mail. Sendmail is a behind-the-scenes program which actually moves your e-mail over networks or the Internet to where you want it to go.
    If you ever need to reconfigure Sendmail, you'll also need to have the sendmail.cf package installed. If you need documentation on Sendmail, you can install the sendmail-doc package. 

So now we have a complete files listing for the installation. From the beginning you can see that the first file listed is /etc/aliases. This file contains all of the mail aliases for your system. Mail aliases are used by the system to allow mail that is sent to one address to be redirected to another as well as allow mail to be piped to, or through, programs for additional processing. The defaults are suitable for your system but some parts of it you may want to modify. For example, root is not aliased in the default file so you may want to give root an alias as it's not a good idea to read or send mail as root. The alias for root can be anyone but it's a good idea that it be the person who's responsible for administering the system as the system itself will send email notifications of all kinds to the root user and it's important that this mail is read if you plan on actively maintaining the system. Anytime you make a change to the aliases file you should issue the command: newaliases to force the system to update the alias map file.

The second file listed here is /etc/aliases.db. This is the alias file which has already been mapped to database format. The command: newaliases does this for you if you make changes but the initial install has already been mapped prior to installation.

The third file listed is: /etc/mail/Makefile. This file is very, very useful as it is the command line Makefile used to do the database mapping for the next several files. The quartet of very useful files which fall under its control are the access, domaintable, mailertable and virtusertable files.

The access file is aptly named as its purpose is to control access to the sendmail daemon. It is used both to allow and deny relay access. Here are a couple of examples of what the file's entries may look like:     RELAY        RELAY
    gooddomain.net  RELAY
    baddomain.net   550 Mail from your domain is denied    550 Internet mail may not be sent from this host.

Sendmail users who have used earlier versions of Red Hat Linux may be accustomed to using other files to control this functionality but in the newer version of sendmail use of these files has been deprecated. Actually, using a single file to control access is much simpler. You just need to understand the rules for its use.

The domaintable allows an old domain to be mapped to a new one. It enables transitions from old domain names to new domain names by rewriting the old domain name to the new one.

The mailertable is a very useful hack which can help you to do some amazing things. It allows you to specify not only a domain translation (or forward) to a new domain name but you can also specify the delivery agent. Here's a sample:

    thisdomain.net  smtp:thatdomain.com

Also, if your DNS is sometimes a problem or you do not have DNS available to you, you can specify the destination by IP address like this:

    thisdomain.net  smtp:[]

The brackets used here tell sendmail not to use DNS. This can be used in many ways but direct forwards of inbound mail come to mind. If a domain's MX is located on your machine but the actual users are elsewhere this is a perfect use for the mailertable hack. Essentially, it's a very powerful tool for redirecting mail.

The final file in the quartet is the virtusertable. This file is another database but this one maps virtual domains and addresses into new addresses. Its most common use is to allow multiple accounts of the same name (but different domains) on a single host. Here is an example:

    webmaster@domain.com            bob
    webmaster@otherdomain.com       ralph

In the above example, bob is a local user who will receive mail addressed to webmaster at one domain and ralph is also a local user who will receive mail sent to webmaster at a different domain both of which may be hosted on the same box. The address on the right could also be a remote address. In this way you could allow multiple people to be "webmaster" for email purposes and yet all of their mail will remain separate.

The next eight files:


are all scripts for starting sendmail in the various run-levels. They are followed by the three primary configuration files for sendmail:


The sendmail.cf file is the running config file. This file is read when sendmail is started, -HUP'd, or restarted via its initscript. The sendmail.cf file is normally created using the m4 macro preprocessor. The "source code" m4 uses to create the sendmail.cf file is in the sendmail.mc file. The ".mc" file extension means that this is a macro configuration file. The default sendmail.mc file for sendmail that is shipped with Red Hat Linux is listed above in Section 1.5. We will cover this in greater depth later in this document.

The last file listed here is the sendmail.cw file. Quite simply this is where you list all domains, aliases, and hosts that your sendmail installation must treat as local mail. If you forget one and you or someone else tries to send mail with a from address in the omitted domain you will see an error which says something like this:

    MX list for hostname points back to hostname
    config error: mail loops back to myself

The next entry:


is the configuration directory for the sendmail restricted shell. It is empty by default.

Next up is /etc/sysconfig/sendmail. This file is used to assign some simple variables for the sendmail initialization script. By default it contains the following information:


Quite simply this information is passed to the sendmail initscripts telling sendmail to run as a daemon and that it should process its queue once an hour. Depending on your environment you may need to change these values. If you're running a 24x7 net host, you should know that the SMTP RFCs specify a minimum queue time of 5 minutes so a queue run frequency of one minute would violate the RFC specifications.

The next six entries are all binary files. They are:


These are followed by the manual pages which describe how these commands are used and then by several additional binaries.


The next file listed is the sendmail status file:


And finally the outgoing queue directory.


2.2.2 sendmail-cf-8.9.3-15.i386.rpm

This RPM contains the configuration files required if you need to create a new sendmail.mc and sendmail.cf file. Here's the breakdown:

    Name: sendmail-cf                 Relocations: (not relocateable)
    Version: 8.9.3                    Vendor: Red Hat Software
    Release: 15                       Build Date: Wed Sep  1 09:40:39 1999
    Install date: (not installed)     Build Host: porky.devel.redhat.com
    Group: System Environment/Daemons Source RPM: sendmail-8.9.3-15.src.rpm
    Size: 515799                      License: BSD
    Packager: Red Hat Software <http://developer.redhat.com/bugzilla>
    Summary: The files needed to reconfigure Sendmail.
    Description :
    This package includes the configuration files which you'd need to generate the sendmail.cf file distributed with the sendmail package. You'll need the sendmail-cf package if you ever need to reconfigure and rebuild your sendmail.cf file.  For example, the default sendmail.cf file is not configured for UUCP.  If someday you needed to send and receive mail over UUCP, you'd need to install the sendmail-cf package to help you reconfigure Sendmail.
    Install the sendmail-cf package if you need to reconfigure your sendmail.cf file.

As you can see all of these files get installed in /usr/lib/sendmail-cf/. If you plan to build macro configuration (.mc) files or sendmail.cf files on Red Hat Linux you should get used to this directory structure as it is essential to that process. As you can see by reading through what's included all of the hacks and features are included here and if you plan to do more than a default installation you will need these. It is this part of sendmail that people seem to have the most trouble with and yet, once you understand how it all works, building a configuration file with m4 is infinitely easier and much more duplicatable than directly editing the sendmail.cf file (a practice which we do not recommend and will not cover in this document).

2.2.3 sendmail-doc-8.9.3-15.i386.rpm

The third and final sendmail RPM in our trilogy contains the essential documentation for sendmail.

    Name        : sendmail-doc                 Relocations: (not relocateable)
    Version     : 8.9.3                             Vendor: Red Hat Software
    Release   : 15                      Build Date: Wed Sep  1 09:40:39 1999
    Install date: (not installed)    Build Host: porky.devel.redhat.com
    Group       : Documentation                 Source RPM: sendmail-8.9.3-15.src.rpm
    Size        : 1393365                          License: BSD
    Packager    : Red Hat Software <http://developer.redhat.com/bugzilla>
    Summary     : Documentation about the Sendmail Mail Transport Agent program.
    Description :
    The sendmail-doc package contains documentation about the Sendmail Mail Transport Agent (MTA) program, including release notes, the Sendmail FAQ and a few papers written about Sendmail.  The papers are provided in PostScript(TM) and troff formats.
    Install the sendmail-doc package if you need documentation about Sendmail.

As you can see the sendmail FAQ and other essential documentation is included here for your use. By default, the docs are installed in /usr/doc/sendmail. If you need it, the latest copy of the sendmail FAQ is always available at http://www.sendmail.org.

2.2.4 File Location Review

Now we've seen all three of the Red Hat Linux sendmail RPMs and their default file locations. Now we'll take a moment for a quick review about what's where.

Configuration files are located in /etc (sendmail.cf and aliases) and in /etc/mail (all of the map or .db files). The m4 configuration hacks and features are in /usr/lib/sendmail-cf and the documentation is located in /usr/doc/sendmail.