Cover | Table of Contents | Colophon
Received:,
Return-Path:, and other required headers. Email
submitted by an MUA might require more modification than is legal for
an MTA to perform, so the new role of an MSA was created. An MSA
accepts messages from an MUA, and has the legal right to heavily add
to, subtract from, and screen or alter all such email. An MSA, for
example, can ensure that all hostnames are fully qualified, and that
headers, such as Date:, are always included.
http://www.qmail.org.
R $+ @ $+ $: $1 < @ $2 > focus on domain R $+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
R at the beginning of each line, for example,
labels a rewrite rule. And the
$+ expressions mean to match one or more parts of
an address. With experience, such expressions (and indeed the
configuration file as a whole) soon become meaningful.
This is a one-line message.
% /usr/sbin/sendmail you <sendstuff
- character are considered to be the
names of the people to whom you are sending the mail message.
<sendstuff sequence causes the contents of
the file that you have created (sendstuff) to be
redirected into the sendmail program. The
sendmail program treats everything it reads from
its standard input (up to the end of the file) as the mail message to
transmit.
From you@Here.US.EDU Fri Dec 13 08:11:44 2002
Received: (from you@localhost)
by Here.US.EDU (8.12.7/8.12.7)
id d8BILug12835 for you; Fri, 13 Dec 2002 08:11:44 -0600 (MDT)
Date: Fri, 13 Dec 2002 08:11:43
From: you@Here.US.EDU (Your Full Name)
Message-Id: 200201011548.d872mLW24467@Here.US.EDU>
To: you
% grep =/ /etc/mail/sendmail.cfO AliasFile=/etc/mail/aliases #O ErrorHeader=/etc/mail/error-header O HelpFile=/etc/mail/helpfile O QueueDirectory=/var/spool/mqueues/q.* O StatusFile=/etc/mail/statistics #O UserDatabaseSpec=/etc/mail/userdb #O ServiceSwitchFile=/etc/mail/service.switch #O HostsFile=/etc/hosts #O SafeFileEnvironment=/arch #O DeadLetterDrop=/var/tmp/dead.letter O ControlSocketName=/var/spool/mqueues/.control #O PidFile=/var/run/sendmail.pid #O DefaultAuthInfo=/etc/mail/default-auth-info Mlocal, P=/usr/lib/mail.local, F=lsDFMAw5:/|@qPSXfmnz9, S=EnvFromSMTP/HdrFromL, Mprog, P=/bin/sh, F=lsDFMoqeu9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
O character, some with an M,
and others with a #. The O
marks a line as a configuration option. The word following the
O is the name of the option. The options in the
preceding output show the location of the files that
sendmail uses. george:
% /usr/lib/sendmail georgegeorge,
truman, and teddy:
% /usr/lib/sendmail george,truman,teddy- character (such as george)
are assumed to be recipients. Arguments that do
begin with a - character are taken as switches
that determine the behavior of sendmail. The
recipients must always follow all the switched arguments. Any
switched arguments that follow recipients will be interpreted as
recipient addresses, potentially causing bounced mail.
|
Flag
|
Description
|
|---|---|
|
-b
|
Set operating mode
|
|
-v
|
Run in verbose mode
|
|
-d
|
Run in debugging mode
|
-b
argument you use. One form, for example, causes
sendmail to display the contents of the queue.
Another causes sendmail to rebuild the
aliases database. A complete list of the
-b command-line
mode-setting switches is shown in Table 1-2. We
will cover only a few in this chapter.
|
Form
|
Description
|
|---|---|
-ba |
Use ARPAnet (Grey Book) protocols
|
-bD |
Run as a daemon, but don't fork
|
-bd |
Run as a daemon
|
-bH |
Purge persistent host status
|
-bh |
Print persistent host status
|
-bi |
Rebuild alias database |
V9/Berkeley ←good V9/Berkeley ←bad, does not begin a line V9/Berkeley Fw/etc/mail/mxhosts ←bad, two commands on one line Fw/etc/mail/mxhosts ←good
V command is
followed by a number, a slash, and a vendor name. Whereas the
F command is followed by a letter (a
w in the example), then the full pathname of a
file. The complete list of configuration commands is shown in Table 1-4.
|
Command
|
Description
|
|---|---|
C |
Define a class macro
|
D |
Define a macro
|
E |
Define an environment variable (beginning with V8.7)
|
F |
Define a class macro from a file, pipe, or database map
|
H |
Define a header
|
K |
Declare a keyed database (beginning with V8.1)
|
L |
Include extended load average support (contributed software, not
covered)
|
M |
Define a mail delivery agent
|
O |
Define an option
|
P |
Define delivery priorities
|
Q |
Define a queue (beginning with V8.12)
|
R |
Define a rewriting rule
|
S |
Declare a rule-set start
|
T |
Declare trusted users (ignored in V8.1, restored in V8.7)
|
V |
Define configuration file version (beginning with V8.1)
|
X |
Define a mail filter (beginning with V8.12)
|
V, should appear only once
in your sendmail.cf file. Others, such as
R, can appear often.
#
character are considered comments and are ignored. A line that begins
with either a tab or a space character is a continuation of the
preceding line:
% /usr/sbin/sendmail -d0.1 -bt < /dev/nullaccess_db FEATURE support included and
utilized (Section 7.5). The V8.9 release of
% /usr/sbin/sendmail -d0.1 -bt < /dev/nullaccess_db FEATURE support included and
utilized (Section 7.5). The V8.9 release of
sendmail was the first that specifically
targeted the suppression of spam. If your site
suffers from spam mailings, consider upgrading
to V8.12 soon.
http://www.sendmail.org/current-release.html
Subject: MGET Allman
% pgp -ka /tmp/eric.asc ← for pgp version 2.x % pgpk -a /tmp/eric.asc ← for pgp version 5.x
www.sendmail.org, instead of
Eric's key. The fingerprint for the signing key is:
CA AE F2 94 3B 1D 41 3C 94 7B 72 5F AE 0B 6A 11 ← 1997 F9 32 40 A1 3B 3A B6 DE B2 98 6A 70 AF 54 9D 26 ← 1998 25 73 4C 8E 94 B1 E8 EA EA 9B A4 D6 00 51 C3 71 ← 1999 81 8C 58 EA 7A 9D 7C 1B 09 78 AC 5E EB 99 08 5D ← 2000 59 AF DC 3E A2 7D 29 56 89 FA 25 70 90 0D 7E C1 ← 2001 7B 02 F4 AA FC C0 22 DA 47 3E 2A 9A 9B 35 22 45 ← 2002
C0 28 E6 7B 13 5B 29 02 6F 7E 43 3A 48 4F 45 29 ← V8.5 and earlier
pgp signature-file ← for pgp version 2.x pgpv signature-file here ← for pgp version 5.x
% cd sendmail % ./Build -n Configuration: pfx=, os=SunOS, rel=4.1.4, rbase=4, rroot=4.1, arch=sun4, sfx= Using M4=/usr/5bin/m4 Creating ../obj.SunOS.4.1.4.sun4/sendmail using ../devtools/OS/SunOS ← many more lines here %
sun4, running the SunOS 4.1.4 release of Unix.
Build then created the working directory
../obj.SunOS.4.1.4.sun4, set up symbolic links
to all the source files in that directory, and finally generated a
Makefile there.
-n switch to
Build (in the earlier example) caused
Build to pass that switch to
make(1), thereby preventing
make(1) from actually building
sendmail.
|
Switch
|
§
|
Description
|
|---|---|---|
|
-A
|
-A
|
Show the architecture for the build.
|
|
-c
|
-c
|
Clean out an existing object tree.
|
|
-E
|
-E
|
Pass environment variables to build.
|
|
-f
|
-f
|
Use site file in alternative directory.
|
|
-I
|
-I
|
Add additional include directories.
|
|
-L
|
-L
|
Add additional library directories.
|
|
-m
|
-m
|
Show but don't create the directory.
|
|
-M
|
-M
|
Show the name of the object directory.
|
|
-O
|
-O
|
Specify the path of the object directory.
|
|
-Q
|
-Q
|
Set prefix for the object directory and Build m4 configuration file.
|
|
-S
|
-S
|
Skip system-specific configuration.
|
% ./Build-f command-line switch
with Build to specify the location of that file:
% ./Build -f /usr/local/configs/sendmail/oursite.m4-f command-line switch every time you build. If
you fail to remember, or if someone else builds without knowing the
need for -f, the created
sendmail binary may not work as you expect or
might lack the abilities you require.
#define
macros defined there. Consider those marked as
tune, and for any that you find important,
include a definition for each in your m4 build
file. When your m4 build file is complete,
return here.
# ./Build -f /path/to/your/m4/file -n
-f and the path to your m4
build file. If you wish to tune sendmail to your
custom needs first, before running Build, you
need to create an m4 file (as discussed
earlier).
-f switch each time you
build, but will avoid having to copy them again for each release of
sendmail.
-f. The name of
the file is site.config.m4. If you want to
maintain several master files in that directory, you can do so
depending on your operating system type. When
Build runs, it prints a line that looks like the
following line split to fit the page:
Configuration: pfx=, os=SunOS, rel=4.1.4, rbase=4, rroot=4.1, arch=sun4, sfx=, variant=optimized
os=. If you were to create a file in the
devtools/Site directory called
site.SunOS.m4, it, too, would be automatically
found and used without the need for a -f switch.
sfx= will be assigned that value with a dot in
front of it. That value can be used to further tune the name of the
files in # ./Build -n install-n to be sure that the installation caused
is, in fact, correct for your site. A typical such run, for example,
might look like this:
Configuration: pfx=, os=SunOS, rel=4.1.4, rbase=4, rroot=4.1, arch=sun4, sfx=
Making in ../obj.SunOS.4.1.4.sun4/sendmail
if [ ! -d /etc/mail ]; then mkdir -p /etc/mail; fi
install -c -o bin -g bin -m 444 helpfile /etc/mail/helpfile
if [ ! -d /etc/mail ]; then mkdir -p /etc/mail; fi
install -c -o root -g bin -m 644 statistics /etc/mail/statistics
install -c -o root -g bin -m 4555 sendmail /usr/lib
for i in /usr/ucb/newaliases /usr/ucb/mailq /usr/ucb/hoststat /usr/ucb/purgestat; do \
rm -f $i; \
ln -s /usr/lib/sendmail $i; \
done
install -c -o bin -g bin -m 444 sendmail.0 /usr/share/man/cat8/sendmail.8
install -c -o bin -g bin -m 444 aliases.0 /usr/share/man/cat5/aliases.5
install -c -o bin -g bin -m 444 mailq.0 /usr/share/man/cat1/mailq.1
install -c -o bin -g bin -m 444 newaliases.0 /usr/share/man/cat1/newaliases.1# ./Build installQ, which can indicate a problem.
See Section 11.5 for a description of why these files
appear and what to do about them.
#define
macros. For a description of each of those #define
macros see Chapter 3.
#include files are sometimes preset in the
appropriate devtools/OS directory. For
OS/UXPDS.V10, for example, the default is:
-I/usr/include -I/usr/ucbinclude
APPENDDEF(`confINCDIRS', `-I/usr/local/include/db')
-I/usr/include -I/usr/ucbinclude -I/usr/local/include/db
confBEFORE macro
is used to specify the presence of a special header file before
compiling. The confBEFORE macro causes an
appropriate BEFORE= directive to appear in your
Makefile. It is very unlikely that you will ever
have to change this from the value that is predefined for you. But if
you do, you can do so like this illustration from SunOS 4.0:
define(`confBEFORE', `stdlib.h stddef.h limits.h')
PUSHDIVERT(3)
stddef.h stdlib.h limits.h:
cp /dev/null $@
POPDIVERTconfBEFORE
requires a corresponding section of Makefile
code to be inserted between diversions (PUSHDIVERT and POPDIVERT).
The first line in this example says that the three files
stdlib.h, stddef.h, and
limits.h must exist in the
obj... directory before
sendmail can be compiled. It causes those three
header files to be listed with the BEFORE= directive in the resulting
Makefile:
BEFORE= stdlib.h stddef.h limits.h
...
sendmail: ${BEFORE} ${OBJS}APPENDDEF(`conf_sendmail_ENVDEF', `-DMYCODE')
APPENDDEF(`confBEFORE', `mycode.h')
APPENDDEF(`confSMOBJADD', `mycode.o')
PUSHDIVERT(3)
mycode.h mycode.c:
ln -s /usr/local/src/mycode/$@
POPDIVERT-DMYCODE to the
ENVDEF= line in Makefile
(confENVDEF and conf_prog_ENVDEF). Here, we presume that C-language
hooks have been added to the sendmail source,
and that they are enabled/disabled by wrapping them in preprocessor
conditionals. For example:
# ifdef MYCODE
if (mycode(e->e_eid) < 0)
return FALSE;
# endifconfBEFORE
macro. The third line causes the OBJADD= directive in
Makefile to be given the value
mycode.o (confOBJADD). This
automatically adds that object file name to the list of all object
files in confBLDVARIANT Build
macro is used to convey to the make program a
notion of how the compile should run. The possibilities are:
confOPTIMIZE Build
macro to a value of -g for FreeBSD or to
-g -Wall for Linux.
confOPTIMIZE Build
macro to a value of -O for FreeBSD or to
-O2 for Linux.
confOPTIMIZE Build
macro to a value of -g for FreeBSD and Linux.
confBLDVARIANT
Build macro looks like this:
define(`confBLDVARIANT', `DEBUG') define(`confBLDVARIANT', `OPTIMIZED') define(`confBLDVARIANT', `PURIFY')
-v command-line switch (-v) for the Build program
uses command-line arguments of debug,
optimized, and purify to
automatically set this confBLDVARIANT macro.
confBLDVARIANT
are all uppercase, while those used for -v are all
lowercase.
Sorry, the purify build variant has not been plumbed yet. (Bummer.)
purify and other operating systems.
confBUILDBIN macro is used to define the
location of the devtools/bin directory.
Normally, this macro will never have to be defined because the
default value is correct, but there might be a rare circumstance when
you will need to redefine it. If, for example, you need to move the
devtools/bin directory to a different path, or
rename it, you can do so like this:
define(`confBUILDBIN', `../../OLD_devtools/bin')
confBUILDBIN must be
either an absolute path or a path relative to the
obj directory (sendmail is
built inside the obj directory).
confBUILDBIN macro sets the
BUILDBIN= line in Makefile.
Depending on your operating system, that line might or might not be
used. For Solaris 2.5, for example, it is used like this:
INSTALL=${BUILDBIN}/install.shconfBUILDBIN can occur when you are
actively modifying the sendmail code, and it
becomes appropriate to maintain the source completely separate from
the normal distribution tree.
confCC macro is used to specify which
C-language compiler to use when building
sendmail. The default is probably appropriate
for your system, but there might be times when a different compiler
is preferred. For example, consider the desire to use
Sun's unbundled compiler instead of
gcc(1) under Solaris 2.5:
define(`confCC', `/usr/opt/SUNWspro/bin/cc')
confCC macro might also be used to compile for
testing with purify(1):
define(`confCC', `/usr/local/bin/purify cc')
define(`confCC', `gcc -V2.7.2.1')
define(`confCC', `/opt/SUNWspro/bin/cc') define(`confDEPEND_TYPE', `Solaris')
confDEPEND_TYPE of
Solaris causes a Makefile to
be constructed with correct dependencies for Sun's
unbundled compiler (confDEPEND_TYPE).
confCC macro provides the value used with the
CC= Makefile directive. This value is used to
compile .o files from .c
files, and to ld(1) the final
sendmail executable.
-nostdinc switch for
gcc. The confCCOPTS macro
allows you to do this. The following instructs the
gcc compiler to allow traditional K&R
instructions:
define(`confCCOPTS', `-traditional')
cp /dev/null statistics
confSTFILE
macro (confSTFILE), you might change the copy
command's invocation to:
define(`confCOPY', `cp -i')
-i causes cp(1) to prompt
for your OK if the target file already exists.
confDEPEND_TYPE macro defines the method that
should be included in your Makefile for use in
creating make(1) dependencies. The methods
supported are located in the devtools/M4/depend
directory. We show them in Table 2-6.
|
Method
|
File
|
How invoked
|
|---|---|---|
|
AIX
|
devtools/M4/depend/AIX.m4
|
${CC} -M -E ${COPTS} $$i
|
|
BSD
|
devtools/M4/depend/BSD.m4
|
mkdep -a -f Makefile ${COPTS} *.c
|
|
CC-M
|
devtools/M4/depend/CC-M.m4
|
${CC} -M ${COPTS} *.c >> Makefile
|
|
generic
|
devtools/M4/depend/generic.m4
|
nothing
|
|
NCR
|
devtools/M4/depend/NCR.m4
|
${CC} -w0 -Hmake ${COPTS} *.c >> Makefile
|
|
Solaris
|
devtools/M4/depend/Solaris.m4
|
${CC} -xM ${COPTS} *.c >> Makefile
|
|
X11
|
devtools/M4/depend/X11.m4
|
mak |