home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeTCP/IP Network AdministrationSearch this book

Appendix E. A sendmail Reference

This appendix provides details of the syntax of the sendmail command, of the sendmail.cf file, and of the m4 macros that can be used to build that file. It describes where to obtain the latest source code for sendmail and how to compile it. This appendix is a reference, not a tutorial. Refer to Chapter 10, "sendmail " for a tutorial on sendmail configuration.

We start the appendix with information on locating, downloading, and compiling the latest version of sendmail.

E.1. Compiling sendmail

The source code for sendmail is available via anonymous FTP from ftp.sendmail.org, where it is stored in the pub/sendmail directory. sendmail is updated constantly. The following examples are based on sendmail 8.11.3. Remember that things will change for future releases. Always read the README files and installation documents that come with new software before beginning an installation.

To compile the sendmail program, download the compressed tar file as a binary file, and then uncompress and extract it with the tar command, shown below:

$ ftp ftp.sendmail.org
Connected to ftp.sendmail.org.
220 pub2.pa.vix.com FTP server ready.
Name (ftp.sendmail.org:craig): anonymous
331 Guest login ok, send your e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.   
ftp> cd pub/sendmail
ftp> get sendmail.8.11.3.tar.gz
local: sendmail.8.11.3.tar.gz remote: sendmail.8.11.3.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for sendmail.8.11.3.tar.gz
   (1347756 bytes).
226 Transfer complete.
1347756 bytes received in 18.68 Seconds (72.42 Kbytes/sec)
ftp> quit
221-You have transferred 1347756 bytes in 1 files.
221-Thank you for using the FTP service on pub2.pa.vix.com.
221 Goodbye.
$ cd /usr/local/src  
$ tar -zxvf /home/craig/sendmail.8.11.3.tar.gz

Next, change to the sendmail-8.11.3 directory created by the tar file, and use the Build script to compile the new sendmail program, as shown below:

$ cd sendmail-8.11.3
$ ./Build
aking all in:
/usr/local/src/sendmail-8.11.3/libsmutil
Configuration: pfx=, os=Linux, rel=2.2.10, rbase=2, rroot=2.2, arch=i586, sfx=, variant=optimized
Using M4=/usr/bin/m4
Creating ../obj.Linux.2.2.10.i586/libsmutil using ../devtools/OS/Linux
aking dependencies in ../obj.Linux.2.2.10.i586/libsmutil
make[1]: Entering directory
     `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/libsmutil'
cc -M -I. -I../../sendmail -I../../include -DNEWDB
      -DNOT_SENDMAIL debug.c
errstring.c lockfile.c safefile.c snprintf.c strl.c    >> Makefile
make[1]: Leaving directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/libsmutil'
aking in ../obj.Linux.2.2.10.i586/libsmutil
make[1]: Entering directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/libsmutil'
cc -O -I. -I../../sendmail -I../../include -DNEWDB
      -DNOT_SENDMAIL -c debug.c -o debug.o
cc -O -I. -I../../sendmail -I../../include -DNEWDB
      -DNOT_SENDMAIL -c errstring.c -o errstring.o

... Many, many, many lines deleted...

cc -O -I. -I../../sendmail -I../../include -DNEWDB
      -DNOT_SENDMAIL -c vacation.c -o vacation.o
cc -o vacation   vacation.o ../libsmdb/libsmdb.a 
      ../libsmutil/libsmutil.a -ldb -lresolv -lcrypt -lnsl -ldl
groff -Tascii -man vacation.1 > vacation.0 ||
      cp vacation.0.dist vacation.0
make[1]: Leaving directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/vacation'

Build detects the architecture of the system and builds the correct Makefile for your system. It then compiles sendmail using the newly created Makefile.

According to the documentation, running Build is all you need to do on most systems to compile sendmail. It works on Red Hat Linux and Solaris 8 systems. However, there are no guarantees. Your system may use nonstandard directories or lack certain libraries. You may need to provide compiler flags that are customized for your system.

If you have experience with compiling sendmail, you may be tempted to look for the compiler options in the Makefile in the sendmail distribution's source code directory. You may even remember setting compiler options in the Makefile at some time in the past, but that has changed. Now, compiler options are set in the files located in the devtools directory of the sendmail source code distribution.

The default compiler options are normally set in an operating system-specific file in the devtools/OS directory and changed in files you create specially for your server in the devtools/Site directory. The files in the devtools/OS directory are identified by operating system name; for example, the configuration file for Solaris 8 is named SunOS5.8. If your Solaris 8 system varies from the norm, create your own file in devtools/Site named site.SunOS5.8.m4 that contains the corrected setting. Additionally, you can create a file named site.config.m4 in the devtools/Site directory if the compiler options you wish to set relate more to the peculiarities of your site than they do to corrections of operating system settings. Build looks for and uses files with either of these names.

As the .m4 file extension in these filenames implies, the commands that are used to define compiler options are m4 macros, not simple compiler options. Table E-1 lists the m4 commands that are used with sendmail 8.11.3 to control the compile process.

Table E-1. m4 compiler options

Command

Purpose

confBEFORE

Identifies files that must be created before the compile.

confBLDVARIANT

Requests OPTIMIZED, DEBUG, or PURIFY build variants.

confBUILDBIN

The path of the build support binaries.

confCC

The name of the C compiler.

confCCOPTS

Options to pass to the compiler.

confCOPY

The name of a program that copies files.

confDEPEND_TYPE

Name of a file in devtools/M4/depend that defines how to build dependencies.

confDEPLIBS

Dependent libraries for shared objects.

confEBINDIR

The path of the program executed by other programs.

confENVDEF

The -D flags passed to the compiler.

confFORCE_RMAIL

Forces installation of rmail.

confHFDIR

Path of the sendmail helpfile.

confHFFILE

Name of the helpfile.

confINCDIRS

The -I flags passed to the compiler.

confINCGRP

The group ID used for include files.

confINCMODE

The file permissions used for include files.

confINCOWN

The user ID used for include files.

confINCLUDEDIR

The path where include files are installed.

confINSTALL

The install program.

confINSTALL_RAWMAN

Install the unformatted manual pages.

confLDOPTS

Options for the linker.

confLIBDIR

Path to the install library files.

confLIBDIRS

The -L flags for the linker.

confLIBGRP

The group ID used for libraries.

confLIBMODE

The file permissions used for libraries.

confLIBOWN

The user ID used for libraries.

confLIBS

The -l flags passed to linker.

confLIBSEARCH

Names of the libraries searched during linking.

confLIBSEARCHPATH

Path of the libraries searched during linking.

confLINKS

Names of logical links to sendmail, e.g., newaliases.

confLN

The command used to create logical links.

confMAN1

The path of man1 files.

confMAN1EXT

The filename extension used for man1 files.

confMAN1SRC

The source for man1 pages.

confMAN3

The path of man3 files.

confMAN3EXT

The filename extension used for man3 files.

confMAN3SRC

The source for man3 pages.

confMAN4

The path of man4 files.

confMAN4EXT

The filename extension for man4 files.

confMAN4SRC

The source for man4 pages.

confMAN5

The path of man5 files.

confMAN5EXT

The filename extension used for man5 files.

confMAN5SRC

The source for man5 pages.

confMAN8

The path of man8 files.

confMAN8EXT

The filename extension used for man8 files.

confMAN8SRC

The source for man8 pages.

confMANDOC

The macros used to format manpages.

confMANGRP

The group ID used for manpage files.

confMANMODE

The file permission for manpages.

confMANOWN

The user ID used for manpage files.

confMANROOT

The root path of the various directories that contain formatted manpages.

confMANROOTMAN

The root path of the various directories that contain unformatted manpages.

confMAPDEF

Identifies the types of database support that should be compiled into sendmail.

confMBINDIR

The path in which the sendmail program is installed.

confNO_HELPFILE_INSTALL

If defined, no helpfile is installed.

confNO_MAN_BUILD

If defined, manpages are not created.

confNO_MAN_INSTALL

If defined, manpages are not installed.

confNO_STATISTICS_INSTALL

If defined, no statistics file is installed.

confNROFF

Identifies the command used to format manpages.

confOBJADD

Identifies objects that should be linked in to sendmail.

confOPTIMIZE

Flags passed to the compiler as ${O}.

confRANLIB

The path to the ranlib program.

confRANLIBOPTS

Options passed to ranlib.

confSBINDIR

The path of the directory in which commands such as makemap are stored.

confSBINGRP

The group ID used for setuid binaries.

confSBINMODE

The file permissions for setuid binaries.

confSBINOWN

The user ID used for setuid binaries.

confSHAREDLIB_EXT

The filename extension for shared libraries.

confSHAREDLIB_SUFFIX

The suffix used for shared objects.

confSHAREDLIBDIR

The path of the directory in which shared libraries are installed.

confSHELL

The pathname of the shell used inside make.

confSMOBJADD

Objects that should be linked in to sendmail.

confSMSRCADD

The C source files for the objects identified by confSMOBJADD.

confSMSRCDIR

The directory that contains the sendmail source code.

confSRCADD

The C source files for the objects identified by confOBJADD.

confSRCDIR

The root path of the source directories.

confSONAME

Linker flag for recording the shared object name.

confSTDIO_TYPE

Identifies the buffered file implementation used, i.e., portable or torek.

confSTDIR

The path where the statistics file is stored.

confSTFILE

The name of the statistics file.

confSTRIP

Identifies the program used to strip executables.

confSTRIPOPTS

Options passed to the strip program.

confUBINDIR

The path for user-executable programs.

confUBINGRP

The group ID used for user-executable binaries.

confUBINMODE

The file permissions used for user-executable binaries.

confUBINOWN

The user ID used for user-executable binaries.

Once sendmail compiles, it is installed by using the Build command with the install option, as shown here:

# ./Build install
aking all in:
/usr/local/src/sendmail-8.11.3/libsmutil
Configuration: pfx=, os=Linux, rel=2.2.10, rbase=2, rroot=2.2,
      arch=i586, sfx=, variant=optimized
aking in ../obj.Linux.2.2.10.i586/libsmutil
make[1]: Entering directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/libsmutil'

... Many, many, many lines deleted...

aking in ../obj.Linux.2.2.10.i586/vacation
make[1]: Entering directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/vacation'
install -c -o bin -g bin -m 555 vacation /usr/bin
install -c -o bin -g bin -m 444 vacation.0 /usr/man/man1/vacation.1
make[1]: Leaving directory
      `/usr/local/src/sendmail-8.11.3/obj.Linux.2.2.10.i586/vacation' 

The Build command installs the manpages, the executables, the help file, and the status file in the correct directories for your system.

sendmail is now ready to run. The next section describes the syntax of the sendmail command.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.