This topic describes the files that comprise the sendmail(1M) installation.
The binary for sendmail is located in /usr/lib.
It should be setuid root. For security reasons, /, /usr, and /usr/lib should be owned by root, mode 755.
This is the configuration file for sendmail.
This and /etc/sendmail.pid are the only non-library filenames compiled into sendmail. The system libraries can reference other files; in particular, system library subroutines that sendmail calls might reference /etc/passwd and /etc/resolv.conf.
The configuration file is normally created using the distribution files described in ``Configuration files''. If you have a particularly unusual system configuration, you may need to create a special version. The format of this file is detailed in ``The configuration file''.
The newaliases
command should just be a link to sendmail:
rm -f /usr/bin/newaliases
ln -s /usr/lib/sendmail /usr/bin/newaliases
This can be installed in whatever search path you prefer for your system.
The hoststat command should just be a link to sendmail, in a fashion similar to newaliases. This command lists the status of the last mail transaction with all remote hosts. The -v flag will prevent the status display from being truncated. It functions only when the HostStatusDirectory option is set.
This command is also a link to sendmail. It flushes all information that is stored in the HostStatusDirectory tree.
The directory /var/spool/mqueue should be created to hold the mail queue. This directory should be mode 700 and owned by root.
The actual path of this directory is defined in the Q option of the sendmail.cf file. To use multiple queues, supply a value ending with an asterisk. For example, /var/spool/mqueue/q* will use all of the directories or symbolic links to directories beginning with q in /var/spool/mqueue as queue directories. Do not change the queue directory structure while sendmail is running.
If these directories have subdirectories or symbolic links to directories named qf, df, and xf, then these will be used for the different queue file types. That is, the data files are stored in the df subdirectory, the transcript files are stored in the xf subdirectory, and all others are stored in the qf subdirectory.
This is a typical value for the HostStatusDirectory option, containing one file per host that sendmail has chatted with recently. It is normally a subdirectory of mqueue.
The system aliases are held in /etc/aliases.
Normally, sendmail looks at a
database version of these files
stored either in /etc/aliases.dir
and /etc/aliases.pag or /etc/aliases.db, depending
on which database package you are using. They can initially be created
as empty files, but they will have to be initialized promptly. These
should be mode 644:
cp /dev/null /etc/aliases.dir
cp /dev/null /etc/aliases.pag
chmod 644 /etc/aliases.*
newaliases
The db routines preset the mode reasonably, so this step can be skipped. The actual path of this file is defined in the A option of the sendmail.cf file.
It is necessary to start up the sendmail daemon when your system reboots. This daemon performs two functions: it listens on the SMTP socket for connections (to receive mail from a remote system) and it processes the queue periodically to insure that mail gets delivered when hosts come up.
Add the following lines to /etc/rc (or /etc/rc.local as appropriate) in the area where it is starting up the daemons on a BSD-base system, or on a System-V-based system in one of the startup files, typically /etc/init.d/sendmail:
if [ -f /usr/lib/sendmail -a -f /etc/sendmail.cf ]; then (cd /var/spool/mqueue; rm -f [lnx]f*) /usr/lib/sendmail -bd -q30m & echo -n ' sendmail' >/dev/console fiThe cd and rm commands insure that all lock files have been removed; extraneous lock files may be left around if the system goes down in the middle of processing a message. The line that actually invokes sendmail has two flags: -bd causes it to listen on the SMTP port, and -q30m causes it to run the queue every half hour.
The supported startup scripts are in: /etc/rc0.d/K68sendmail /etc/rc1.d/K68sendmail /etc/rc2.d/S81sendmail (These are links to /etc/mail/sendmailrc).
Some people use a more complex startup script, removing zero length qf files and df files for which there is no qf file. The following shows an example of a complex startup script which performs this cleanup.
# remove zero length qf files for qffile in qf* do if [ -r $qffile ] then if [ ! -s $qffile ] then echo -n " <zero: $qffile>" > /dev/console rm -f $qffile fi fi done # rename tf files to be qf if the qf does not exist for tffile in tf* do qffile=`echo $tffile | sed 's/t/q/'` if [ -r $tffile -a ! -f $qffile ] then echo -n " <recovering: $tffile>" > /dev/console mv $tffile $qffile else if [ -f $tffile ] then echo -n " <extra: $tffile>" > /dev/console rm -f $tffile fi fi done # remove df files with no corresponding qf files for dffile in df* do qffile=`echo $dffile | sed 's/d/q/'` if [ -r $dffile -a ! -f $qffile ] then echo -n " <incomplete: $dffile>" > /dev/console mv $dffile `echo $dffile | sed 's/d/D/'` fi done # announce files that have been saved during disaster recovery for xffile in [A-Z]f* do if [ -f $xffile ] then echo -n " <panic: $xffile>" > /dev/console fi doneIf you are not running a version of UNIX that supports Berkeley TCP/IP, do not include the -bd flag.
This is the help file used by the SMTP HELP command.
It should be copied from usr/sendmail.hf:
cp lib/sendmail.hf /usr/lib
The actual path of this file is defined in the HelpFile option of the sendmail.cf file.
If you wish to collect statistics about your mail traffic, you should
create the file /etc/mail/sendmail.st:
cp /dev/null /etc/mail/sendmail.st
chmod 644 /etc/mail/sendmail.st
This file does not grow. It is printed with the program mailstats/mailstats.c. The actual path of this file is defined in the S option of the sendmail.cf file.
If sendmail is invoked as mailq, it will simulate the -bp flag (for example, sendmail will print the contents of the mail queue; see ``The mail queue''). This should be a link to /usr/lib/sendmail.