Building the Lastest Sendmail

by Walt Stoneburner v1.5
"It's not the compiling you have to worry about, it's the configuration."

These instructions are for compiling and configuring sendmail version 8.12.9. Verbose compile instructions reside at the sendmail site.

Obtain and extract the source code:

$ ncftpget
Always check the MD5 and/or PGP signatures!
$ tar zxvf sendmail.8.12.9.tar.gz
$ cd sendmail-8.12.9

Adding MILTER Support to Sendmail

Milter is an API provided by the folks at sendmail to muck about with incoming mail at every step of the SMTP session, accepting, rejecting, discarding, altering, whatever you want to do, along the way.

A "milter daemon" runs in the background, parallel to the sendmail process, with sendmail communcating with it (via UNIX or TCP sockets, so the daemon could reside on a separate machine if server load required it). At every step of the SMTP session, callbacks to the milter daemon are issued, and the milter daemon advises the sendmail process what to do -- continue to accept the message, reject the message, etc.

-- Source: About Page from, a MILTER discussion site

MILTER is not compiled by sendmail by default; it requires POSIX thread support on the host operating system.

To enable MILTER, edit the Makefile and add libmilter to the end of the subdirectory list, and save the file. This will build the file libmilter.a.

    SUBDIRS= libsm libsmutil libsmdb sendmail editmap mail.local \
             mailstats makemap praliases rmail smrsh vacation libmilter
Note, you will also need to add a user called smmsp, a group called smmsp, and make sure the following directories and files exist with the following permissions:
    drwxrwx---      smmsp  smmsp     /var/spool/clientmqueue
    drwx------      root   wheel     /var/spool/mqueue
    -r--r--r--      root   wheel     /etc/mail/
    -r--r--r--      root   wheel     /etc/mail/
    -r-xr-sr-x      root   smmsp     /usr/sbin/sendmail

Customize your platforms compilation options:

$ cd devtools/Site
$ cp ../OS/Linux site.config.m4
    The devtools/README and the devtool/Site/README files explain that not doing this step selects the default platform; doing this step allows you to customize the various build options (which are listed in the README files). Edit your site.config.m4 file with any custom changes you'd like.

    If you've added MILTER support, support add these two lines to site.config.m4:
    APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')

Build the sendmail binaries:

Do Not Use Make! Use Build!

$ cd ../..
$ ./Build -c

    The -c option informs sendmail that you've changed the site.config.m4 file. See the devtools/Site/README file.

Set up your custom m4 configuration file:

$ cd cf/cf
$ cp
    The above directory is not a typo. Customize your file. cf/README has details. If you already have files in /etc/mail, you may want to back them up before you install.

    Consider adding, above the MAILER() lines:
    FEATURE(`mailertable',`hash -T<TMPF> /etc/mail/mailertable.db')dnl
    FEATURE(`virtusertable',`hash -T<TMPF> /etc/mail/virtusertable.db')dnl
    FEATURE(`access_db',`hash -T<TMPF> /etc/mail/access')dnl

    HX-Comment: Please report spam to

    The dnl is actually an m4 code that means "Delete Through Newline," it deletes from the dnl up to and including the next newline.

Generate the file:

$ rm
$ ./Build

Install the file and sendmail binaries:

# ./Build install-cf
# cd ../..
# ./Build install

Validate the sendmail configuration:

$ sendmail -d

If you added MILTER support, you should see MILTERin the "Compiled with:" section at the top.

Press Control-D to exit.

Compiling your /etc/mail/alias file

Sendmail doesn't really use the flat text file alias, instead it uses an index version from alias.db. So each time you edit the file, here's how you rebuild the database version:
# /usr/bin/newaliases

Compiling your /etc/mail/access file

Sendmail doesn't really use the flat text file access, instead it uses an index version from access.db. So each time you edit the file, here's how you rebuild the database version:
# /usr/sbin/makemap hash /etc/mail/access.db < /etc/mail/access

Start the new version of sendmail:

# killall -9 sendmail
# sendmail -bd -q15m
# telnet localhost 25
Sendmail will identify it's version number.
    The -bd option says to run sendmail as a background daemon. The -q15m option says to check the mail queues every 15 minutes.

Sendmail Documentation

# cd doc/op
# make op.txt

This generates a file called op.txt. It contains very useful information about sendmail.

MILTER documentation resides in libmilter/READMEfor compilation instructions) and in libmilter/docs (for API and configuration).

Since this article was written, I have learned about PostFix, a easy to set up, easy to configure, easy to maintain, secure, instant drop-in replacement for sendmail.

My advice: Ditch sendmail this instant, download postfix, and spend your weekend doing something enjoyable.

SlingCode Search Results About     Articles     Links     Search Tips