6.55 features; list of contributors
[unix-history] / usr / src / usr.sbin / sendmail / doc / op / op.me
CommitLineData
28719ec2 1.\" Copyright (c) 1983 Eric P. Allman
3edcb7c8 2.\" Copyright (c) 1983 The Regents of the University of California.
d312e734 3.\" All rights reserved.
28719ec2 4.\"
3edcb7c8 5.\" %sccs.include.redist.roff%
28719ec2 6.\"
50d4a65c 7.\" @(#)op.me 6.42 (Berkeley) %G%
28719ec2 8.\"
55c435aa 9.\" eqn op.me | pic | troff -me
28719ec2
JB
10.eh 'SMM:07-%''Sendmail Installation and Operation Guide'
11.oh 'Sendmail Installation and Operation Guide''SMM:07-%'
55c435aa
EA
12.\" SD is lib if sendmail is installed in /usr/lib, sbin if in /usr/sbin
13.ds SD sbin
4da134f8
EA
14.nr si 3n
15.de $0
16.(x
2fb78b49
EA
17.in \\$3u*3n
18.ti -3n
4da134f8
EA
19\\$2. \\$1
20.)x
21..
69a914e1
EA
22.de $C
23.(x
24.in 0
25\\$1 \\$2. \\$3
26.)x
27..
4da134f8
EA
28.+c
29.(l C
74b6e641
EA
30.sz 16
31.b SENDMAIL
4da134f8 32.sz 12
74b6e641
EA
33.sp
34.b "INSTALLATION AND OPERATION GUIDE"
35.sz 10
36.sp
4da134f8 37.r
4da134f8 38Eric Allman
d754edf0
EA
39University of California, Berkeley
40Mammoth Project
55c435aa 41eric@CS.Berkeley.EDU
69a914e1 42.sp
50d4a65c 43Version 6.42
18843c53 44.sp
50d4a65c 45For Sendmail Version 6.55
74b6e641
EA
46.)l
47.sp 2
4da134f8
EA
48.pp
49.i Sendmail
69a914e1
EA
50implements a general purpose internetwork mail routing facility
51under the UNIX*
52.(f
53*UNIX is a trademark of Bell Laboratories.
54.)f
55operating system.
4da134f8
EA
56It is not tied to any one transport protocol \*-
57its function may be likened to a crossbar switch,
58relaying messages from one domain into another.
59In the process,
60it can do a limited amount of message header editing
61to put the message into a format that is appropriate
62for the receiving domain.
63All of this is done under the control of a configuration file.
64.pp
65Due to the requirements of flexibility
66for
67.i sendmail ,
68the configuration file can seem somewhat unapproachable.
69However, there are only a few basic configurations
70for most sites,
71for which standard configuration files have been supplied.
72Most other configurations
73can be built by adjusting an existing configuration files
74incrementally.
75.pp
55c435aa 76.i Sendmail
f13b6b36
EA
77is based on
78RFC822 (Internet Mail Format Protocol),
79RFC821 (Simple Mail Transport Protocol),
475d7a3d 80RFC1123 (Internet Host Requirements),
f13b6b36 81and
475d7a3d 82RFC1425 (SMTP Service Extensions).
f13b6b36
EA
83However, since
84.i sendmail
85is designed to work in a wider world,
86in many cases it can be configured to exceed these protocols.
87These cases are described herein.
55c435aa 88.pp
4da134f8
EA
89Although
90.i sendmail
91is intended to run
92without the need for monitoring,
93it has a number of features
94that may be used to monitor or adjust the operation
95under unusual circumstances.
96These features are described.
97.pp
98Section one describes how to do a basic
99.i sendmail
100installation.
101Section two
69a914e1 102explains the day-to-day information you should know
4da134f8
EA
103to maintain your mail system.
104If you have a relatively normal site,
105these two sections should contain sufficient information
106for you to install
107.i sendmail
108and keep it happy.
109Section three
2fb78b49
EA
110describes some parameters that may be safely tweaked.
111Section four
112has information regarding the command line arguments.
113Section five
4da134f8
EA
114contains the nitty-gritty information about the configuration
115file.
116This section is for masochists
117and people who must write their own configuration file.
55c435aa
EA
118Section six
119gives a brief description of differences
120in this version of
121.i sendmail .
4da134f8
EA
122The appendixes give a brief
123but detailed explanation of a number of features
124not described in the rest of the paper.
3dfefb78 125.bp 5
4da134f8
EA
126.sh 1 "BASIC INSTALLATION"
127.pp
55c435aa
EA
128.i
129This section is a very rough rewrite;
130please don't assume that it is already completely correct.
131However,
132please send me suggestions so that later versions of this document
133can be more accurate.
134.pp
4da134f8
EA
135There are two basic steps to installing sendmail.
136The hard part is to build the configuration table.
137This is a file that sendmail reads when it starts up
138that describes the mailers it knows about,
139how to parse addresses,
140how to rewrite the message header,
141and the settings of various options.
142Although the configuration table is quite complex,
143a configuration can usually be built
144by adjusting an existing off-the-shelf configuration.
145The second part is actually doing the installation,
146i.e., creating the necessary files, etc.
147.pp
148The remainder of this section will describe the installation of sendmail
149assuming you can use one of the existing configurations
150and that the standard installation parameters are acceptable.
2fb78b49
EA
151All pathnames and examples
152are given from the root of the
153.i sendmail
318b7556
EA
154subtree,
155normally
55c435aa 156.i /usr/src/usr.\*(SD/sendmail
318b7556 157on 4.3BSD.
4da134f8 158.pp
55c435aa
EA
159If you are loading this off the tape,
160continue with the next session.
161If you have a running binary already on your system,
162you should probably skip to section 1.2.
163.sh 2 "Compiling Sendmail"
f0b465a8 164.pp
55c435aa
EA
165All sendmail source is in the
166.i src
167subdirectory.
168If you are running on a 4.4BSD system,
169compile by typing
170.q make .
171On other systems, you may have to make some other adjustments.
172.sh 3 "Old versions of make"
173.pp
174If you are not running the new version of
175.b make
176you will probably have to use
69a914e1 177.(b
d656ea51 178make \-f Makefile.dist
69a914e1 179.)b
55c435aa
EA
180This file does not assume several new syntaxes,
181including the
182.q +=
183syntax in macro definition
184and the
185.q ".include"
186syntax.
187.sh 3 "Compilation flags"
188.pp
189.i Sendmail
859d056a 190supports two different formats
55c435aa
EA
191for the
192.i aliases
193database.
194These formats are:
d656ea51 195.nr ii 1i
55c435aa 196.ip NDBM
859d056a
EA
197The ``new DBM'' format,
198available on nearly all systems around today.
55c435aa
EA
199This was the preferred format prior to 4.4BSD.
200It allows such complex things as multiple databases
201and closing a currently open database.
202.ip NEWDB
203The new database package from Berkeley.
204If you have this, use it.
205It allows
206long records,
207multiple open databases,
208real in-memory caching,
209and so forth.
210You can define this in conjunction with one of the other two;
211if you do,
212old databases are read,
213but when a new database is created it will be in NEWDB format.
214As a nasty hack,
215if you have both NEWDB and one of the DB formats defined,
859d056a 216and you also define YPCOMPAT,
55c435aa
EA
217and if the file
218.i /var/yp/Makefile
219exists and is readable,
f0b465a8 220.i sendmail
55c435aa
EA
221will create both new and old versions of the alias file
222during a
223.i newalias
224command.
225This is required because the Sun NIS/YP system
226reads the DBM version of the alias file.
227It's ugly as sin,
228but it works.
229.lp
859d056a 230If neither of these are defined,
f0b465a8 231.i sendmail
55c435aa
EA
232reads the alias file into memory on every invocation.
233This can be slow and should be avoided.
234.pp
235System V based systems can define
236SYSTEM5
237to make several small adjustments.
238This changes the handling of timezones
239and uses the much less efficient
240.i lockf
241call in preference to
242.i flock .
243These can be specified separately using the compilation flags
244SYS5TZ
245and
246LOCKF
247respectively.
de7324ac
EA
248.pp
249If you don't have the
250.i unsetenv
251routine in your system library, define the UNSETENV compilation flag.
252.pp
253You may also have to define the compilation variable LA_TYPE
254to describe how your load average is computed.
859d056a 255This and other flags are detailed in section 6.1.
55c435aa
EA
256.sh 3 "Compilation and installation"
257.pp
258After making the local system configuration described above,
259You should be able to compile and install the system.
260Compilation can be performed using
261.q make\**
262.(f
263\**where you may have to replace
264.q make
265with
266.q "make \-f Makefile.dist"
267as appropriate.
268.)f
269in the
270.b sendmail/src
271directory.
272You may be able to install using
69a914e1 273.(b
18843c53 274make install
69a914e1 275.)b
55c435aa
EA
276This should install the binary in
277/usr/\*(SD
278and create links from
279/usr/bin/newaliases
280and
281/usr/bin/mailq
282to
283/usr/\*(SD/sendmail.
284On BSD4.4 systems it will also format and install man pages.
285.sh 2 "Configuration Files"
286.pp
287.i Sendmail
288cannot operate without a configuration file.
289The configuration defines the mail systems understood at this site,
290how to access them,
291how to forward email to remote mail systems,
292and a number of tuning parameters.
293This configuration file is detailed
294in the later portion of this document.
295.pp
296The
297.i sendmail
298configuration can be daunting at first.
299The world is complex,
300and the mail configuration reflects that.
301The distribution includes an m4-based configuration package
302that hides a lot of the complexity.
303.pp
304These configuration files are simpler than old versions
305largely because the world has become simpler;
306in particular,
307text-based host files are officially eliminated,
308obviating the need to
309.q hide
310hosts behind a registered internet gateway.
311.pp
312These files also assume that most of your neighbors
313use domain-based UUCP addressing;
314that is,
315instead of naming hosts as
316.q host!user
317they will use
318.q host.domain!user .
319The configuration files can be customized to work around this,
320but it is more complex.
321.pp
322I haven't tested these yet on an isolated LAN environment
323with a single UUCP connection to the outside world.
324If you are in such an environment,
325please send comments to
326sendmail@okeeffe.CS.Berkeley.EDU.
327.pp
328Our configuration files are processed by
329.i m4
330to facilitate local customization;
331the directory
332.i cf
333of the
334sendmail
335distribution directory
336contains the source files.
337This directory contains several subdirectories:
338.nr ii 1i
339.ip cf
340Both site-dependent and site-independent descriptions of hosts.
341These can be literal host names
342(e.g.,
343.q ucbvax.mc )
344when the hosts are gateways
345or more general descriptions
346(such as
347.q "tcpproto.mc"
348as a general description of an SMTP-connected host
349or
350.q "uucpproto.mc"
351as a general description of a UUCP-connected host).
352Files ending
353.b \&.mc
354(``Master Configuration'')
355are the input descriptions;
356the output is in the corresponding
357.b \&.cf
358file.
359The general structure of these files is described below.
360.ip domain
361Site-dependent subdomain descriptions.
362These are tied to the way your organization wants to do addressing.
363For example,
364.b domain/cs.exposed.m4
365is our description for hosts in the CS.Berkeley.EDU subdomain
366that want their individual hostname to be externally visible;
367.b domain/cs.hidden.m4
368is the same except that the hostname is hidden
369(everything looks like it comes from CS.Berkeley.EDU).
370These are referenced using the
371.sm DOMAIN
372.b m4
373macro in the
374.b \&.mc
375file.
376.ip feature
377Definitions of specific features that some particular host in your site
378might want.
379These are referenced using the
380.sm FEATURE
381.b m4
382macro.
093461e4 383An example feature is
d656ea51
EA
384use_cw_file
385(which tells sendmail to read an /etc/sendmail.cw file on startup
386to find the set of local names).
55c435aa
EA
387.ip hack
388Local hacks, referenced using the
389.sm HACK
390.b m4
391macro.
392Try to avoid these.
393The point of having them here is to make it clear that they smell.
394.ip m4
395Site-independent
396.i m4 (1)
397include files that have information common to all configuration files.
398This can be thought of as a
399.q #include
400directory.
401.ip mailer
402Definitions of mailers,
403referenced using the
404.sm MAILER
405.b m4
406macro.
d656ea51 407Defined mailer types in this distribution are
475d7a3d 408fax,
d656ea51
EA
409local,
410smtp,
475d7a3d
EA
411uucp,
412and usenet.
55c435aa
EA
413.ip ostype
414Definitions describing various operating system environments
415(such as the location of support files).
416These are referenced using the
417.sm OSTYPE
418.b m4
419macro.
420.ip sh
421Shell files used by the
422.b m4
423build process.
424You shouldn't have to mess with these.
425.ip siteconfig
426Local site configuration information,
427such as UUCP connectivity.
d656ea51
EA
428They normally contain lists of site information, for example:
429.(b
430SITE(contessa)
431SITE(hoptoad)
432SITE(nkainc)
433SITE(well)
434.)b
435They are referenced using the SITECONFIG macro:
436.(b
437SITECONFIG(site.config.file, name_of_site, X)
438.)b
439where
440.i X
441is the macro/class name to use.
442It can be U
443(indicating locally connected hosts)
444or one of W, X, or Y
445for up to three remote UUCP hubs.
55c435aa
EA
446.pp
447If you are in a new domain
448(e.g., a company),
449you will probably want to create a
450cf/domain
451file for your domain.
452This consists primarily of relay definitions:
453for example, Berkeley's domain definition
454defines relays for
455BitNET,
456CSNET,
457and UUCP.
458Of these,
459only the UUCP relay is particularly specific
460to Berkeley.
461All of these are internet-style domain names.
462Please check to make certain they are reasonable for your domain.
463.pp
464Subdomains at Berkeley are also represented in the
465cf/domain
466directory.
467For example,
468the domain
469cs-exposed
470is the Computer Science subdomain with the local hostname shown
471to other users;
472cs-hidden
473makes users appear to be from the CS.Berkeley.EDU subdomain
474(with no local host information included).
475You will probably have to update this directory
476to be appropriate for your domain.
d656ea51
EA
477.pp
478You will have to use or create
479.b \&.mc
480files in the
481.i cf/cf
482subdirectory for your hosts.
483This is detailed in the
484cf/README
485file.
55c435aa
EA
486.sh 2 "Details of Installation Files"
487.pp
488This subsection describes the files that
489comprise the
490sendmail
491installation.
492.sh 3 "/usr/\*(SD/sendmail"
493.pp
494The binary for sendmail is located in /usr/\*(SD\**.
495.(f
496\**This is usually
497/usr/sbin
498on 4.4BSD and newer systems;
499many systems install it in
500/usr/lib.
501I understand it is in /usr/ucblib
502on System V Release 4.
503.)f
d656ea51
EA
504It should be setuid root.
505For security reasons,
506/, /usr, and /usr/\*(SD
507should be owned by root, mode 755\**.
508.(f
509\**Some vendors ship them owned by bin;
510this creates a security hole that is not actually related to
511.i sendmail .
512Other important directories that should have restrictive ownerships
513and permissions are
514/bin, /usr/bin, /etc, /usr/etc, /lib, and /usr/lib.
515.)f
daae36f7 516.sh 3 "/etc/sendmail.cf"
f0b465a8 517.pp
55c435aa
EA
518This is the configuration file for sendmail.
519This and the frozen configuration file
520are the only two non-library file names compiled into sendmail\**.
521.(f
522\**The system libraries can reference other files;
523in particular, system library subroutines that
524sendmail
525calls probably reference
526.i /etc/passwd
527and
528.i /etc/resolv.conf .
529.)f
530Some older systems install it in
531.b /usr/lib/sendmail.cf .
532.pp
533If you want to move this file,
534change
535.i src/pathnames.h .
536.pp
537The configuration file is normally created
538using the distribution files described above.
539If you have a particularly unusual system configuration
540you may need to create a special version.
541The format of this file is detailed in later sections
542of this document.
2fb78b49
EA
543.sh 3 "/usr/ucb/newaliases"
544.pp
545If you are running delivermail,
546it is critical that the
547.i newaliases
548command be replaced.
549This can just be a link to
550.i sendmail :
551.(b
74b6e641 552rm \-f /usr/ucb/newaliases
55c435aa 553ln /usr/\*(SD/sendmail /usr/ucb/newaliases
2fb78b49 554.)b
55c435aa
EA
555This can be installed in whatever search path you prefer
556for your system.
daae36f7 557.sh 3 "/var/spool/mqueue"
4da134f8
EA
558.pp
559The directory
daae36f7 560.i /var/spool/mqueue
4da134f8 561should be created to hold the mail queue.
d656ea51 562This directory should be mode 700
18843c53 563and owned by root.
55c435aa
EA
564.pp
565The actual path of this directory
566is defined in the
567.b Q
568option of the
569.i sendmail.cf
570file.
daae36f7 571.sh 3 "/etc/aliases*"
69a914e1 572.pp
55c435aa
EA
573The system aliases are held in
574.q /etc/aliases .
69a914e1
EA
575A sample is given in
576.q lib/aliases
577which includes some aliases which
578.i must
579be defined:
580.(b
daae36f7 581cp lib/aliases /etc/aliases
55c435aa 582.i "edit /etc/aliases"
69a914e1
EA
583.)b
584You should extend this file with any aliases that are apropos to your system.
585.pp
586Normally
587.i sendmail
588looks at a version of these files maintained by the
74b6e641 589.i dbm \|(3)
f13b6b36
EA
590or
591.i db \|(3)
69a914e1 592routines.
f13b6b36 593These are stored either in
daae36f7 594.q /etc/aliases.dir
69a914e1 595and
55c435aa 596.q /etc/aliases.pag
f13b6b36
EA
597or
598.q /etc/aliases.db
599depending on which database package you are using.
69a914e1
EA
600These can initially be created as empty files,
601but they will have to be initialized promptly.
18843c53 602These should be mode 644:
69a914e1 603.(b
daae36f7
EA
604cp /dev/null /etc/aliases.dir
605cp /dev/null /etc/aliases.pag
606chmod 644 /etc/aliases.*
74b6e641 607newaliases
69a914e1 608.)b
f13b6b36
EA
609The
610.i db
611routines preset the mode reasonably,
612so this step can be skipped.
55c435aa
EA
613The actual path of this file
614is defined in the
615.b A
616option of the
617.i sendmail.cf
618file.
daae36f7 619.sh 3 "/etc/sendmail.fc"
69a914e1
EA
620.pp
621If you intend to install the frozen version of the configuration file
622(for quick startup)
daae36f7 623you should create the file /etc/sendmail.fc
69a914e1
EA
624and initialize it.
625This step may be safely skipped.
626.(b
daae36f7 627cp /dev/null /etc/sendmail.fc
d656ea51
EA
628chmod 644 /etc/sendmail.fc
629/usr/\*(SD/sendmail \-bz
69a914e1 630.)b
f13b6b36
EA
631In general, freeze files are not worth doing
632unless your disks are much faster than your CPU;
633this is seldom true any more.
4da134f8
EA
634.sh 3 "/etc/rc"
635.pp
636It will be necessary to start up the sendmail daemon when your system reboots.
637This daemon performs two functions:
638it listens on the SMTP socket for connections
639(to receive mail from a remote system)
640and it processes the queue periodically
641to insure that mail gets delivered when hosts come up.
642.pp
643Add the following lines to
69a914e1 644.q /etc/rc
4da134f8 645(or
69a914e1 646.q /etc/rc.local
4da134f8
EA
647as appropriate)
648in the area where it is starting up the daemons:
649.(b
d656ea51 650if [ \-f /usr/\*(SD/sendmail \-a \-f /etc/sendmail.cf ]; then
daae36f7 651 (cd /var/spool/mqueue; rm \-f [lnx]f*)
55c435aa 652 /usr/\*(SD/sendmail \-bd \-q30m &
4da134f8
EA
653 echo \-n ' sendmail' >/dev/console
654fi
655.)b
656The
657.q cd
658and
659.q rm
660commands insure that all lock files have been removed;
661extraneous lock files may be left around
662if the system goes down in the middle of processing a message.
663The line that actually invokes
664.i sendmail
665has two flags:
666.q \-bd
667causes it to listen on the SMTP port,
668and
bff69eb1
EA
669.q \-q30m
670causes it to run the queue every half hour.
69a914e1
EA
671.pp
672If you are not running a version of UNIX
673that supports Berkeley TCP/IP,
674do not include the
675.b \-bd
676flag.
677.sh 3 "/usr/lib/sendmail.hf"
678.pp
679This is the help file used by the SMTP
680.b HELP
681command.
682It should be copied from
683.q lib/sendmail.hf :
684.(b
685cp lib/sendmail.hf /usr/lib
686.)b
55c435aa
EA
687The actual path of this file
688is defined in the
689.b H
690option of the
691.i sendmail.cf
692file.
daae36f7 693.sh 3 "/etc/sendmail.st"
69a914e1
EA
694.pp
695If you wish to collect statistics
696about your mail traffic,
697you should create the file
daae36f7 698.q /etc/sendmail.st :
2fb78b49 699.(b
daae36f7
EA
700cp /dev/null /etc/sendmail.st
701chmod 666 /etc/sendmail.st
2fb78b49 702.)b
69a914e1
EA
703This file does not grow.
704It is printed with the program
55c435aa
EA
705.q mailstats/mailstats.c.
706The actual path of this file
707is defined in the
708.b S
709option of the
710.i sendmail.cf
711file.
3f83c754
EA
712.sh 3 "/usr/ucb/newaliases"
713.pp
714If
715.i sendmail
716is invoked as
717.q newaliases,
718it will simulate the
719.b \-bi
720flag
721(i.e., will rebuild the alias database;
722see below).
55c435aa 723This should be a link to /usr/\*(SD/sendmail.
3f83c754
EA
724.sh 3 "/usr/ucb/mailq"
725.pp
726If
727.i sendmail
728is invoked as
729.q mailq,
730it will simulate the
731.b \-bp
732flag
733(i.e.,
734.i sendmail
735will print the contents of the mail queue;
736see below).
55c435aa 737This should be a link to /usr/\*(SD/sendmail.
4da134f8 738.sh 1 "NORMAL OPERATIONS"
6d5ff626 739.sh 2 "``Quick'' Configuration Startup"
817683ae 740.pp
56ba89fb
EA
741if the
742.sm FROZENCONFIG
743option is included during compilation,
744a precompiled (``frozen'') version of the configuration file
6d5ff626 745can be created using the
b16e27c4 746.b \-bz
6d5ff626
EA
747flag.
748This is really only worthwhile doing
749if you are on a slow processor with a relatively fast I/O system
750(a VAX 11/750 is a good example).
751Since it creates other problems,
752I recommend against using the frozen configuration
753on most current architectures.
754.pp
755To create the freeze file, use
817683ae 756.(b
55c435aa 757/usr/\*(SD/sendmail \-bz
817683ae 758.)b
6d5ff626
EA
759This creates the frozen configuration file
760.i /etc/sendmail.fc .
817683ae
EA
761This file is an image of
762.i sendmail 's
763data space after reading in the configuration file.
764If this file exists,
765it is used instead of
daae36f7 766.i /etc/sendmail.cf
69a914e1
EA
767.i sendmail.fc
768must be rebuilt manually every time
817683ae
EA
769.i sendmail.cf
770is changed.
771.pp
69a914e1 772The frozen configuration file will be ignored
817683ae
EA
773if a
774.b \-C
775flag is specified
776or if sendmail detects that it is out of date.
777However, the heuristics are not strong
778so this should not be trusted.
4da134f8
EA
779.sh 2 "The System Log"
780.pp
781The system log is supported by the
367a5dcd 782.i syslogd \|(8)
4da134f8
EA
783program.
784.sh 3 "Format"
785.pp
786Each line in the system log
787consists of a timestamp,
788the name of the machine that generated it
789(for logging from several machines
18843c53 790over the local area network),
4da134f8
EA
791the word
792.q sendmail: ,
793and a message.
794.sh 3 "Levels"
795.pp
69a914e1 796If you have
367a5dcd 797.i syslogd \|(8)
69a914e1
EA
798or an equivalent installed,
799you will be able to do logging.
800There is a large amount of information that can be logged.
801The log is arranged as a succession of levels.
802At the lowest level
803only extremely strange situations are logged.
804At the highest level,
805even the most mundane and uninteresting events
806are recorded for posterity.
807As a convention,
808log levels under ten
6ebbc09a 809are considered generally
69a914e1 810.q useful;
6ebbc09a
EA
811log levels above 64
812are reserved for debugging purposes.
813Levels from 11\-64 are reserved for verbose information
814that some sites might want.
69a914e1
EA
815.pp
816A complete description of the log levels
367a5dcd 817is given in section 4.6.
4da134f8
EA
818.sh 2 "The Mail Queue"
819.pp
820The mail queue should be processed transparently.
821However, you may find that manual intervention is sometimes necessary.
822For example,
823if a major host is down for a period of time
824the queue may become clogged.
825Although sendmail ought to recover gracefully when the host comes up,
826you may find performance unacceptably bad in the meantime.
3f83c754
EA
827.sh 3 "Printing the queue"
828.pp
829The contents of the queue can be printed
830using the
74b6e641
EA
831.i mailq
832command
833(or by specifying the
3f83c754 834.b \-bp
74b6e641 835flag to sendmail):
3f83c754 836.(b
74b6e641 837mailq
3f83c754
EA
838.)b
839This will produce a listing of the queue id's,
840the size of the message,
841the date the message entered the queue,
842and the sender and recipients.
4da134f8
EA
843.sh 3 "Forcing the queue"
844.pp
845.i Sendmail
846should run the queue automatically
847at intervals.
848The algorithm is to read and sort the queue,
849and then to attempt to process all jobs in order.
850When it attempts to run the job,
851.i sendmail
852first checks to see if the job is locked.
853If so, it ignores the job.
854.pp
855There is no attempt to insure that only one queue processor
856exists at any time,
857since there is no guarantee that a job cannot take forever
f13b6b36
EA
858to process
859(however,
860.i sendmail
861does include heuristics to try to abort jobs
862that are taking absurd amounts of time;
863technically, this violates RFC 821, but is blessed by RFC 1123).
4da134f8 864Due to the locking algorithm,
f13b6b36 865it is impossible for one job to freeze the entire queue.
4da134f8
EA
866However,
867an uncooperative recipient host
868or a program recipient
869that never returns
870can accumulate many processes in your system.
871Unfortunately,
f13b6b36 872there is no completely general way to solve this.
4da134f8
EA
873.pp
874In some cases,
875you may find that a major host going down
876for a couple of days
877may create a prohibitively large queue.
878This will result in
879.i sendmail
880spending an inordinate amount of time
881sorting the queue.
882This situation can be fixed by moving the queue to a temporary place
883and creating a new queue.
884The old queue can be run later when the offending host returns to service.
885.pp
886To do this,
887it is acceptable to move the entire queue directory:
888.(b
daae36f7 889cd /var/spool
d656ea51 890mv mqueue omqueue; mkdir mqueue; chmod 700 mqueue
4da134f8
EA
891.)b
892You should then kill the existing daemon
893(since it will still be processing in the old queue directory)
894and create a new daemon.
895.pp
896To run the old mail queue,
897run the following command:
898.(b
55c435aa 899/usr/\*(SD/sendmail \-oQ/var/spool/omqueue \-q
4da134f8
EA
900.)b
901The
2fb78b49 902.b \-oQ
4da134f8
EA
903flag specifies an alternate queue directory
904and the
905.b \-q
906flag says to just run every job in the queue.
907If you have a tendency toward voyeurism,
908you can use the
909.b \-v
910flag to watch what is going on.
911.pp
912When the queue is finally emptied,
913you can remove the directory:
914.(b
daae36f7 915rmdir /var/spool/omqueue
4da134f8
EA
916.)b
917.sh 2 "The Alias Database"
918.pp
919The alias database exists in two forms.
920One is a text form,
921maintained in the file
daae36f7 922.i /etc/aliases.
4da134f8
EA
923The aliases are of the form
924.(b
925name: name1, name2, ...
926.)b
927Only local names may be aliased;
928e.g.,
929.(b
daae36f7 930eric@prep.ai.MIT.EDU: eric@CS.Berkeley.EDU
4da134f8
EA
931.)b
932will not have the desired effect.
933Aliases may be continued by starting any continuation lines
934with a space or a tab.
935Blank lines and lines beginning with a sharp sign
936(\c
937.q # )
938are comments.
939.pp
940The second form is processed by the
74b6e641 941.i dbm \|(3)
f13b6b36
EA
942(or
943.i db \|(3))
4da134f8
EA
944library.
945This form is in the files
daae36f7 946.i /etc/aliases.dir
4da134f8 947and
daae36f7 948.i /etc/aliases.pag.
4da134f8
EA
949This is the form that
950.i sendmail
951actually uses to resolve aliases.
952This technique is used to improve performance.
953.sh 3 "Rebuilding the alias database"
954.pp
955The DBM version of the database
956may be rebuilt explicitly by executing the command
957.(b
74b6e641
EA
958newaliases
959.)b
960This is equivalent to giving
961.i sendmail
962the
963.b \-bi
964flag:
965.(b
55c435aa 966/usr/\*(SD/sendmail \-bi
4da134f8
EA
967.)b
968.pp
69a914e1
EA
969If the
970.q D
971option is specified in the configuration,
4da134f8 972.i sendmail
69a914e1
EA
973will rebuild the alias database automatically
974if possible
975when it is out of date.
69a914e1
EA
976Auto-rebuild can be dangerous
977on heavily loaded machines
b16e27c4
EA
978with large alias files;
979if it might take more than five minutes
980to rebuild the database,
981there is a chance that several processes will start the rebuild process
982simultaneously.
69a914e1 983.sh 3 "Potential problems"
4da134f8
EA
984.pp
985There are a number of problems that can occur
986with the alias database.
987They all result from a
988.i sendmail
989process accessing the DBM version
990while it is only partially built.
991This can happen under two circumstances:
992One process accesses the database
993while another process is rebuilding it,
994or the process rebuilding the database dies
995(due to being killed or a system crash)
996before completing the rebuild.
997.pp
998Sendmail has two techniques to try to relieve these problems.
999First, it ignores interrupts while rebuilding the database;
1000this avoids the problem of someone aborting the process
1001leaving a partially rebuilt database.
1002Second,
1003at the end of the rebuild
1004it adds an alias of the form
1005.(b
1006@: @
1007.)b
1008(which is not normally legal).
1009Before sendmail will access the database,
69a914e1
EA
1010it checks to insure that this entry exists\**.
1011.(f
1012\**The
1013.q a
1014option is required in the configuration
1015for this action to occur.
1016This should normally be specified
1017unless you are running
1018.i delivermail
1019in parallel with
1020.i sendmail.
1021.)f
631e7688
EA
1022.sh 3 "List owners"
1023.pp
1024If an error occurs on sending to a certain address,
1025say
1026.q \fIx\fP ,
1027.i sendmail
1028will look for an alias
1029of the form
1030.q owner-\fIx\fP
1031to receive the errors.
1032This is typically useful
1033for a mailing list
1034where the submitter of the list
28719ec2 1035has no control over the maintenance of the list itself;
631e7688
EA
1036in this case the list maintainer would be the owner of the list.
1037For example:
1038.(b
69a914e1
EA
1039unix-wizards: eric@ucbarpa, wnj@monet, nosuchuser,
1040 sam@matisse
631e7688
EA
1041owner-unix-wizards: eric@ucbarpa
1042.)b
1043would cause
1044.q eric@ucbarpa
1045to get the error that will occur
1046when someone sends to
1047unix-wizards
1048due to the inclusion of
1049.q nosuchuser
1050on the list.
f90dac5e
EA
1051.pp
1052List owners also cause the envelope sender address to be modified.
1053The contents of the owner alias are used if they point to a single user,
1054otherwise the name of the alias itself is used.
1055For this reason, and to obey Internet conventions,
1056a typical scheme would be:
1057.(b
1058list: some, set, of, addresses
1059list-request: list, administrators
1060owner-list: list-request
1061.)b
daae36f7
EA
1062.sh 2 "User Information Database"
1063.pp
1064If you have a version of
1065.i sendmail
1066with the user information database
1067compiled in,
1068and you have specified one or more databases using the
1069.b U
1070option,
1071the databases will be searched for a
1072.i user :maildrop
1073entry.
1074If found, the mail will be sent to the specified address.
1075.pp
1076If the first token passed to user part of the
1077.q local
1078mailer is an at sign,
1079the at sign will be stripped off
1080and this step will be skipped.
2fb78b49 1081.sh 2 "Per-User Forwarding (.forward Files)"
4da134f8 1082.pp
2fb78b49
EA
1083As an alternative to the alias database,
1084any user may put a file with the name
1085.q .forward
1086in his or her home directory.
1087If this file exists,
1088.i sendmail
1089redirects mail for that user
1090to the list of addresses listed in the .forward file.
1091For example, if the home directory for user
1092.q mckusick
1093has a .forward file with contents:
1094.(b
1095mckusick@ernie
1096kirk@calder
1097.)b
1098then any mail arriving for
1099.q mckusick
1100will be redirected to the specified accounts.
f13b6b36
EA
1101.pp
1102Actually, the configuration file defines a sequence of filenames to check.
1103By default, this is the user's .forward file,
1104but can be defined to be more generally using the
1105.b J
1106option.
1107If you change this,
1108you will have to inform your user base of the change;
1109\&.forward is pretty well incorporated into the collective subconscious.
2fb78b49 1110.sh 2 "Special Header Lines"
4da134f8 1111.pp
2fb78b49
EA
1112Several header lines have special interpretations
1113defined by the configuration file.
1114Others have interpretations built into
4da134f8 1115.i sendmail
2fb78b49
EA
1116that cannot be changed without changing the code.
1117These builtins are described here.
bff69eb1 1118.sh 3 "Return-Receipt-To:"
4da134f8 1119.pp
2fb78b49
EA
1120If this header is sent,
1121a message will be sent to any specified addresses
318b7556
EA
1122when the final delivery is complete,
1123that is,
1124when successfully delivered to a mailer with the
2fb78b49 1125.b l
bff69eb1
EA
1126flag (local delivery) set in the mailer descriptor.
1127.sh 3 "Errors-To:"
4da134f8 1128.pp
2fb78b49
EA
1129If errors occur anywhere during processing,
1130this header will cause error messages to go to
50d4a65c 1131the listed addresses.
2fb78b49 1132This is intended for mailing lists.
859d056a
EA
1133.pp
1134The Errors-To: header was created in the bad old days
1135when UUCP didn't understand the distinction between an envelope and a header;
1136this was a hack to provide what should now be passed
1137as the envelope sender address.
1138It should go away.
bff69eb1 1139.sh 3 "Apparently-To:"
4da134f8 1140.pp
2fb78b49
EA
1141If a message comes in with no recipients listed in the message
1142(in a To:, Cc:, or Bcc: line)
1143then
1144.i sendmail
1145will add an
1146.q "Apparently-To:"
1147header line for any recipients it is aware of.
1148This is not put in as a standard recipient line
1149to warn any recipients that the list is not complete.
4da134f8 1150.pp
2fb78b49 1151At least one recipient line is required under RFC 822.
25e4e430
EA
1152.sh 2 "IDENT Protocol Support"
1153.pp
1154.i Sendmail
1155supports the IDENT protocol as defined in RFC 1413.
6564d66c
EA
1156Although this enhances identification
1157of the author of an email message
1158by doing a ``call back'' to the originating system to include
1159the owner of a particular TCP connection
1160in the audit trail
25e4e430
EA
1161it is in no sense perfect;
1162a determined forger can easily spoof the IDENT protocol.
1163The following description is excerpted from RFC 1413:
1164.ba +5
11656. Security Considerations
1166.lp
1167The information returned by this protocol is at most as trustworthy
1168as the host providing it OR the organization operating the host. For
1169example, a PC in an open lab has few if any controls on it to prevent
1170a user from having this protocol return any identifier the user
1171wants. Likewise, if the host has been compromised the information
1172returned may be completely erroneous and misleading.
1173.lp
1174The Identification Protocol is not intended as an authorization or
1175access control protocol. At best, it provides some additional
1176auditing information with respect to TCP connections. At worst, it
1177can provide misleading, incorrect, or maliciously incorrect
1178information.
1179.lp
1180The use of the information returned by this protocol for other than
1181auditing is strongly discouraged. Specifically, using Identification
1182Protocol information to make access control decisions - either as the
1183primary method (i.e., no other checks) or as an adjunct to other
1184methods may result in a weakening of normal host security.
1185.lp
1186An Identification server may reveal information about users,
1187entities, objects or processes which might normally be considered
1188private. An Identification server provides service which is a rough
1189analog of the CallerID services provided by some phone companies and
1190many of the same privacy considerations and arguments that apply to
1191the CallerID service apply to Identification. If you wouldn't run a
1192"finger" server due to privacy considerations you may not want to run
1193this protocol.
1194.ba
2fb78b49 1195.sh 1 "ARGUMENTS"
4da134f8 1196.pp
2fb78b49
EA
1197The complete list of arguments to
1198.i sendmail
1199is described in detail in Appendix A.
1200Some important arguments are described here.
1201.sh 2 "Queue Interval"
4da134f8 1202.pp
2fb78b49
EA
1203The amount of time between forking a process
1204to run through the queue
1205is defined by the
1206.b \-q
1207flag.
1208If you run in mode
1209.b f
1210or
1211.b a
1212this can be relatively large,
1213since it will only be relevant
1214when a host that was down comes back up.
1215If you run in
1216.b q
1217mode
1218it should be relatively short,
1219since it defines the maximum amount of time that a message
1220may sit in the queue.
e920f7ff 1221.pp
859d056a
EA
1222RFC 1123 section 5.3.1.1 says that this value should be at least 30 minutes
1223(although that probably doesn't make sense if you use ``queue-only'' mode).
2fb78b49 1224.sh 2 "Daemon Mode"
4da134f8 1225.pp
2fb78b49
EA
1226If you allow incoming mail over an IPC connection,
1227you should have a daemon running.
1228This should be set by your
1229.i /etc/rc
1230file using the
1231.b \-bd
1232flag.
1233The
1234.b \-bd
1235flag and the
1236.b \-q
1237flag may be combined in one call:
1238.(b
55c435aa 1239/usr/\*(SD/sendmail \-bd \-q30m
4da134f8 1240.)b
2fb78b49 1241.sh 2 "Forcing the Queue"
4da134f8 1242.pp
2fb78b49
EA
1243In some cases you may find that the queue has gotten clogged for some reason.
1244You can force a queue run
1245using the
1246.b \-q
1247flag (with no value).
bff69eb1 1248It is entertaining to use the
2fb78b49
EA
1249.b \-v
1250flag (verbose)
1251when this is done to watch what happens:
1252.(b
55c435aa 1253/usr/\*(SD/sendmail \-q \-v
4da134f8 1254.)b
0780838b
EA
1255.pp
1256You can also limit the jobs to those with a particular queue identifier,
1257sender, or recipient
1258using one of the queue modifiers.
1259For example,
1260.q \-qRberkeley
1261restricts the queue run to jobs that have the string
1262.q berkeley
1263somewhere in one of the recipient addresses.
1264Similarly,
1265.q \-qSstring
1266limits the run to particular senders and
1267.q \-qIstring
1268limits it to particular identifiers.
2fb78b49
EA
1269.sh 2 "Debugging"
1270.pp
1271There are a fairly large number of debug flags
1272built into
1273.i sendmail .
1274Each debug flag has a number and a level,
1275where higher levels means to print out more information.
1276The convention is that levels greater than nine are
1277.q absurd,
1278i.e.,
1279they print out so much information that you wouldn't normally
1280want to see them except for debugging that particular piece of code.
1281Debug flags are set using the
1282.b \-d
1283option;
1284the syntax is:
4da134f8 1285.(b
2fb78b49
EA
1286.ta \w'debug-option 'u
1287debug-flag: \fB\-d\fP debug-list
1288debug-list: debug-option [ , debug-option ]
1289debug-option: debug-range [ . debug-level ]
1290debug-range: integer | integer \- integer
1291debug-level: integer
4da134f8 1292.)b
2fb78b49
EA
1293where spaces are for reading ease only.
1294For example,
4da134f8 1295.(b
2fb78b49
EA
1296\-d12 Set flag 12 to level 1
1297\-d12.3 Set flag 12 to level 3
1298\-d3-17 Set flags 3 through 17 to level 1
1299\-d3-17.4 Set flags 3 through 17 to level 4
4da134f8 1300.)b
2fb78b49
EA
1301For a complete list of the available debug flags
1302you will have to look at the code
1303(they are too dynamic to keep this documentation up to date).
1304.sh 2 "Trying a Different Configuration File"
4da134f8 1305.pp
2fb78b49
EA
1306An alternative configuration file
1307can be specified using the
1308.b \-C
1309flag; for example,
1310.(b
55c435aa 1311/usr/\*(SD/sendmail \-Ctest.cf
4da134f8 1312.)b
2fb78b49
EA
1313uses the configuration file
1314.i test.cf
1315instead of the default
daae36f7 1316.i /etc/sendmail.cf.
4da134f8 1317If the
2fb78b49
EA
1318.b \-C
1319flag has no value
1320it defaults to
1321.i sendmail.cf
1322in the current directory.
1323.sh 2 "Changing the Values of Options"
4da134f8 1324.pp
2fb78b49
EA
1325Options can be overridden using the
1326.b \-o
4da134f8 1327flag.
2fb78b49 1328For example,
4da134f8 1329.(b
55c435aa 1330/usr/\*(SD/sendmail \-oT2m
4da134f8 1331.)b
2fb78b49
EA
1332sets the
1333.b T
1334(timeout) option to two minutes
1335for this run only.
55c435aa
EA
1336.pp
1337Some options have security implications.
1338Sendmail allows you to set these,
3dfefb78 1339but refuses to run as root thereafter.
2fb78b49
EA
1340.sh 1 "TUNING"
1341.pp
1342There are a number of configuration parameters
1343you may want to change,
1344depending on the requirements of your site.
1345Most of these are set
1346using an option in the configuration file.
4da134f8 1347For example,
2fb78b49 1348the line
e920f7ff 1349.q OT5d
2fb78b49
EA
1350sets option
1351.q T
1352to the value
e920f7ff 1353.q 5d
859d056a 1354(five days).
1ef34914 1355.pp
d656ea51 1356Most of these options have appropriate defaults for most sites.
1ef34914
EA
1357However,
1358sites having very high mail loads may find they need to tune them
1359as appropriate for their mail load.
1360In particular,
1361sites experiencing a large number of small messages,
1362many of which are delivered to many recipients,
1363may find that they need to adjust the parameters
1364dealing with queue priorities.
2fb78b49
EA
1365.sh 2 "Timeouts"
1366.pp
1367All time intervals are set
1368using a scaled syntax.
1369For example,
1370.q 10m
1371represents ten minutes, whereas
1372.q 2h30m
1373represents two and a half hours.
1374The full set of scales is:
4da134f8 1375.(b
2fb78b49
EA
1376.ta 4n
1377s seconds
1378m minutes
1379h hours
1380d days
1381w weeks
4da134f8 1382.)b
2fb78b49 1383.sh 3 "Queue interval"
4da134f8 1384.pp
2fb78b49
EA
1385The argument to the
1386.b \-q
1387flag
55c435aa 1388specifies how often a sub-daemon will run the queue.
1ef34914
EA
1389This is typically set to between fifteen minutes
1390and one hour.
e920f7ff 1391RFC 1123 section 5.3.1.1 recommends that this be at least 30 minutes.
2fb78b49 1392.sh 3 "Read timeouts"
4da134f8 1393.pp
2fb78b49
EA
1394It is possible to time out when reading the standard input
1395or when reading from a remote SMTP server.
e920f7ff 1396These timeouts are set using the
2fb78b49
EA
1397.b r
1398option in the configuration file.
e920f7ff
EA
1399The argument is a list of
1400.i keyword=value
1401pairs.
1402The recognized keywords, their default values, and the minimum values
1403allowed by RFC 1123 section 5.3.2 are:
1404.nr ii 1i
1405.ip initial
1406The wait for the initial 220 greeting message
1407[5m, 5m].
1408.ip helo
475d7a3d 1409The wait for a reply from a HELO or EHLO command
e920f7ff
EA
1410[5m, unspecified].
1411This may require a host name lookup, so
1412five minutes is probably a reasonable minimum.
1413.ip mail\(dg
1414The wait for a reply from a MAIL command
1415[10m, 5m].
1416.ip rcpt\(dg
1417The wait for a reply from a RCPT command
1418[1h, 5m].
1419This should be long
1420because it could be pointing at a list
1421that takes a long time to expand.
1422.ip datainit\(dg
1423The wait for a reply from a DATA command
1424[5m, 2m].
1425.ip datablock\(dg
1426The wait for reading a data block
1427(that is, the body of the message).
1428[1h, 3m].
1429This should be long because it also applies to programs
1430piping input to
1431.i sendmail
1432which have no guarantee of promptness.
1433.ip datafinal\(dg
1434The wait for a reply from the dot terminating a message.
1435[1h, 10m].
890cda2d
EA
1436If this is shorter than the time actually needed
1437for the receiver to deliver the message,
1438duplicates will be generated.
1439This is discussed in RFC 1047.
e920f7ff
EA
1440.ip rset
1441The wait for a reply from a RSET command
1442[5m, unspecified].
1443.ip quit
1444The wait for a reply from a QUIT command
1445[2m, unspecified].
1446.ip misc
1447The wait for a reply from miscellaneous (but short) commands
1448such as NOOP (no-operation) and VERB (go into verbose mode).
1449[2m, unspecified].
1450.ip command\(dg
1451In server SMTP,
1452the time to wait for another command.
1453[1h, 5m].
1454.lp
1455For compatibility with old configuration files,
1456if no ``keyword='' is specified,
1457all the timeouts marked with \(dg are set to the indicated value.
55c435aa 1458.pp
e920f7ff
EA
1459Many of the RFC 1123 minimum values
1460may well be too short.
55c435aa 1461.i Sendmail
e920f7ff 1462was designed to the RFC 822 protocols,
55c435aa
EA
1463which did not specify read timeouts;
1464hence,
1465.i sendmail
1466does not guarantee to reply to messages promptly.
1467In particular, a
1468.q RCPT
1469command specifying a mailing list
1470will expand and verify the entire list;
1471a large list on a slow system
1472may take more than five minutes\**.
1473.(f
1474\**This verification includes looking up every address
1475with the name server;
1476this involves network delays,
1477and can in some cases can be considerable.
1478.)f
e920f7ff 1479I recommend a one hour timeout \*-
55c435aa
EA
1480since this failure is rare,
1481a long timeout is not onerous
1482and may ultimately help reduce network load.
1483.pp
e920f7ff
EA
1484For example, the line:
1485.(b
1486Orcommand=25m,datablock=3h
1487.)b
1488sets the server SMTP command timeout to 25 minutes
1489and the input data block timeout to three hours.
2fb78b49 1490.sh 3 "Message timeouts"
4da134f8 1491.pp
2fb78b49
EA
1492After sitting in the queue for a few days,
1493a message will time out.
1494This is to insure that at least the sender is aware
1495of the inability to send a message.
1496The timeout is typically set to three days.
1497This timeout is set using the
1498.b T
1499option in the configuration file.
1500.pp
1501The time of submission is set in the queue,
1502rather than the amount of time left until timeout.
1503As a result, you can flush messages that have been hanging
1504for a short period
1505by running the queue
1506with a short message timeout.
1507For example,
4da134f8 1508.(b
55c435aa 1509/usr/\*(SD/sendmail \-oT1d \-q
4da134f8 1510.)b
2fb78b49
EA
1511will run the queue
1512and flush anything that is one day old.
55c435aa
EA
1513.pp
1514Since this option is global,
1515and since you can not
1516.i "a priori"
1517know how long another host outside your domain will be down,
e920f7ff 1518a five day timeout is recommended.
55c435aa 1519This allows a recipient to fix the problem even if it occurs
e920f7ff
EA
1520at the beginning of a long weekend.
1521RFC 1123 section 5.3.1.1 says that this parameter
1522should be ``at least 4\-5 days''.
31e506e2
EA
1523.pp
1524The
1525.b T
1526option can also take a second timeout indicating a time after which
1527a warning message should be sent;
1528the two timeouts are separated by a slash.
1529For example, the value
1530.(b
15315d/4h
1532.)b
1533causes email to fail after five days,
1534but a warning message will be sent after four hours.
1535This should be large enough that the message will have been tried
1536several times.
1ef34914
EA
1537.sh 2 "Forking During Queue Runs"
1538.pp
1539By setting the
1540.b Y
1541option,
1542.i sendmail
1543will fork before each individual message
1544while running the queue.
1545This will prevent
1546.i sendmail
1547from consuming large amounts of memory,
1548so it may be useful in memory-poor environments.
1549However, if the
1550.b Y
1551option is not set,
1552.i sendmail
1553will keep track of hosts that are down during a queue run,
1554which can improve performance dramatically.
55c435aa
EA
1555.pp
1556If the
1557.b Y
1558option is set,
1559.i sendmail
1560can not use connection caching.
1ef34914
EA
1561.sh 2 "Queue Priorities"
1562.pp
1563Every message is assigned a priority when it is first instantiated,
1564consisting of the message size (in bytes)
1565offset by the message class times the
1566.q "work class factor"
1567and the number of recipients times the
1568.q "work recipient factor."
55aab950 1569The priority is used to order the queue.
1ef34914
EA
1570Higher numbers for the priority mean that the message will be processed later
1571when running the queue.
1572.pp
1573The message size is included so that large messages are penalized
1574relative to small messages.
1575The message class allows users to send
1576.q "high priority"
1577messages by including a
1578.q Precedence:
1579field in their message;
1580the value of this field is looked up in the
1581.b P
1582lines of the configuration file.
1583Since the number of recipients affects the amount of load a message presents
1584to the system,
1585this is also included into the priority.
1586.pp
1587The recipient and class factors
1588can be set in the configuration file using the
1589.b y
1590and
1591.b z
1592options respectively.
55aab950 1593They default to 30000 (for the recipient factor)
1ef34914
EA
1594and 1800
1595(for the class factor).
367a5dcd 1596The initial priority is:
d656ea51 1597.EQ
55aab950 1598pri = size - (class times bold z) + (nrcpt times bold y)
d656ea51 1599.EN
367a5dcd
EA
1600(Remember, higher values for this parameter actually mean
1601that the job will be treated with lower priority.)
1ef34914
EA
1602.pp
1603The priority of a job can also be adjusted each time it is processed
1604(that is, each time an attempt is made to deliver it)
1605using the
1606.q "work time factor,"
1607set by the
1608.b Z
1609option.
1610This is added to the priority,
1611so it normally decreases the precedence of the job,
1612on the grounds that jobs that have failed many times
1613will tend to fail again in the future.
55aab950
EA
1614The
1615.b Z
1616option defaults to 90000.
1ef34914
EA
1617.sh 2 "Load Limiting"
1618.pp
1619.i Sendmail
1620can be asked to queue (but not deliver)
1621mail if the system load average gets too high
1622using the
1623.b x
1624option.
1625When the load average exceeds the value of the
1626.b x
1627option,
1628the delivery mode is set to
1629.b q
1630(queue only)
1631if the
1632.i "Queue Factor"
1633(\c
1634.b q
1635option)
1636divided by the difference in the current load average and the
1637.b x
1638option
1639plus one
1640exceeds the priority of the message \(em
1641that is, the message is queued iff:
1642.EQ
890cda2d 1643pri > { bold q } over { LA - { bold x } + 1 }
1ef34914
EA
1644.EN
1645The
1646.b q
55aab950
EA
1647option defaults to 200000,
1648so each point of load average is worth 200000
1ef34914 1649priority points
55aab950 1650(as described above).
1ef34914
EA
1651.pp
1652For drastic cases,
1653the
1654.b X
1655option defines a load average at which sendmail will refuse
1656to accept network connections.
1657Locally generated mail
1658(including incoming UUCP mail)
1659is still accepted.
2fb78b49 1660.sh 2 "Delivery Mode"
4da134f8 1661.pp
2fb78b49 1662There are a number of delivery modes that
4da134f8 1663.i sendmail
2fb78b49
EA
1664can operate in,
1665set by the
1666.q d
1667configuration option.
1668These modes
1669specify how quickly mail will be delivered.
1670Legal modes are:
4da134f8 1671.(b
2fb78b49
EA
1672.ta 4n
1673i deliver interactively (synchronously)
1674b deliver in background (asynchronously)
1675q queue only (don't deliver)
4da134f8 1676.)b
2fb78b49
EA
1677There are tradeoffs.
1678Mode
1679.q i
1680passes the maximum amount of information to the sender,
1681but is hardly ever necessary.
1682Mode
1683.q q
1684puts the minimum load on your machine,
1685but means that delivery may be delayed for up to the queue interval.
1686Mode
1687.q b
1688is probably a good compromise.
74b6e641
EA
1689However, this mode can cause large numbers of processes
1690if you have a mailer that takes a long time to deliver a message.
859d056a
EA
1691.pp
1692If you run in mode
1693.q q
1694(queue only)
1695.i sendmail
1696will not expand aliases and follow .forward files
1697upon initial receipt of the mail.
1698This speeds up the response to RCPT commands.
2fb78b49 1699.sh 2 "Log Level"
4da134f8 1700.pp
2fb78b49
EA
1701The level of logging can be set for sendmail.
1702The default using a standard configuration table is level 9.
1703The levels are as follows:
d656ea51 1704.nr ii 0.5i
2fb78b49
EA
1705.ip 0
1706No logging.
1707.ip 1
6ebbc09a 1708Serious system failures and potential security problems.
2fb78b49 1709.ip 2
6ebbc09a 1710Lost communications (network problems) and protocol failures.
2fb78b49 1711.ip 3
6ebbc09a 1712Other serious failures.
2fb78b49 1713.ip 4
6ebbc09a 1714Minor failures.
2fb78b49 1715.ip 5
6ebbc09a 1716Message collection statistics.
2fb78b49 1717.ip 6
6ebbc09a
EA
1718Creation of error messages,
1719VRFY and EXPN commands.
1720.ip 7
1721Delivery failures (host or user unknown, etc.).
1722.ip 8
1723Successful deliveries.
ef1c322e 1724.ip 9
6ebbc09a
EA
1725Messages being deferred
1726(due to a host being down, etc.).
1727.ip 10
1728Database expansion (alias, forward, and userdb lookups).
1729.ip 15
1730Automatic alias database rebuilds.
1731.ip 20
d656ea51
EA
1732Logs attempts to run locked queue files.
1733These are not errors,
1734but can be useful to note if your queue appears to be clogged.
6ebbc09a
EA
1735.ip 30
1736Lost locks (only if using lockf instead of flock).
1737.lp
1738Additionally,
1739values above 64 are reserved for extremely verbose debuggging output.
1740No normal site would ever set these.
2fb78b49 1741.sh 2 "File Modes"
4da134f8 1742.pp
2fb78b49
EA
1743There are a number of files
1744that may have a number of modes.
1745The modes depend on what functionality you want
1746and the level of security you require.
1747.sh 3 "To suid or not to suid?"
4da134f8 1748.pp
2fb78b49
EA
1749.i Sendmail
1750can safely be made
1751setuid to root.
1752At the point where it is about to
74b6e641 1753.i exec \|(2)
2fb78b49
EA
1754a mailer,
1755it checks to see if the userid is zero;
1756if so,
1757it resets the userid and groupid to a default
1758(set by the
1759.b u
4da134f8 1760and
2fb78b49
EA
1761.b g
1762options).
1763(This can be overridden
1764by setting the
1765.b S
1766flag to the mailer
1767for mailers that are trusted
1768and must be called as root.)
1769However,
1770this will cause mail processing
1771to be accounted
1772(using
74b6e641 1773.i sa \|(8))
2fb78b49
EA
1774to root
1775rather than to the user sending the mail.
2fb78b49 1776.sh 3 "Should my alias database be writable?"
4da134f8 1777.pp
2fb78b49
EA
1778At Berkeley
1779we have the alias database
daae36f7 1780(/etc/aliases*)
18843c53
PL
1781mode 644.
1782While this is not as flexible as if the database
1783were more 666, it avoids potential security problems
1784with a globally writable database.
4da134f8 1785.pp
2fb78b49
EA
1786The database that
1787.i sendmail
1788actually used
1789is represented by the two files
1790.i aliases.dir
4da134f8 1791and
2fb78b49 1792.i aliases.pag
de7324ac
EA
1793(both in /etc)
1794(or
1795.i aliases.db
1796if you are running with the new Berkeley database primitives).
2fb78b49 1797The mode on these files should match the mode
daae36f7 1798on /etc/aliases.
2fb78b49
EA
1799If
1800.i aliases
1801is writable
1802and the
1803DBM
1804files
4da134f8 1805(\c
2fb78b49
EA
1806.i aliases.dir
1807and
1808.i aliases.pag )
1809are not,
1810users will be unable to reflect their desired changes
1811through to the actual database.
1812However,
1813if
1814.i aliases
1815is read-only
1816and the DBM files are writable,
1817a slightly sophisticated user
1818can arrange to steal mail anyway.
4da134f8 1819.pp
2fb78b49
EA
1820If your DBM files are not writable by the world
1821or you do not have auto-rebuild enabled
1822(with the
1823.q D
1824option),
1825then you must be careful to reconstruct the alias database
1826each time you change the text version:
4da134f8 1827.(b
74b6e641 1828newaliases
4da134f8 1829.)b
2fb78b49
EA
1830If this step is ignored or forgotten
1831any intended changes will also be ignored or forgotten.
55c435aa
EA
1832.sh 2 "Connection Caching"
1833.pp
1834When processing the queue,
1835.b sendmail
1836will try to keep the last few open connections open
1837to avoid startup and shutdown costs.
1838This only applies to IPC connections.
1839.pp
1840When trying to open a connection
1841the cache is first searched.
1842If an open connection is found, it is probed to see if it is still active
1843by sending a
1844.sm NOOP
1845command.
1846It is not an error if this fails;
1847instead, the connection is closed and reopened.
1848.pp
1849Two parameters control the connection cache.
1850The
1851.b k
1852option defines the number of simultaneous open connections
1853that will be permitted.
1854If it is set to zero,
1855connections will be closed as quickly as possible.
1856The default is one.
1857This should be set as appropriate for your system size;
1858it will limit the amount of system resources that
1859.b sendmail
1860will use during queue runs.
1861.pp
1862The
1863.b K
1864option specifies the maximum time that any cached connection
1865will be permitted to idle.
1866When the idle time exceeds this value
1867the connection is closed.
1868This number should be small
1869(under ten minutes)
1870to prevent you from grabbing too many resources
1871from other hosts.
1872The default is five minutes.
1873.sh 2 "Name Server Access"
1874.pp
1875If your system supports the name server,
1876then the probability is that
1877.i sendmail
1878will be using it regardless of how you configure sendmail.
d656ea51
EA
1879However, if you have nameserver support
1880which you are not using,
1881sendmail will get a
1882.q "connection refused"
1883message when it tries to connect to the name server
1884(either by calling
55c435aa 1885.i gethostbyname
d656ea51
EA
1886or by trying to look up the MX records).
1887If the
55c435aa 1888.b I
d656ea51
EA
1889option is set,
1890.i sendmail
1891will interpret this to mean a temporary failure;
1892otherwise, it ignores the name server data.
1893If your name server is running properly,
1894the setting of this option is not relevant;
1895however, it is important that it be set properly
1896to make error handling work properly.
55c435aa 1897.pp
599d791f
EA
1898This option also allows you to tweak name server options.
1899The command line takes a series of flags as documented in
1900.i resolver (3)
1901(with the leading
1902.q RES_
1903deleted).
1904Each can be preceded by an optional `+' or `\(mi'.
1905For example, the line
1906.(b
1907OITrue +AAONLY \(miDNSRCH
1908.)b
1909turns on the AAONLY (accept authoritative answers only)
1910and turns off the DNSRCH (search the domain path) options.
1911Most resolver libraries default DNSRCH, DEFNAMES, and RECURSE
1912flags on and all others off.
1913Note the use of the initial ``True'' \*-
1914this is for compatibility with previous versions of sendmail,
1915but is not otherwise necessary.
1916.pp
859d056a 1917Version level 1 configurations
599d791f
EA
1918turn DNSRCH and DEFNAMES off when doing delivery lookups,
1919but leave them on everywhere else.
acbfac81 1920Version 6 of
599d791f
EA
1921.i sendmail
1922ignores them when doing canonification lookups
1923(that is, when using $[ ... $]),
1924and always does the search.
1925If you don't want to do automatic name extension,
1926don't call $[ ... $].
1927.pp
1928The search rules for $[ ... $] are somewhat different than usual.
1929If the name (that is, the ``...'')
1930has at least one dot, it always tries the unmodified name first.
1931If that fails, it tries the reduced search path,
1932and lastly tries the unmodified name
1933(but only for names without a dot,
1934since names with a dot have already been tried).
1935This allows names such as
1936``utc.CS''
1937to match the site in Czechoslovakia
1938rather than the site in your local Computer Science department.
6d5ff626
EA
1939It also prefers A and CNAME records over MX records \*-
1940that is, if it finds an MX record it makes note of it,
1941but keeps looking.
1942This way, if you have a wildcard MX record matching your domain,
1943it will not assume that all names match.
f13b6b36
EA
1944.sh 2 "Moving the Per-User Forward Files"
1945.pp
1946Some sites mount each user's home directory
1947from a local disk on their workstation,
1948so that local access is fast.
1949However, the result is that .forward file lookups are slow.
1950In some cases,
1951mail can even be delivered on machines inappropriately
1952because of a file server being down.
1953The performance can be especially bad if you run the automounter.
1954.pp
1955The
1956.b J
1957option allows you to set a path of forward files.
1958For example, the config file line
1959.(b
1960OJ/var/forward/$u:$z/.forward
1961.)b
1962would first look for a file with the same name as the user's login
1963in /var/forward;
1964if that is not found (or is inaccessible)
1965the file
1966.q \&.forward
1967in the user's home directory is searched.
1968A truly perverse site could also search by sender
1969by using $r, $s, or $f.
1970.pp
1971If you create a directory such as /var/forward,
1972it should be mode 1777
1973(that is, the sticky bit should be set).
1974Users should create the files mode 644.
59baf33c
EA
1975.sh 2 "Free Space"
1976.pp
859d056a 1977On systems that have the
59baf33c
EA
1978.i statfs (2)
1979system call,
1980you can specify a minimum number of free blocks on the queue filesystem
1981using the
1982.b b
1983option.
1984If there are fewer than the indicated number of blocks free
1985on the filesystem on which the queue is mounted
1986the SMTP server will reject mail
1987with the
1988452 error code.
1989This invites the SMTP client to try again later.
1990.pp
1991Beware of setting this option too high;
1992it can cause rejection of email
1993when that mail would be processed without difficulty.
50d4a65c
EA
1994.pp
1995This option can also specify an advertised
1996.q "maximum message size"
1997for hosts that speak ESMTP.
59baf33c
EA
1998.sh 2 "Privacy Flags"
1999.pp
2000The
2001.b p
2002option allows you to set certain
2003``privacy''
2004flags.
2005Actually, many of them don't give you any extra privacy,
2006rather just insisting that client SMTP servers
2007use the HELO command
2008before using certain commands.
2009.pp
2010The option takes a series of flag names;
2011the final privacy is the inclusive or of those flags.
2012For example:
2013.(b
2014Ob needmailhelo, noexpn
2015.)b
475d7a3d 2016insists that the HELO or EHLO command be used before a MAIL command is accepted
59baf33c 2017and disables the EXPN command.
890cda2d
EA
2018.pp
2019The
2020.q restrictmailq
2021option restricts printing the queue to the group that owns the queue directory.
2022It is absurd to set this if you don't also protect the logs.
2fb78b49 2023.sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
4da134f8 2024.pp
2fb78b49
EA
2025This section describes the configuration file
2026in detail,
2027including hints on how to write one of your own
2028if you have to.
4da134f8 2029.pp
2fb78b49
EA
2030There is one point that should be made clear immediately:
2031the syntax of the configuration file
2032is designed to be reasonably easy to parse,
2033since this is done every time
2034.i sendmail
2035starts up,
2036rather than easy for a human to read or write.
2037On the
2038.q "future project"
2039list is a
2040configuration-file compiler.
4da134f8 2041.pp
2fb78b49
EA
2042An overview of the configuration file
2043is given first,
2044followed by details of the semantics.
de7324ac 2045.sh 2 "Configuration File Lines"
2fb78b49
EA
2046.pp
2047The configuration file is organized as a series of lines,
2048each of which begins with a single character
2049defining the semantics for the rest of the line.
2050Lines beginning with a space or a tab
2051are continuation lines
2052(although the semantics are not well defined in many places).
2053Blank lines and lines beginning with a sharp symbol
2054(`#')
2055are comments.
2056.sh 3 "R and S \*- rewriting rules"
2057.pp
2058The core of address parsing
2059are the rewriting rules.
2060These are an ordered production system.
2061.i Sendmail
2062scans through the set of rewriting rules
2063looking for a match on the left hand side
2064(LHS)
2065of the rule.
2066When a rule matches,
2067the address is replaced by the right hand side
2068(RHS)
2069of the rule.
2070.pp
2071There are several sets of rewriting rules.
2072Some of the rewriting sets are used internally
2073and must have specific semantics.
2074Other rewriting sets
2075do not have specifically assigned semantics,
2076and may be referenced by the mailer definitions
2077or by other rewriting sets.
2078.pp
2079The syntax of these two commands are:
2080.(b F
2081.b S \c
4da134f8 2082.i n
2fb78b49
EA
2083.)b
2084Sets the current ruleset being collected to
4da134f8 2085.i n .
2fb78b49
EA
2086If you begin a ruleset more than once
2087it deletes the old definition.
2088.(b F
2089.b R \c
2090.i lhs
2091.i rhs
2092.i comments
4da134f8 2093.)b
4da134f8 2094The
2fb78b49
EA
2095fields must be separated
2096by at least one tab character;
2097there may be embedded spaces
2098in the fields.
4da134f8 2099The
2fb78b49
EA
2100.i lhs
2101is a pattern that is applied to the input.
2102If it matches,
2103the input is rewritten to the
2104.i rhs .
2105The
2106.i comments
2107are ignored.
7c1a78dc
EA
2108.pp
2109Macro expansions of the form
2110.b $ \c
2111.i x
2112are performed when the configuration file is read.
2113Expansions of the form
2114.b $& \c
2115.i x
2116are performed at run time using a somewhat less general algorithm.
2117This for is intended only for referencing internally defined macros
2118such as
2119.b $h
2120that are changed at runtime.
de7324ac
EA
2121.sh 4 "The left hand side"
2122.pp
2123The left hand side of rewriting rules contains a pattern.
2124Normal words are simply matched directly.
2125Metasyntax is introduced using a dollar sign.
2126The metasymbols are:
2127.(b
2128.ta \w'\fB$=\fP\fIx\fP 'u
2129\fB$*\fP Match zero or more tokens
2130\fB$+\fP Match one or more tokens
2131\fB$\-\fP Match exactly one token
dd905b60 2132\fB$=\fP\fIx\fP Match any phrase in class \fIx\fP
7901972a 2133\fB$~\fP\fIx\fP Match any word not in class \fIx\fP
de7324ac
EA
2134.)b
2135If any of these match,
2136they are assigned to the symbol
2137.b $ \c
2138.i n
2139for replacement on the right hand side,
2140where
2141.i n
2142is the index in the LHS.
2143For example,
2144if the LHS:
2145.(b
2146$\-:$+
2147.)b
2148is applied to the input:
2149.(b
2150UCBARPA:eric
2151.)b
2152the rule will match, and the values passed to the RHS will be:
2153.(b
2154.ta 4n
2155$1 UCBARPA
2156$2 eric
2157.)b
acbfac81
EA
2158.pp
2159Additionally, the LHS can include
2160.b $@
2161to match zero tokens.
2162This is
2163.i not
2164bound to a
2165.b $ \c
2166.i N
2167on the RHS, and is normally only used when it stands alone
2168in order to match the null input.
de7324ac
EA
2169.sh 4 "The right hand side"
2170.pp
2171When the left hand side of a rewriting rule matches,
2172the input is deleted and replaced by the right hand side.
2173Tokens are copied directly from the RHS
2174unless they begin with a dollar sign.
2175Metasymbols are:
2176.(b
2177.ta \w'$#mailer\0\0\0'u
2178\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
2179\fB$[\fP\fIname\fP\fB$]\fP Canonicalize \fIname\fP
2180\fB$(\fP\fImap key\fP \fB$@\fP\fIarguments\fP \fB$:\fP\fIdefault\fP \fB$)\fP
2181 Generalized keyed mapping function
2182\fB$>\fP\fIn\fP \*(lqCall\*(rq ruleset \fIn\fP
2183\fB$#\fP\fImailer\fP Resolve to \fImailer\fP
2184\fB$@\fP\fIhost\fP Specify \fIhost\fP
2185\fB$:\fP\fIuser\fP Specify \fIuser\fP
2186.)b
2187.pp
2188The
2189.b $ \c
2190.i n
2191syntax substitutes the corresponding value from a
2192.b $+ ,
2193.b $\- ,
2194.b $* ,
2195.b $= ,
2196or
2197.b $~
2198match on the LHS.
2199It may be used anywhere.
2200.pp
2201A host name enclosed between
2202.b $[
2203and
2204.b $]
2205is looked up using the
2206.i gethostent \|(3)
59baf33c
EA
2207routines and replaced by the canonical name\**.
2208.(f
2209\**This is actually
2210completely equivalent
2211to $(host \fIhostname\fP$).
2212In particular, a
2213.b $:
2214default can be used.
2215.)f
de7324ac
EA
2216For example,
2217.q $[csam$]
2218might become
2219.q lbl-csam.arpa
2220and
2221.q $[[128.32.130.2]$]
2222would become
2223.q vangogh.CS.Berkeley.EDU.
859d056a
EA
2224.i Sendmail
2225recognizes it's numeric IP address
2226without calling the name server
2227and replaces it with it's canonical name.
de7324ac
EA
2228.pp
2229The
2230.b $(
2231\&...
2232.b $)
2233syntax is a more general form of lookup;
2234it uses a named map instead of an implicit map.
2235If no lookup is found, the indicted
2236.i default
2237is inserted;
2238if no default is specified and no lookup matches,
2239the value is left unchanged.
2240.pp
2241The
2242.b $> \c
2243.i n
2244syntax
2245causes the remainder of the line to be substituted as usual
2246and then passed as the argument to ruleset
2247.i n .
2248The final value of ruleset
2249.i n
2250then becomes
2251the substitution for this rule.
2252.pp
2253The
2254.b $#
2255syntax should
2256.i only
2257be used in ruleset zero.
2258It causes evaluation of the ruleset to terminate immediately,
2259and signals to sendmail that the address has completely resolved.
2260The complete syntax is:
2261.(b
859d056a 2262\fB$#\fP\fImailer\fP \fB$@\fP\fIhost\fP \fB$:\fP\fIuser\fP
de7324ac
EA
2263.)b
2264This specifies the
2265{mailer, host, user}
22663-tuple necessary to direct the mailer.
2267If the mailer is local
f6d3c63d
EA
2268the host part may be omitted\**.
2269.(f
2270\**You may want to use it for special
2271.q "per user"
2272extensions.
2273For example, at CMU you can send email to
2274.q jgm+foo ;
2275the part after the plus sign
2276is not part of the user name,
2277and is passed to the local mailer for local use.
2278.)f
de7324ac
EA
2279The
2280.i mailer
de7324ac
EA
2281must be a single word,
2282but the
337767a9
EA
2283.i host
2284and
de7324ac
EA
2285.i user
2286may be multi-part.
337767a9
EA
2287If the
2288.i mailer
2289is the builtin IPC mailer,
2290the
2291.i host
2292may be a colon-separated list of hosts
2293that are searched in order for the first working address
2294(exactly like MX records).
de7324ac
EA
2295.pp
2296A RHS may also be preceded by a
2297.b $@
2298or a
2299.b $:
2300to control evaluation.
2301A
2302.b $@
2303prefix causes the ruleset to return with the remainder of the RHS
2304as the value.
2305A
2306.b $:
2307prefix causes the rule to terminate immediately,
2308but the ruleset to continue;
2309this can be used to avoid continued application of a rule.
2310The prefix is stripped before continuing.
2311.pp
2312The
2313.b $@
2314and
2315.b $:
2316prefixes may precede a
2317.b $>
2318spec;
2319for example:
2320.(b
2321.ta 8n
859d056a 2322R$+ $: $>7 $1
de7324ac
EA
2323.)b
2324matches anything,
2325passes that to ruleset seven,
2326and continues;
2327the
2328.b $:
2329is necessary to avoid an infinite loop.
2330.pp
2331Substitution occurs in the order described,
2332that is,
2333parameters from the LHS are substituted,
2334hostnames are canonicalized,
2335.q subroutines
2336are called,
2337and finally
2338.b $# ,
2339.b $@ ,
2340and
2341.b $:
2342are processed.
475d7a3d
EA
2343.sh 4 "Semantics of rewriting rule sets"
2344.pp
2345There are five rewriting sets
2346that have specific semantics.
2347These are related as depicted by figure 2.
2348.(z
2349.hl
2350.ie n \{\
2351.(c
2352 +---+
2353 -->| 0 |-->resolved address
2354 / +---+
2355 / +---+ +---+
2356 / ---->| 1 |-->| S |--
2357 +---+ / +---+ / +---+ +---+ \e +---+
2358addr-->| 3 |-->| D |-- --->| 4 |-->msg
2359 +---+ +---+ \e +---+ +---+ / +---+
2360 --->| 2 |-->| R |--
2361 +---+ +---+
2362.)c
2363
2364.\}
2365.el .ie !"\*(.T"" \
2366\{\
2367.PS
2368boxwid = 0.3i
2369boxht = 0.3i
2370movewid = 0.3i
2371moveht = 0.3i
2372linewid = 0.3i
2373lineht = 0.3i
2374
2375 box invis "addr"; arrow
2376Box3: box "3"
2377A1: arrow
2378BoxD: box "D"; line; L1: Here
2379C: [
2380 C1: arrow; box "1"; arrow; box "S"; line; E1: Here
2381 move to C1 down 0.5; right
2382 C2: arrow; box "2"; arrow; box "R"; line; E2: Here
2383 ] with .w at L1 + (0.5, 0)
2384 move to C.e right 0.5
2385L4: arrow; box "4"; arrow; box invis "msg"
2386 line from L1 to C.C1
2387 line from L1 to C.C2
2388 line from C.E1 to L4
2389 line from C.E2 to L4
2390 move to BoxD.n up 0.6; right
2391Box0: arrow; box "0"
2392 arrow; box invis "resolved address" width 1.3
2393 line from 1/3 of the way between A1 and BoxD.w to Box0
2394.PE
2395.\}
2396.el .sp 2i
2397.ce
2398Figure 2 \*- Rewriting set semantics
2399.(c
2400D \*- sender domain addition
2401S \*- mailer-specific sender rewriting
2402R \*- mailer-specific recipient rewriting
2403.)c
2404.hl
2405.)z
2406.pp
2407Ruleset three
2408should turn the address into
2409.q "canonical form."
2410This form should have the basic syntax:
2411.(b
2412local-part@host-domain-spec
2413.)b
2414If no
2415.q @
2416sign is specified,
2417then the
2418host-domain-spec
2419.i may
2420be appended from the
2421sender address
2422(if the
2423.b C
2424flag is set in the mailer definition
2425corresponding to the
2426.i sending
2427mailer).
2428Ruleset three
2429is applied by sendmail
2430before doing anything with any address.
2431.pp
2432Ruleset zero
2433is applied after ruleset three
2434to addresses that are going to actually specify recipients.
2435It must resolve to a
2436.i "{mailer, host, user}"
2437triple.
2438The
2439.i mailer
2440must be defined in the mailer definitions
2441from the configuration file.
2442The
2443.i host
2444is defined into the
2445.b $h
2446macro
2447for use in the argv expansion of the specified mailer.
2448.pp
2449Rulesets one and two
2450are applied to all sender and recipient addresses respectively.
2451They are applied before any specification
2452in the mailer definition.
2453They must never resolve.
2454.pp
2455Ruleset four is applied to all addresses
2456in the message.
2457It is typically used
2458to translate internal to external form.
2459.sh 4 "IPC mailers"
2460.pp
2461Some special processing occurs
337767a9
EA
2462if the ruleset zero resolves to an IPC mailer
2463(that is, a mailer that has
2464.q [IPC]
2465listed as the Path in the
2466.b M
2467configuration line.
475d7a3d
EA
2468The host name passed after
2469.q $@
2470has MX expansion performed;
2471this looks the name up in DNS to find alternate delivery sites.
2472.pp
2473The host name can also be provided as a dotted quad in square brackets;
2474for example:
2475.(b
2476[128.32.149.78]
2477.)b
2478This causes direct conversion of the numeric value
2479to a TCP/IP host address.
2480.pp
337767a9
EA
2481The host name passed in after the
2482.q $@
2483may also be a colon-separated list of hosts.
2484Each is separately MX expanded and the results are concatenated
2485to make (essentially) one long MX list.
2486The intent here is to create
2487.q fake
2488MX records that are not published in DNS
2489for private internal networks.
2490.pp
475d7a3d
EA
2491As a final special case, the host name can be passed in
2492as a text string
2493in square brackets:
2494.(b
2495[ucbvax.berkeley.edu]
2496.)b
2497This form avoids the MX mapping.
2498.b N.B.:
2499This is intended only for situations where you have a network firewall,
2500so that your MX record points to a gateway machine;
2501this machine could then do direct delivery to machines
2502within your local domain.
2503Use of this feature directly violates RFC 1123 section 5.3.5:
2504it should not be used lightly.
2505.sh 3 "D \*- define macro"
2fb78b49
EA
2506.pp
2507Macros are named with a single character.
2508These may be selected from the entire ASCII set,
2509but user-defined macros
2510should be selected from the set of upper case letters only.
2511Lower case letters
2512and special symbols
2513are used internally.
2514.pp
2515The syntax for macro definitions is:
2516.(b F
2517.b D \c
2518.i x\|val
2519.)b
2520where
2521.i x
2522is the name of the macro
4da134f8 2523and
2fb78b49
EA
2524.i val
2525is the value it should have.
2fb78b49 2526.pp
de7324ac
EA
2527Macros are interpolated
2528using the construct
2529.b $ \c
2530.i x ,
2531where
2532.i x
2533is the name of the macro to be interpolated.
7c1a78dc
EA
2534This interpolation is done when the configuration file is read,
2535except in
2536.b M
2537lines.
2538The special construct
2539.b $& \c
2540.i x
2541can be used in
2542.b R
2543lines to get deferred interpolation.
2fb78b49 2544.pp
de7324ac 2545Conditionals can be specified using the syntax:
4da134f8 2546.(b
de7324ac 2547$?x text1 $| text2 $.
4da134f8 2548.)b
de7324ac
EA
2549This interpolates
2550.i text1
2551if the macro
2552.b $x
2553is set,
2fb78b49 2554and
de7324ac
EA
2555.i text2
2556otherwise.
2557The
2558.q else
2559(\c
2560.b $| )
2561clause may be omitted.
4da134f8 2562.pp
7c1a78dc
EA
2563Lower case macro names are reserved to have
2564special semantics,
2565used to pass information in or out of sendmail,
2566and special characters are reserved to
2567provide conditionals, etc.
2568Upper case names
2569(that is,
2570.b $A
2571through
2572.b $Z )
2573are specifically reserved for configuration file authors.
2574.pp
de7324ac
EA
2575The following macros
2576.i must
2577be defined to transmit information into
2578.i sendmail:
0a9ea158 2579.(b
de7324ac
EA
2580.ta 4n
2581e The SMTP entry message
2582j The \*(lqofficial\*(rq domain name for this site
2583l The format of the UNIX from line
2584n The name of the daemon (for error messages)
2585o The set of "operators" in addresses
2586q default format of sender address
2fb78b49 2587.)b
4da134f8 2588The
de7324ac
EA
2589.b $e
2590macro is printed out when SMTP starts up.
2591The first word must be the
2592.b $j
2593macro.
2594The
2595.b $j
2596macro
2597should be in RFC821 format.
2598The
2599.b $l
2fb78b49 2600and
de7324ac
EA
2601.b $n
2602macros can be considered constants
2603except under terribly unusual circumstances.
2604The
2605.b $o
2606macro consists of a list of characters
2607which will be considered tokens
2608and which will separate tokens
2609when doing parsing.
2610For example, if
2611.q @
2612were in the
2613.b $o
2614macro, then the input
2615.q a@b
2616would be scanned as three tokens:
2617.q a,
2618.q @,
2619and
2620.q b.
2621Finally, the
2622.b $q
2623macro specifies how an address should appear in a message
2624when it is defaulted.
2625For example, on our system these definitions are:
2fb78b49 2626.(b
859d056a 2627De$j Sendmail $v/$Z ready at $b
de7324ac 2628DnMAILER-DAEMON
91679fc8 2629DlFrom $g $d
859d056a
EA
2630Do.:%@!^/[]
2631Dq$?x$x <$g>$|$g$.
2632Dj$w
2fb78b49 2633.)b
de7324ac
EA
2634An acceptable alternative for the
2635.b $q
2636macro is
859d056a 2637.q "$g$?x ($x)$." .
de7324ac 2638These correspond to the following two formats:
2fb78b49 2639.(b
de7324ac 2640Eric Allman <eric@CS.Berkeley.EDU>
859d056a 2641eric@CS.Berkeley.EDU (Eric Allman)
2fb78b49 2642.)b
859d056a
EA
2643.i Sendmail
2644properly quotes names that have special characters
2645if the first form is used.
55c435aa 2646.pp
de7324ac
EA
2647Some macros are defined by
2648.i sendmail
2649for interpolation into argv's for mailers
2650or for other contexts.
2651These macros are:
2652.(b
2653a The origination date in RFC 822 format
2654b The current date in RFC 822 format
2655c The hop count
2656d The date in UNIX (ctime) format
2657f The sender (from) address
2658g The sender address relative to the recipient
2659h The recipient host
2660i The queue id
a3d50769 2661k The UUCP node name (from the uname system call)
de7324ac
EA
2662m The domain part of the \fIgethostname\fP return value
2663p Sendmail's pid
2664r Protocol used to receive the message
2665s Sender's host name
2666t A numeric representation of the current time
2667u The recipient user
2668v The version number of sendmail
2669w The hostname of this site
2670x The full name of the sender
2671z The home directory of the recipient
403c2581 2672_ The validated sender address
de7324ac 2673.)b
55c435aa 2674.pp
de7324ac 2675There are three types of dates that can be used.
55c435aa 2676The
de7324ac
EA
2677.b $a
2678and
2679.b $b
2680macros are in RFC 822 format;
2681.b $a
2682is the time as extracted from the
2683.q Date:
2684line of the message
2685(if there was one),
2686and
2687.b $b
2688is the current date and time
2689(used for postmarks).
2690If no
2691.q Date:
2692line is found in the incoming message,
2693.b $a
2694is set to the current time also.
55c435aa 2695The
de7324ac
EA
2696.b $d
2697macro is equivalent to the
859d056a 2698.b $b
de7324ac
EA
2699macro in UNIX
2700(ctime)
2701format.
55c435aa 2702.pp
8b73c824 2703The
de7324ac
EA
2704.b $f
2705macro is the id of the sender
2706as originally determined;
2707when mailing to a specific host
2708the
2709.b $g
2710macro is set to the address of the sender
2711.ul
2712relative to the recipient.
2713For example,
2714if I send to
3dfefb78 2715.q bollard@matisse.CS.Berkeley.EDU
de7324ac 2716from the machine
3dfefb78 2717.q vangogh.CS.Berkeley.EDU
de7324ac
EA
2718the
2719.b $f
2720macro will be
2721.q eric
2722and the
2723.b $g
2724macro will be
3dfefb78 2725.q eric@vangogh.CS.Berkeley.EDU.
55c435aa 2726.pp
de7324ac 2727The
de7324ac
EA
2728.b $x
2729macro is set to the full name of the sender.
2730This can be determined in several ways.
2731It can be passed as flag to
2732.i sendmail.
2733The second choice is the value of the
2734.q Full-name:
2735line in the header if it exists,
2736and the third choice is the comment field
2737of a
2738.q From:
2739line.
2740If all of these fail,
2741and if the message is being originated locally,
2742the full name is looked up in the
2743.i /etc/passwd
2744file.
55c435aa 2745.pp
de7324ac
EA
2746When sending,
2747the
2748.b $h ,
2749.b $u ,
8b73c824 2750and
de7324ac
EA
2751.b $z
2752macros get set to the host, user, and home directory
2753(if local)
2754of the recipient.
2755The first two are set from the
2756.b $@
2757and
2758.b $:
2759part of the rewriting rules, respectively.
8b73c824
EA
2760.pp
2761The
de7324ac 2762.b $p
2fb78b49
EA
2763and
2764.b $t
2765macros are used to create unique strings
2766(e.g., for the
2767.q Message-Id:
2768field).
2769The
2770.b $i
2771macro is set to the queue id on this host;
2772if put into the timestamp line
2773it can be extremely useful for tracking messages.
2774The
2fb78b49
EA
2775.b $v
2776macro is set to be the version number of
2777.i sendmail ;
2778this is normally put in timestamps
2779and has been proven extremely useful for debugging.
2780The
b01d261b
EA
2781.b $w
2782macro is set to the name of this host
2783if it can be determined.
2784The
2fb78b49
EA
2785.b $c
2786field is set to the
2787.q "hop count,"
2788i.e., the number of times this message has been processed.
2789This can be determined
2790by the
2791.b \-h
2792flag on the command line
2793or by counting the timestamps in the message.
4da134f8 2794.pp
2fb78b49
EA
2795The
2796.b $r
2797and
2798.b $s
2799fields are set to the protocol used to communicate with sendmail
f13b6b36 2800and the sending hostname.
403c2581
EA
2801The
2802.b $_
2803is set to a validated sender host name.
2804If the sender is running an RFC 1413 compliant IDENT server,
2805it will include the user name on that host.
de7324ac 2806.sh 3 "C and F \*- define classes"
2fb78b49 2807.pp
dd905b60 2808Classes of phrases may be defined
de7324ac
EA
2809to match on the left hand side of rewriting rules,
2810where a
dd905b60
EA
2811.q phrase
2812is a sequence of characters that do not contain space characters.
de7324ac
EA
2813For example
2814a class of all local names for this site
2815might be created
2816so that attempts to send to oneself
2817can be eliminated.
2818These can either be defined directly in the configuration file
2819or read in from another file.
2820Classes may be given names
2821from the set of upper case letters.
2822Lower case letters and special characters
2823are reserved for system use.
b66b7f9a 2824.pp
de7324ac
EA
2825The syntax is:
2826.(b F
2827.b C \c
dd905b60
EA
2828.i c\|phrase1
2829.i phrase2...
de7324ac
EA
2830.br
2831.b F \c
2832.i c\|file
2833.)b
2834The first form defines the class
2835.i c
2836to match any of the named words.
2837It is permissible to split them among multiple lines;
2838for example, the two forms:
b66b7f9a 2839.(b
de7324ac 2840CHmonet ucbmonet
b66b7f9a 2841.)b
de7324ac
EA
2842and
2843.(b
2844CHmonet
2845CHucbmonet
2846.)b
2847are equivalent.
2848The second form
2849reads the elements of the class
2850.i c
2851from the named
2852.i file .
4da134f8 2853.pp
7901972a
EA
2854The
2855.b $~
2856(match entries not in class)
2857only matches a single word;
2858multi-word entries in the class are ignored in this context.
2859.pp
de7324ac
EA
2860The class
2861.b $=w
2862is set to be the set of all names
2863this host is known by.
2864This can be used to match local hostnames.
c3e97ee9
EA
2865.pp
2866The class
2867.b $=k
2868is set to be the same as
2869.b $k ,
2870that is, the UUCP node name.
de7324ac
EA
2871.sh 3 "M \*- define mailer"
2872.pp
2873Programs and interfaces to mailers
2874are defined in this line.
2875The format is:
2876.(b F
2877.b M \c
2878.i name ,
2879{\c
2880.i field =\c
2881.i value \|}*
2882.)b
2883where
2884.i name
2885is the name of the mailer
2886(used internally only)
2887and the
2888.q field=name
2889pairs define attributes of the mailer.
2890Fields are:
4da134f8 2891.(b
de7324ac
EA
2892.ta 1i
2893Path The pathname of the mailer
2894Flags Special flags for this mailer
2895Sender A rewriting set for sender addresses
2896Recipient A rewriting set for recipient addresses
2897Argv An argument vector to pass to this mailer
2898Eol The end-of-line string for this mailer
2899Maxsize The maximum message length to this mailer
2900Linelimit The maximum line length in the message body
403c2581 2901Directory The working directory for the mailer
4da134f8 2902.)b
de7324ac
EA
2903Only the first character of the field name is checked.
2904.pp
2905The following flags may be set in the mailer description.
2906Any other flags may be used freely
2907to conditionally assign headers to messages
2908destined for particular mailers.
2909.nr ii 4n
50d4a65c
EA
2910.ip a
2911Run Extended SMTP (ESMTP) protocol (defined in RFCs 1425, 1426, and 1427).
6d5ff626
EA
2912.ip c
2913Do not include comments in addresses.
2914This should only be used if you have to work around
2915a remote mailer that gets confused by comments.
de7324ac
EA
2916.ip C
2917If mail is
2918.i received
2919from a mailer with this flag set,
2920any addresses in the header that do not have an at sign
2921(\c
2922.q @ )
2923after being rewritten by ruleset three
2924will have the
2925.q @domain
2926clause from the sender
2927tacked on.
2928This allows mail with headers of the form:
4da134f8 2929.(b
de7324ac
EA
2930From: usera@hosta
2931To: userb@hostb, userc
4da134f8 2932.)b
de7324ac
EA
2933to be rewritten as:
2934.(b
2935From: usera@hosta
2936To: userb@hostb, userc@hosta
2937.)b
2938automatically.
2939.ip D
2940This mailer wants a
2941.q Date:
2942header line.
2943.ip e
2944This mailer is expensive to connect to,
2945so try to avoid connecting normally;
2946any necessary connection will occur during a queue run.
2947.ip E
2948Escape lines beginning with
f13b6b36 2949.q From
de7324ac
EA
2950in the message with a `>' sign.
2951.ip f
2952The mailer wants a
2953.b \-f
2954.i from
2955flag,
2956but only if this is a network forward operation
2957(i.e.,
2958the mailer will give an error
2959if the executing user
2960does not have special permissions).
2961.ip F
2962This mailer wants a
2963.q From:
2964header line.
2965.ip h
2966Upper case should be preserved in host names
2967for this mailer.
f13b6b36 2968.ip I
de7324ac
EA
2969This mailer will be speaking SMTP
2970to another
f13b6b36 2971.i sendmail
de7324ac
EA
2972\*-
2973as such it can use special protocol features.
2974This option is not required
2975(i.e.,
2976if this option is omitted the transmission will still operate successfully,
2977although perhaps not as efficiently as possible).
2978.ip l
2979This mailer is local
2980(i.e.,
2981final delivery will be performed).
2982.ip L
2983Limit the line lengths as specified in RFC821.
2984This deprecated option should be replaced by the
2985.b L=
2986mail declaration.
2987For historic reasons, the
2988.b L
2989flag also sets the
2990.b 7
2991flag.
f13b6b36
EA
2992.ip m
2993This mailer can send to multiple users
2994on the same host
2995in one transaction.
2996When a
2997.b $u
2998macro occurs in the
2999.i argv
3000part of the mailer definition,
3001that field will be repeated as necessary
3002for all qualifying users.
3003.ip M
3004This mailer wants a
3005.q Message-Id:
3006header line.
3007.ip n
3008Do not insert a UNIX-style
3009.q From
3010line on the front of the message.
3011.ip p
e920f7ff 3012Use the route-addr style reverse-path in the SMTP
f13b6b36
EA
3013.q "MAIL FROM:"
3014command
3015rather than just the return address;
e920f7ff
EA
3016although this is required in RFC821 section 3.1,
3017many hosts do not process reverse-paths properly.
3018Reverse-paths are officially discouraged by RFC 1123.
f13b6b36
EA
3019.ip P
3020This mailer wants a
3021.q Return-Path:
3022line.
3023.ip r
3024Same as
3025.b f ,
3026but sends a
2fb78b49 3027.b \-r
f13b6b36
EA
3028flag.
3029.ip s
3030Strip quote characters off of the address
3031before calling the mailer.
3032.ip S
3033Don't reset the userid
3034before calling the mailer.
3035This would be used in a secure environment
3036where
3037.i sendmail
3038ran as root.
3039This could be used to avoid forged addresses.
3040This flag is suppressed if given from an
3041.q unsafe
3042environment
3043(e.g, a user's mail.cf file).
3044.ip u
3045Upper case should be preserved in user names
3046for this mailer.
3047.ip U
3048This mailer wants Unix-style
3049.q From
3050lines with the ugly UUCP-style
3051.q "remote from <host>"
3052on the end.
3053.ip x
3054This mailer wants a
3055.q Full-Name:
3056header line.
3057.ip X
3058This mailer want to use the hidden dot algorithm
3059as specified in RFC821;
3060basically,
3061any line beginning with a dot
3062will have an extra dot prepended
3063(to be stripped at the other end).
3064This insures that lines in the message containing a dot
3065will not terminate the message prematurely.
3066.ip 7
3067Strip all output to seven bits.
3068This is the default if the
3069.b L
3070flag is set.
3071Note that setting this is not
3072sufficient to get full eight bit data passed through
3073.i sendmail ;
3074the
3075.b 8
3076option must also be set.
de7324ac
EA
3077.pp
3078The mailer with the special name
3079.q error
3080can be used to generate a user error.
3081The (optional) host field is an exit status to be returned,
3082and the user field is a message to be printed.
3083The exit status may be numeric or one of the values
3084USAGE, NOUSER, NOHOST, UNAVAILABLE, SOFTWARE, TEMPFAIL, PROTOCOL, or CONFIG
3085to return the corresponding EX_ exit code.
3086For example, the entry:
3087.(b
3088$#error $@ NOHOST $: Host unknown in this domain
3089.)b
3090on the RHS of a rule
3091will cause the specified error to be generated
3092and the
3093.q "Host unknown"
3094exit status to be returned
3095if the LHS matches.
3096This mailer is only functional in ruleset zero.
fa2fc92a
EA
3097.pp
3098The mailer named
3099.q local
3100.i must
3101be defined in every configuration file.
3102This is used to deliver local mail,
3103and is treated specially in several ways.
3104Additionally, three other mailers named
3105.q prog ,
3106.q *file* ,
3107and
3108.q *include*
3109may be defined to tune the delivery of messages to programs,
3110files,
3111and :include: lists respectively.
3112They default to:
3113.(b
3114Mprog, P=/bin/sh, F=lsD, A=sh \-c $u
3115M*file*, F=lsDEu, A=NULL
3116M*include*, F=su, A=NULL
3117.)b
6ebbc09a
EA
3118.pp
3119The Sender and Recipient rewriting sets
3120may either be a simple integer
3121or may be two integers separated by a slash;
3122if so, the first rewriting set is applied to envelope
3123addresses
3124and the second is applied to headers.
403c2581
EA
3125.pp
3126The Directory
3127is actually a colon-separated path of directories to try.
3128For example, the definition
3129.q D=$z:/
3130first tries to execute in the recipient's home directory;
3131if that is not available,
3132it tries to execute in the root of the filesystem.
3133This is intended to be used only on the
3134.q prog
3135mailer,
3136since some shells (such as
3137.i csh )
3138refuse to execute if they cannot read the home directory.
3139Since the queue directory is not normally readable by normal users
3140.i csh
3141scripts as recipients can fail.
de7324ac
EA
3142.sh 3 "H \*- define header"
3143.pp
3144The format of the header lines that sendmail inserts into the message
3145are defined by the
3146.b H
3147line.
3148The syntax of this line is:
3149.(b F
3150.b H [\c
3151.b ? \c
3152.i mflags \c
3153.b ? ]\c
3154.i hname \c
3155.b :
3156.i htemplate
3157.)b
3158Continuation lines in this spec
3159are reflected directly into the outgoing message.
3160The
3161.i htemplate
3162is macro expanded before insertion into the message.
3163If the
3164.i mflags
3165(surrounded by question marks)
3166are specified,
3167at least one of the specified flags
3168must be stated in the mailer definition
3169for this header to be automatically output.
3170If one of these headers is in the input
3171it is reflected to the output
3172regardless of these flags.
3173.pp
3174Some headers have special semantics
3175that will be described below.
3176.sh 3 "O \*- set option"
3177.pp
3178There are a number of
3179.q random
3180options that
3181can be set from a configuration file.
3182Options are represented by single characters.
3183The syntax of this line is:
3184.(b F
3185.b O \c
3186.i o\|value
3187.)b
3188This sets option
3189.i o
3190to be
3191.i value .
3192Depending on the option,
3193.i value
3194may be a string, an integer,
3195a boolean
3196(with legal values
3197.q t ,
3198.q T ,
3199.q f ,
3200or
3201.q F ;
3202the default is TRUE),
3203or
3204a time interval.
3205.pp
3206The options supported are:
3207.nr ii 1i
3208.ip a\fIN\fP
3209If set,
3210wait up to
3211.i N
3212minutes for an
3213.q @:@
3214entry to exist in the alias database
3215before starting up.
3216If it does not appear in
3217.i N
3218minutes,
3219rebuild the database
3220(if the
3221.b D
3222option is also set)
3223or issue a warning.
3224.ip A\fIfile\fP
3225Use the named
3226.i file
3227as the alias file.
3228If no file is specified,
3229use
3230.i aliases
3231in the current directory.
50d4a65c 3232.ip b\fIN\fP/\fIM\fP
59baf33c
EA
3233Insist on at least
3234.i N
3235blocks free on the filesystem that holds the queue files
3236before accepting email via SMTP.
3237If there is insufficient space
3238.i sendmail
3239gives a 452 response
3240to the MAIL command.
859d056a 3241This invites the sender to try again later.
50d4a65c
EA
3242The optional
3243.i M
3244is a maximum message size advertised in the ESMTP EHLO response.
3245It is currently otherwise unused.
de7324ac
EA
3246.ip B\fIc\fP
3247Set the blank substitution character to
3248.i c .
3249Unquoted spaces in addresses are replaced by this character.
55aab950 3250Defaults to space (i.e., no change is made).
de7324ac
EA
3251.ip c
3252If an outgoing mailer is marked as being expensive,
3253don't connect immediately.
3254This requires that queueing be compiled in,
3255since it will depend on a queue run process to
3256actually send the mail.
3257.ip C\fIN\fP
3258Checkpoints the queue every
3259.i N
3260(default 10)
3261addresses sent.
3262If your system crashes during delivery to a large list,
3263this prevents retransmission to any but the last
3264.I N
3265recipients.
3266.ip d\fIx\fP
3267Deliver in mode
3268.i x .
3269Legal modes are:
3270.(b
3271.ta 4n
3272i Deliver interactively (synchronously)
3273b Deliver in background (asynchronously)
3274q Just queue the message (deliver during queue run)
3275.)b
56ba89fb
EA
3276Defaults to ``b'' if no option is specified,
3277``i'' if it is specified but given no argument
3278(i.e., ``Od'' is equivalent to ``Odi'').
de7324ac
EA
3279.ip D
3280If set,
3281rebuild the alias database if necessary and possible.
3282If this option is not set,
3283.i sendmail
3284will never rebuild the alias database
3285unless explicitly requested
3286using
3287.b \-bi .
3288.ip e\fIx\fP
3289Dispose of errors using mode
3290.i x .
3291The values for
3292.i x
3293are:
3294.(b
3295p Print error messages (default)
3296q No messages, just give exit status
3297m Mail back errors
3298w Write back errors (mail if user not logged in)
3299e Mail back errors and give zero exit stat always
3300.)b
3301.ip E\fIfile/message\fP
3302Prepend error messages with the indicated message.
3303If it begins with a slash,
3304it is assumed to be the pathname of a file
3305containing a message (this is the recommended setting).
3306Otherwise, it is a literal message.
3307The error file might contain the name, email address, and/or phone number
3308of a local postmaster who could provide assistance
3309in to end users.
3310If the option is missing or null,
3311or if it names a file which does not exist or which is not readable,
3312no message is printed.
3313.ip f
3314Save
3315Unix-style
3316.q From
3317lines at the front of headers.
3318Normally they are assumed redundant
3319and discarded.
3320.ip F\fImode\fP
3321The file mode for queue files.
3322.ip g\fIn\fP
3323Set the default group id
3324for mailers to run in
3325to
3326.i n .
55aab950 3327Defaults to 1.
de7324ac
EA
3328.ip G
3329Allow fuzzy matching on the GECOS field.
3330If this flag is set,
3331and the usual user name lookups fail
3332(that is, there is no alias with this name and a
3333.i getpwnam
3334fails),
3335sequentially search the password file
3336for a matching entry in the GECOS field.
3337This also requires that MATCHGECOS
3338be turned on during compilation.
3339This option is not recommended.
3340.ip h\fIN\fP
3341The maximum hop count.
3342Messages that have been processed more than
3343.i N
3344times are assumed to be in a loop and are rejected.
55aab950 3345Defaults to 25.
de7324ac
EA
3346.ip H\fIfile\fP
3347Specify the help file
3348for SMTP.
3349.ip i
3350Ignore dots in incoming messages.
859d056a
EA
3351This is always disabled (that is, dots are always accepted)
3352when reading SMTP mail.
de7324ac
EA
3353.ip I
3354Insist that the BIND name server be running
3355to resolve host names.
3356If this is not set and the name server is not running,
3357the
3358.i /etc/hosts
3359file will be considered complete.
3360In general, you do want to set this option
3361if your
3362.i /etc/hosts
3363file does not include all hosts known to you
3364or if you are using the MX (mail forwarding) feature of the BIND name server.
3365The name server will still be consulted
3366even if this option is not set, but
3367.i sendmail
3368will feel free to resort to reading
3369.i /etc/hosts
3370if the name server is not available.
3371Thus, you should
3372.i never
3373set this option if you do not run the name server.
3374.ip J\fIpath\fP
3375Set the path for searching for users' .forward files.
3376The default is
3377.q $z/.forward .
3378Some sites that use the automounter may prefer to change this to
3379.q /var/forward/$u
3380to search a file with the same name as the user in a system directory.
3381It can also be set to a sequence of paths separated by colons;
3382.i sendmail
3383stops at the first file it can successfully and safely open.
3384For example,
3385.q /var/forward/$u:$z/.forward
3386will search first in /var/forward/\c
3387.i username
3388and then in
3389.i ~username /.forward
3390(but only if the first file does not exist).
3391.ip k\fIN\fP
3392The maximum number of open connections that will be cached at a time.
3393The default is one.
3394This delays closing the the current connection until
3395either this invocation of sendmail needs to connect to another host
3396or it terminates.
3397Setting it to zero defaults to the old behavior,
3398that is, connections are closed immediately.
3399.ip K\fItimeout\fP
3400The maximum amount of time a cached connection will be permitted to idle
3401without activity.
3402If this time is exceeded,
3403the connection is immediately closed.
3404This value should be small (on the order of ten minutes).
3405Before
3406.b sendmail
3407uses a cached connection,
3408it always sends a NOOP (no operation) command
3409to check the connection;
3410if this fails, it reopens the connection.
3411This keeps your end from failing if the other end times out.
3412The point of this option is to be a good network neighbor
3413and avoid using up excessive resources
3414on the other end.
3415The default is five minutes.
3416.ip L\fIn\fP
3417Set the default log level to
3418.i n .
55aab950 3419Defaults to 9.
de7324ac
EA
3420.ip m
3421Send to me too,
3422even if I am in an alias expansion.
3423.ip M\fIx\|value\fP
3424Set the macro
3425.i x
3426to
3427.i value .
3428This is intended only for use from the command line.
56ba89fb
EA
3429.ip n
3430Validate the RHS of aliases when rebuilding the alias database.
de7324ac
EA
3431.ip o
3432Assume that the headers may be in old format,
3433i.e.,
3434spaces delimit names.
3435This actually turns on
3436an adaptive algorithm:
3437if any recipient address contains a comma, parenthesis,
3438or angle bracket,
3439it will be assumed that commas already exist.
3440If this flag is not on,
3441only commas delimit names.
3442Headers are always output with commas between the names.
a99d3cb3
EA
3443.ip O\fIoptions\fP
3444Set server SMTP options.
3445The options are
3446.i key=value
3447pairs.
3448Known keys are:
3449.(b
3450.ta 1i
3451Port Name/number of listening port (defaults to "smtp")
3452Addr Address mask (defaults INADDR_ANY)
3453Family Address family (defaults to INET)
3454.)b
3455The
3456.i Addr ess
3457mask may be a numeric address in dot notation
3458or a network name.
59baf33c
EA
3459.ip p\fI\|opt,opt,...\fP
3460Set the privacy
3461.i opt ions.
3462``Privacy'' is really a misnomer;
859d056a 3463many of these are just a way of insisting on stricter adherence
59baf33c
EA
3464to the SMTP protocol.
3465The
3466.i opt ions
3467can be selected from:
3468.(b
859d056a 3469.ta \w'needvrfyhelo'u+3n
59baf33c 3470public Allow open access
475d7a3d
EA
3471needmailhelo Insist on HELO or EHLO command before MAIL
3472needexpnhelo Insist on HELO or EHLO command before EXPN
59baf33c 3473noexpn Disallow EXPN entirely
475d7a3d 3474needvrfyhelo Insist on HELO or EHLO command before VRFY
59baf33c 3475novrfy Disallow VRFY entirely
890cda2d
EA
3476restrictmailq Restrict mailq command
3477goaway Disallow essentially all SMTP status queries
59baf33c 3478.)b
890cda2d
EA
3479The
3480.q goaway
3481pseudo-flag sets all flags except
3482.q restrictmailq .
3483If mailq is restricted,
3484only people in the same group as the queue directory
3485can print the queue.
de7324ac
EA
3486.ip P\fIpostmaster\fP
3487If set,
3488copies of error messages will be sent to the named
3489.i postmaster .
475d7a3d 3490Only the header of the failed message is sent.
de7324ac
EA
3491Since most errors are user problems,
3492this is probably not a good idea on large sites,
3493and arguably contains all sorts of privacy violations,
3494but it seems to be popular with certain operating systems vendors.
3495.ip q\fIfactor\fP
3496Use
3497.i factor
3498as the multiplier in the map function
3499to decide when to just queue up jobs rather than run them.
3500This value is divided by the difference between the current load average
3501and the load average limit
3502(\c
3503.b x
3504flag)
3505to determine the maximum message priority
3506that will be sent.
55aab950 3507Defaults to 600000.
de7324ac
EA
3508.ip Q\fIdir\fP
3509Use the named
3510.i dir
3511as the queue directory.
859d056a 3512.ip r\|\fItimeouts\fP
de7324ac
EA
3513Timeout reads after
3514.i time
3515interval.
e920f7ff
EA
3516The
3517.i timeouts
3518argument is a list of
3519.i keyword=value
3520pairs.
3521The recognized timeouts and their default values, and their
3522minimum values specified in RFC 1123 section 5.3.2 are:
3523.(b
859d056a 3524.ta \w'datafinal'u+3n
e920f7ff 3525initial wait for initial greeting message [5m, 5m]
475d7a3d 3526helo reply to HELO or EHLO command [5m, none]
e920f7ff
EA
3527mail reply to MAIL command [10m, 5m]
3528rcpt reply to RCPT command [1h, 5m]
3529datainit reply to DATA command [5m, 2m]
3530datablock data block read [1h, 3m]
3531datafinal reply to final ``.'' in data [1h, 10m]
3532rset reply to RSET command [5m, none]
3533quit reply to QUIT command [2m, none]
859d056a 3534misc reply to NOOP and VERB commands [2m, none]
e920f7ff
EA
3535command command read [1h, 5m]
3536.)b
3537All but
3538.q command
3539apply to client SMTP.
3540For back compatibility,
3541a timeout with no ``keyword='' part
3542will set all of the longer values.
de7324ac
EA
3543.ip s
3544Be super-safe when running things,
3545i.e.,
3546always instantiate the queue file,
3547even if you are going to attempt immediate delivery.
3548.i Sendmail
3549always instantiates the queue file
3550before returning control the the client
3551under any circumstances.
3552.ip S\fIfile\fP
3553Log statistics in the named
3554.i file .
3555.ip t\fIS,D\fP
3556Set the local time zone name to
3557.i S
3558for standard time and
3559.i D
3560for daylight time;
3561this is only used under version six.
31e506e2 3562.ip T\fIrtime/wtime\fP
de7324ac 3563Set the queue timeout to
31e506e2 3564.i rtime .
de7324ac
EA
3565After this interval,
3566messages that have not been successfully sent
3567will be returned to the sender.
31e506e2
EA
3568Defaults to five days.
3569The optional
3570.i wtime
3571is the time after which a warning message is sent.
3572If it is missing or zero
3573then no warning messages are sent.
de7324ac
EA
3574.ip u\fIn\fP
3575Set the default userid for mailers to
3576.i n .
3577Mailers without the
3578.i S
3579flag in the mailer definition
3580will run as this user.
55aab950 3581Defaults to 1.
de7324ac
EA
3582.ip U\fIudbspec\fP
3583The user database specification.
3584.ip v
3585Run in verbose mode.
56ba89fb
EA
3586If this is set,
3587.i sendmail
3588adjusts options
3589.b c
3590(don't connect to expensive mailers)
3591and
3592.b d
3593(delivery mode)
3594so that all mail is delivered completely
3595in a single job
3596so that you can see the entire delivery process.
3597Option
3598.b v
3599should
3600.i never
3601be set in the configuration file;
3602it is intended for command line use only.
a99d3cb3
EA
3603.ip V\fIfallbackhost\fP
3604If specified, the
3605.i fallbackhost
3606acts like a very low priority MX
3607on every host.
3608This is intended to be used by sites with poor network connectivity.
de7324ac
EA
3609.ip x\fILA\fP
3610When the system load average exceeds
3611.i LA ,
3612just queue messages
3613(i.e., don't try to send them).
55aab950 3614Defaults to 8.
de7324ac
EA
3615.ip X\fILA\fP
3616When the system load average exceeds
3617.i LA ,
3618refuse incoming SMTP connections.
55aab950 3619Defaults to 12.
de7324ac
EA
3620.ip y\fIfact\fP
3621The indicated
3622.i fact or
3623is added to the priority (thus
3624.i lowering
3625the priority of the job)
3626for each recipient,
3627i.e., this value penalizes jobs with large numbers of recipients.
55aab950 3628Defaults to 30000.
de7324ac
EA
3629.ip Y
3630If set,
3631deliver each job that is run from the queue in a separate process.
3632Use this option if you are short of memory,
3633since the default tends to consume considerable amounts of memory
3634while the queue is being processed.
3635.ip z\fIfact\fP
3636The indicated
3637.i fact or
3638is multiplied by the message class
3639(determined by the Precedence: field in the user header
3640and the
3641.b P
3642lines in the configuration file)
3643and subtracted from the priority.
3644Thus, messages with a higher Priority: will be favored.
55aab950 3645Defaults to 1800.
de7324ac
EA
3646.ip Z\fIfact\fP
3647The
3648.i fact or
3649is added to the priority
3650every time a job is processed.
3651Thus,
3652each time a job is processed,
3653its priority will be decreased by the indicated value.
3654In most environments this should be positive,
3655since hosts that are down are all too often down for a long time.
55aab950 3656Defaults to 90000.
de7324ac
EA
3657.ip 8
3658Preserve eight bits of data in the body on input.
3659Normally the input is stripped to seven bits as per RFC822.
3660See also the
3661.b L
3662mailer flag.
3663.lp
3664All options can be specified on the command line using the
3665\-o flag,
3666but most will cause
3667.i sendmail
3668to relinquish its setuid permissions.
3669The options that will not cause this are
859d056a 3670b, d, e, E, i, L, m, o, p, r, s, v, C, and 8.
de7324ac
EA
3671Also, M (define macro) when defining the r or s macros
3672is also considered
3673.q safe .
de7324ac
EA
3674.sh 3 "P \*- precedence definitions"
3675.pp
3676Values for the
3677.q "Precedence:"
3678field may be defined using the
3679.b P
3680control line.
3681The syntax of this field is:
3682.(b
3683\fBP\fP\fIname\fP\fB=\fP\fInum\fP
3684.)b
3685When the
3686.i name
3687is found in a
3688.q Precedence:
3689field,
3690the message class is set to
3691.i num .
3692Higher numbers mean higher precedence.
3693Numbers less than zero
3694have the special property
55aab950
EA
3695that if an error occurs during processing
3696the body of the message will not be returned;
3697this is expected to be used for
3698.q "bulk"
3699mail such as through mailing lists.
de7324ac
EA
3700The default precedence is zero.
3701For example,
3702our list of precedences is:
3703.(b
3704Pfirst-class=0
3705Pspecial-delivery=100
859d056a 3706Plist=\-30
55aab950 3707Pbulk=\-60
de7324ac
EA
3708Pjunk=\-100
3709.)b
859d056a
EA
3710People writing mailing list exploders
3711are encouraged to use
3712.q "Precedence: list" .
3713Older versions of
3714.i sendmail
3715(which discarded all error returns for negative precedences)
3716didn't recognize this name, giving it a default precedence of zero.
3717This allows list maintainers to see error returns
3718on both old and new versions of
3719.i sendmail .
de7324ac
EA
3720.sh 3 "V \*- configuration version level"
3721.pp
3722To provide compatibility with old configuration files,
3723the
3724.b V
3725line has been added to define some very basic semantics
3726of the configuration file.
3727These are not intended to be long term supports;
3728rather, they describe compatibility features
3729which will probably be removed in future releases.
3730.pp
3731.q Old
e920f7ff
EA
3732configuration files are defined as version level one.
3733Version level two files make the following changes:
de7324ac
EA
3734.np
3735Host name canonification ($[ ... $])
3736appends a dot if the name is recognized;
3737this gives the config file a way of finding out if anything matched.
3738(Actually, this just initializes the
3739.q host
3740map with the
3741.q \-a.
3742flag \*- you can reset it to anything you prefer
3743by declaring the map explicitly.)
3744.np
3745Default host name extension is consistent throughout processing;
e920f7ff 3746version level one configurations turned off domain extension
de7324ac
EA
3747(that is, adding the local domain name)
3748during certain points in processing.
e920f7ff 3749Version level two configurations are expected to include a trailing dot
de7324ac
EA
3750to indicate that the name is already canonical.
3751.np
3752Local names that are not aliases
3753are passed through a new distinguished ruleset five;
3754this can be used to append a local relay.
3755This behaviour can be prevented by resolving the local name
3756with an initial `@'.
3757That is, something that resolves to a local mailer and a user name of
3758.q vikki
3759will be passed through ruleset five,
3760but a user name of
3761.q @vikki
3762will have the `@' stripped,
3763will not be passed through ruleset five,
3764but will otherwise be treated the same as the prior example.
3765The expectation is that this might be used to implement a policy
3766where mail sent to
3767.q vikki
3768was handled by a central hub,
3769but mail sent to
3770.q vikki@localhost
3771was delivered directly.
3772.pp
e920f7ff 3773Version level three files
de7324ac
EA
3774allow # initiated comments on all lines.
3775Exceptions are backslash escaped # marks
3776and the $# syntax.
3777.sh 3 "K \*- key file declaration"
3778.pp
3779Special maps can be defined using the line:
3780.(b
3781Kmapname mapclass arguments
3782.)b
3783The
3784.i mapname
3785is the handle by which this map is referenced in the rewriting rules.
3786The
3787.i mapclass
3788is the name of a type of map;
3789these are compiled in to sendmail.
3790The
3791.i arguments
3792are interpreted depending on the class;
3793typically,
3794there would be a single argument naming the file containing the map.
3795.pp
3796Maps are referenced using the syntax:
3797.(b
3798$( \fImap\fP \fIkey\fP $@ \fIarguments\fP $: \fIdefault\fP $)
3799.)b
3800where either or both of the
3801.i arguments
3802or
3803.i default
3804portion may be omitted.
3805The
3806.i arguments
3807may appear more than once.
3808The indicated
3809.i key
3810and
3811.i arguments
3812are passed to the appropriate mapping function.
3813If it returns a value, it replaces the input.
3814If it does not return a value and the
3815.i default
3816is specified, the
3817.i default
3818replaces the input.
3819Otherwise, the input is unchanged.
3820.pp
3821During replacement of either a map value or default
3822the string
3823.q %\fIn\fP
3824(where
3825.i n
3826is a digit)
3827is replaced by the corresponding
3828.i argument .
3829Argument zero
3dfefb78 3830is always the database key.
de7324ac
EA
3831For example, the rule
3832.(b
3833.ta 1.5i
3834R$- ! $+ $: $(uucp $1 $@ $2 $: %1 @ %0 . UUCP $)
3835.)b
3836Looks up the UUCP name in a (user defined) UUCP map;
3837if not found it turns it into
3838.q \&.UUCP
3839form.
3840The database might contain records like:
3841.(b
3842decvax %1@%0.DEC.COM
3843research %1@%0.ATT.COM
3844.)b
3845.pp
3846The built in map with both name and class
3847.q host
3848is the host name canonicalization lookup.
3849Thus,
3850the syntax:
3851.(b
3852$(host \fIhostname\fP$)
3853.)b
3854is equivalent to:
3855.(b
3856$[\fIhostname\fP$]
3857.)b
3858.pp
3859There are four predefined database lookup classes:
3860.q dbm ,
3861.q btree ,
3862.q hash ,
3863and
3864.q nis .
3865The first requires that sendmail be compiled with the
3866.b ndbm
3867library;
3868the second two require the
3869.b db
3870library,
3871and the third requires that sendmail be compiled with NIS support.
3872All four accept as arguments the some optional flags
3873and a filename (or a mapname for NIS).
3874Known flags are:
3875.ip "\-o"
3876Indicates that this map is optional \*- that is,
3877if it cannot be opened,
3878no error is produced,
3879and sendmail will behave as if the map existed but was empty.
3880.ip "\-N"
3881Normally sendmail does not include the trailing null byte
3882on a string as part of the key.
3883If this flag is indicated,
3884it will be included.
3885This is for compatibility with some methods of building the maps.
3886.ip "\-a\fIx\fP"
3887Append the character
3888.i x
3889on successful matches.
3890For example, the default
3891.i host
3892map appends a dot on successful matches.
3893.ip "\-d\fIdomain\fP"
3894Use the indicated
3895.i domain
3896instead of the default domain.
3897Used only for NIS maps.
3898.ip "\-f"
3899Fold upper to lower case before looking up the key.
3900.ip "\-m"
3901Match only (without replacing the value).
3902If you only care about the existence of a key and not the value
3903(as you might when searching the NIS map
3904.q hosts.byname
3905for example),
3906this flag prevents the map from substituting the value.
3907However,
3908The \-a argument is still appended on a match,
3909and the default is still taken if the match fails.
3910.pp
3911The
3912.i dbm
3913map appends the strings
3914.q \&.pag
3915and
3916.q \&.dir
3917to the given filename;
3918the two
3919.i db -based
3920maps do not.
3921.pp
3922The program
3923.i makemap (8)
3924can be used to build any of the three database-oriented maps.
3925It takes the following flags:
3926.ip \-f
f86ff76b 3927Do not fold upper to lower case in the map.
de7324ac
EA
3928.ip \-N
3929Include null bytes in keys.
3930.ip \-o
3931Append to an existing (old) file.
3932.ip \-r
3933Allow replacement of existing keys;
3934normally, re-inserting an existing key is an error.
3935.ip \-v
3936Print what is happening.
3937.pp
6a197ea4
EA
3938There are also two builtin maps that are,
3939strictly speaking,
3940not database lookups.
3941.pp
3942The
3943.q host
3944map does host domain canonification;
3945given a host name it calls the name server
3946to find the canonical name for that host.
3947.pp
3948The
3949.q dequote
3950map strips double quotes (") from a name.
3951It does not strip backslashes.
3952It will not strip quotes if the resulting string
3953would contain unscannable syntax
3954(that is, basic errors like unbalanced angle brackets;
3955more sophisticated errors such as unknown hosts are not checked).
3956The intent is for use when trying to accept mail from systems such as
3957DECnet
3958that routinely quote odd syntax such as
3959.(b
3960"49ers::ubell"
3961.)b
3962A typical usage is probably something like:
3963.(b
3964Kdequote dequote
3965
3966\&...
3967
3968R$\- $: $(dequote $1 $)
3969R$\- $+ $: $>3 $1 $2
3970.)b
3971Care must be taken to prevent unexpected results;
3972for example,
3973.(b
3974"|someprogram < input > output"
3975.)b
3976will have quotes stripped,
3977but the result is probably not what you had in mind.
3978Fortunately these cases are rare.
3979.pp
de7324ac
EA
3980New classes can be added in the routine
3981.b setupmaps
3982in file
3983.b conf.c .
f13b6b36 3984.sh 2 "Building a Configuration File From Scratch"
bbdc3cab 3985.pp
f13b6b36
EA
3986Building a configuration table from scratch is an extremely difficult job.
3987Fortunately,
3988it is almost never necessary to do so;
3989nearly every situation that may come up
3990may be resolved by changing an existing table.
3991In any case,
3992it is critical that you understand what it is that you are trying to do
3993and come up with a philosophy for the configuration table.
3994This section is intended to explain what the real purpose
3995of a configuration table is
3996and to give you some ideas
3997for what your philosophy might be.
859d056a
EA
3998.pp
3999.b "Do not even consider"
4000writing your own configuration file
4001without carefully studying
4002RFC 821, 822, and 1123.
4003You should also read RFC 976
4004if you are doing UUCP exchange.
f13b6b36 4005.sh 3 "What you are trying to do"
55c435aa 4006.pp
f13b6b36
EA
4007The configuration table has three major purposes.
4008The first and simplest
4009is to set up the environment for
4010.i sendmail .
4011This involves setting the options,
4012defining a few critical macros,
4013etc.
4014Since these are described in other places,
4015we will not go into more detail here.
bbdc3cab 4016.pp
f13b6b36
EA
4017The second purpose is to rewrite addresses in the message.
4018This should typically be done in two phases.
4019The first phase maps addresses in any format
4020into a canonical form.
4021This should be done in ruleset three.
4022The second phase maps this canonical form
4023into the syntax appropriate for the receiving mailer.
4024.i Sendmail
4025does this in three subphases.
4026Rulesets one and two
4027are applied to all sender and recipient addresses respectively.
4028After this,
4029you may specify per-mailer rulesets
4030for both sender and recipient addresses;
4031this allows mailer-specific customization.
4032Finally,
4033ruleset four is applied to do any default conversion
4034to external form.
bbdc3cab 4035.pp
f13b6b36
EA
4036The third purpose
4037is to map addresses into the actual set of instructions
4038necessary to get the message delivered.
4039Ruleset zero must resolve to the internal form,
4040which is in turn used as a pointer to a mailer descriptor.
4041The mailer descriptor describes the interface requirements
4042of the mailer.
4043.sh 3 "Philosophy"
bbdc3cab 4044.pp
f13b6b36
EA
4045The particular philosophy you choose will depend heavily
4046on the size and structure of your organization.
4047I will present a few possible philosophies here.
093461e4
EA
4048There are as many philosophies as there are config designers;
4049feel free to develop your own.
bbdc3cab 4050.pp
f13b6b36
EA
4051One general point applies to all of these philosophies:
4052it is almost always a mistake
890cda2d 4053to try to do full host route resolution.
f13b6b36 4054For example,
6d5ff626
EA
4055if you are on a UUCP-only site
4056and you are trying to get names of the form
f13b6b36 4057.q user@host
6d5ff626 4058to the Internet,
f13b6b36 4059it does not pay to route them to
6d5ff626 4060.q xyzvax!decvax!ucbvax!c70!user@host
f90dac5e
EA
4061since you then depend on several links not under your control,
4062some of which are likely to misparse it anyway.
f13b6b36 4063The best approach to this problem
6d5ff626
EA
4064is to simply forward the message for
4065.q user@host
4066to
4067.q xyzvax
f13b6b36
EA
4068and let xyzvax
4069worry about it from there.
4070In summary,
4071just get the message closer to the destination,
4072rather than determining the full path.
4073.sh 4 "Large site, many hosts \*- minimum information"
bbdc3cab 4074.pp
f13b6b36
EA
4075Berkeley is an example of a large site,
4076i.e., more than two or three hosts
4077and multiple mail connections.
4078We have decided that the only reasonable philosophy
4079in our environment
4080is to designate one host as the guru for our site.
4081It must be able to resolve any piece of mail it receives.
4082The other sites should have the minimum amount of information
4083they can get away with.
4084In addition,
4085any information they do have
4086should be hints rather than solid information.
55c435aa 4087.pp
f13b6b36
EA
4088For example,
4089a typical site on our local ether network is
3dfefb78
EA
4090.q monet
4091(actually
4092.q monet.CS.Berkeley.EDU ).
f13b6b36
EA
4093When monet receives mail for delivery,
4094it checks whether it knows
4095that the destination host is directly reachable;
4096if so, mail is sent to that host.
4097If it receives mail for any unknown host,
4098it just passes it directly to
3dfefb78 4099.q ucbvax.CS.Berkeley.EDU ,
f13b6b36
EA
4100our master host.
4101Ucbvax may determine that the host name is illegal
4102and reject the message,
4103or may be able to do delivery.
4104However, it is important to note that when a new mail connection is added,
4105the only host that
4106.i must
4107have its tables updated
4108is ucbvax;
4109the others
4110.i may
4111be updated if convenient,
4112but this is not critical.
55c435aa 4113.pp
f13b6b36
EA
4114This picture is slightly muddied
4115due to network connections that are not actually located
4116on ucbvax.
4117For example,
4118some UUCP connections are currently on
4119.q ucbarpa.
4120However,
4121monet
4122.i "does not"
4123know about this;
4124the information is hidden totally between ucbvax and ucbarpa.
4125Mail going from monet to a UUCP host
4126is transferred via the ethernet
4127from monet to ucbvax,
4128then via the ethernet from ucbvax to ucbarpa,
4129and then is submitted to UUCP.
4130Although this involves some extra hops,
4131we feel this is an acceptable tradeoff.
55c435aa 4132.pp
f13b6b36
EA
4133An interesting point is that it would be possible
4134to update monet
4135to send appropriate UUCP mail directly to ucbarpa
4136if the load got too high;
4137if monet failed to note a host as connected to ucbarpa
4138it would go via ucbvax as before,
4139and if monet incorrectly sent a message to ucbarpa
4140it would still be sent by ucbarpa
4141to ucbvax as before.
4142The only problem that can occur is loops,
4143for example,
4144if ucbarpa thought that ucbvax had the UUCP connection
4145and vice versa.
4146For this reason,
4147updates should
4148.i always
4149happen to the master host first.
55c435aa 4150.pp
f13b6b36
EA
4151This philosophy results as much from the need
4152to have a single source for the configuration files
4153(typically built using
4154.i m4 \|(1)
4155or some similar tool)
4156as any logical need.
4157Maintaining more than three separate tables by hand
4158is essentially an impossible job.
4159.sh 4 "Small site \*- complete information"
55c435aa 4160.pp
f13b6b36
EA
4161A small site
4162(two or three hosts and few external connections)
4163may find it more reasonable to have complete information
4164at each host.
4165This would require that each host
4166know exactly where each network connection is,
4167possibly including the names of each host on that network.
4168As long as the site remains small
4169and the the configuration remains relatively static,
4170the update problem will probably not be too great.
4171.sh 4 "Single host"
55c435aa 4172.pp
f13b6b36
EA
4173This is in some sense the trivial case.
4174The only major issue is trying to insure that you don't
4175have to know too much about your environment.
4176For example,
4177if you have a UUCP connection
4178you might find it useful to know about the names of hosts
4179connected directly to you,
4180but this is really not necessary
4181since this may be determined from the syntax.
093461e4
EA
4182.sh 4 "A completely different philosophy"
4183.pp
4184This is adapted from Bruce Lilly.
4185Any errors in interpretation are mine.
4186.pp
4187Do minimal changes in ruleset 3:
4188fix some common but unambiguous errors (e.g. trailing dot on domains) and
4189hide bang paths foo!bar into bar@foo.UUCP.
4190The resulting "canonical" form is any valid RFC822/RFC1123/RFC976 address.
4191.pp
4192Ruleset 0 does the bulk of the work.
4193It removes the trailing "@.UUCP" that hides bang paths,
4194strips anything not needed to resolve,
4195e.g. the phrase from phrase <route-addr> and from named groups,
4196rejects unparseable addresses using $#error,
4197and finally
4198resolves to a mailer/host/user triple.
4199Ruleset 0 is rather lengthy
4200as it has to handle 3 basic address forms:
4201RFC976 bang paths,
4202RFC1123 %-hacks
4203(including vanilla RFC822 local-part@domain),
4204and RFC822 source routes.
4205It's also complicated by having to handle named lists.
4206.pp
4207The header rewriting rulesets 1 and 2
4208remove the trailing "@.UUCP" that hides bang paths.
4209Ruleset 2 also strips the $# mailer $@ host (for test mode).
4210.pp
4211Ruleset 4 does absolutely nothing.
4212.pp
4213The per-mailer rewriting rulesets conform the envelope and
4214header addresses to the requirements of the specific
4215mailer.
4216.pp
4217Lots of rulesets-as-subroutines are used.
4218.pp
4219As a result, header addresses are subject to minimal munging
4220(per RFC1123), and the general plan is per RFC822 sect. 3.4.10.
f13b6b36 4221.sh 3 "Relevant issues"
55c435aa 4222.pp
f13b6b36
EA
4223The canonical form you use
4224should almost certainly be as specified in
6d5ff626 4225the Internet protocols
f13b6b36
EA
4226RFC819 and RFC822.
4227Copies of these RFC's are included on the
4228.i sendmail
4229tape
4230as
4231.i doc/rfc819.lpr
4232and
4233.i doc/rfc822.lpr .
55c435aa 4234.pp
f13b6b36
EA
4235RFC822
4236describes the format of the mail message itself.
4237.i Sendmail
4238follows this RFC closely,
4239to the extent that many of the standards described in this document
4240can not be changed without changing the code.
4241In particular,
4242the following characters have special interpretations:
4243.(b
4244< > ( ) " \e
4245.)b
4246Any attempt to use these characters for other than their RFC822
4247purpose in addresses is probably doomed to disaster.
4da134f8 4248.pp
f13b6b36
EA
4249RFC819
4250describes the specifics of the domain-based addressing.
4251This is touched on in RFC822 as well.
4252Essentially each host is given a name
4253which is a right-to-left dot qualified pseudo-path
4254from a distinguished root.
4255The elements of the path need not be physical hosts;
4256the domain is logical rather than physical.
4257For example,
4258at Berkeley
4259one legal host might be
4260.q a.CC.Berkeley.EDU ;
4261reading from right to left,
4262.q EDU
4263is a top level domain
4264comprising educational institutions,
4265.q Berkeley
4266is a logical domain name,
4267.q CC
4268represents the Computer Center,
4269(in this case a strictly logical entity),
4270and
4271.q a
4272is a host in the Computer Center.
4273.pp
4274Beware when reading RFC819
4275that there are a number of errors in it.
4276.sh 3 "How to proceed"
4277.pp
4278Once you have decided on a philosophy,
4279it is worth examining the available configuration tables
4280to decide if any of them are close enough
4281to steal major parts of.
4282Even under the worst of conditions,
4283there is a fair amount of boiler plate that can be collected safely.
4284.pp
4285The next step is to build ruleset three.
4286This will be the hardest part of the job.
4287Beware of doing too much to the address in this ruleset,
4288since anything you do will reflect through
4289to the message.
4290In particular,
4291stripping of local domains is best deferred,
4292since this can leave you with addresses with no domain spec at all.
4293Since
4da134f8 4294.i sendmail
f13b6b36
EA
4295likes to append the sending domain to addresses with no domain,
4296this can change the semantics of addresses.
4297Also try to avoid
4298fully qualifying domains in this ruleset.
4299Although technically legal,
4300this can lead to unpleasantly and unnecessarily long addresses
4301reflected into messages.
4302The Berkeley configuration files
4303define ruleset nine
4304to qualify domain names and strip local domains.
4305This is called from ruleset zero
4306to get all addresses into a cleaner form.
4307.pp
4308Once you have ruleset three finished,
4309the other rulesets should be relatively trivial.
4310If you need hints,
4311examine the supplied configuration tables.
4312.sh 3 "Testing the rewriting rules \*- the \-bt flag"
4313.pp
4314When you build a configuration table,
4315you can do a certain amount of testing
4316using the
4317.q "test mode"
4318of
4319.i sendmail .
4320For example,
4321you could invoke
4da134f8 4322.i sendmail
f13b6b36
EA
4323as:
4324.(b
4325sendmail \-bt \-Ctest.cf
4326.)b
4327which would read the configuration file
4328.q test.cf
4329and enter test mode.
4330In this mode,
4331you enter lines of the form:
4332.(b
4333rwset address
4334.)b
4335where
4336.i rwset
4337is the rewriting set you want to use
4da134f8 4338and
f13b6b36
EA
4339.i address
4340is an address to apply the set to.
4341Test mode shows you the steps it takes
4342as it proceeds,
4343finally showing you the address it ends up with.
4344You may use a comma separated list of rwsets
093461e4 4345for sequential application of rules to an input.
f13b6b36 4346For example:
6362a767 4347.(b
093461e4 43483,1,21,4 monet:bollard
6362a767 4349.)b
f13b6b36
EA
4350first applies ruleset three to the input
4351.q monet:bollard.
4352Ruleset one is then applied to the output of ruleset three,
4353followed similarly by rulesets twenty-one and four.
4da134f8 4354.pp
f13b6b36
EA
4355If you need more detail,
4356you can also use the
4357.q \-d21
4358flag to turn on more debugging.
4359For example,
6362a767 4360.(b
f13b6b36 4361sendmail \-bt \-d21.99
6362a767 4362.)b
f13b6b36
EA
4363turns on an incredible amount of information;
4364a single word address
4365is probably going to print out several pages worth of information.
093461e4
EA
4366.pp
4367You should be warned that internally,
4368.b sendmail
4369applies ruleset 3 to all addresses.
4370In this version of sendmail, you will have to do that manually.
4371For example, older versions allowed you to use
4372.(b
43730 bruce@broadcast.sony.com
4374.)b
4375This version requires that you use:
4376.(b
43773,0 bruce@broadcast.sony.com
4378.)b
f13b6b36
EA
4379.sh 3 "Building mailer descriptions"
4380.pp
4381To add an outgoing mailer to your mail system,
4382you will have to define the characteristics of the mailer.
4383.pp
4384Each mailer must have an internal name.
4385This can be arbitrary,
4386except that the names
4387.q local
4388and
4389.q prog
4390must be defined.
4391.pp
4392The pathname of the mailer must be given in the P field.
4393If this mailer should be accessed via an IPC connection,
4394use the string
4395.q [IPC]
4396instead.
4397.pp
4398The F field defines the mailer flags.
4399You should specify an
4400.q f
4401or
4402.q r
4403flag to pass the name of the sender as a
4404.b \-f
4405or
4406.b \-r
4407flag respectively.
4408These flags are only passed if they were passed to
4409.i sendmail,
4410so that mailers that give errors under some circumstances
4411can be placated.
4412If the mailer is not picky
4413you can just specify
4414.q "\-f $g"
4415in the argv template.
4416If the mailer must be called as
4417.b root
4418the
4419.q S
4420flag should be given;
4421this will not reset the userid
4422before calling the mailer\**.
4423.(f
4424\**\c
4425.i Sendmail
4426must be running setuid to root
4427for this to work.
4428.)f
4429If this mailer is local
4430(i.e., will perform final delivery
4431rather than another network hop)
4432the
4433.q l
4434flag should be given.
4435Quote characters
4436(backslashes and " marks)
4437can be stripped from addresses if the
4438.q s
4439flag is specified;
4440if this is not given
4441they are passed through.
4442If the mailer is capable of sending to more than one user
4443on the same host
4444in a single transaction
4445the
4446.q m
4447flag should be stated.
4448If this flag is on,
4449then the argv template containing
4450.b $u
4451will be repeated for each unique user
4452on a given host.
4453The
4454.q e
4455flag will mark the mailer as being
4456.q expensive,
4457which will cause
4458.i sendmail
4459to defer connection
4460until a queue run\**.
4461.(f
4462\**The
4463.q c
4464configuration option must be given
4465for this to be effective.
4466.)f
4467.pp
4468An unusual case is the
4469.q C
4470flag.
4471This flag applies to the mailer that the message is received from,
4472rather than the mailer being sent to;
4473if set,
4474the domain spec of the sender
4475(i.e., the
4476.q @host.domain
4477part)
4478is saved
4479and is appended to any addresses in the message
4480that do not already contain a domain spec.
4481For example,
4482a message of the form:
4da134f8 4483.(b
3dfefb78
EA
4484From: eric@vangogh.CS.Berkeley.EDU
4485To: wnj@monet.CS.Berkeley.EDU, mckusick
4da134f8 4486.)b
f13b6b36
EA
4487will be modified to:
4488.(b
3dfefb78
EA
4489From: eric@vangogh.CS.Berkeley.EDU
4490To: wnj@monet.CS.Berkeley.EDU, mckusick@vangogh.CS.Berkeley.EDU
f13b6b36
EA
4491.)b
4492.i "if and only if"
f3e184c1 4493the
f13b6b36
EA
4494.q C
4495flag is defined in the mailer corresponding to
3dfefb78 4496.q eric@vangogh.CS.Berkeley.EDU.
f13b6b36
EA
4497.pp
4498Other flags are described
4499in Appendix C.
4500.pp
4501The S and R fields in the mailer description
4502are per-mailer rewriting sets
4503to be applied to sender and recipient addresses
4504respectively.
4505These are applied after the sending domain is appended
4506and the general rewriting sets
4507(numbers one and two)
4508are applied,
4509but before the output rewrite
4510(ruleset four)
4511is applied.
4512A typical use is to append the current domain
4513to addresses that do not already have a domain.
4514For example,
4515a header of the form:
4516.(b
4517From: eric
4518.)b
4519might be changed to be:
4520.(b
3dfefb78 4521From: eric@vangogh.CS.Berkeley.EDU
f13b6b36
EA
4522.)b
4523or
4524.(b
4525From: ucbvax!eric
4526.)b
4527depending on the domain it is being shipped into.
4528These sets can also be used
4529to do special purpose output rewriting
4530in cooperation with ruleset four.
4531.pp
4532The E field defines the string to use
4533as an end-of-line indication.
4534A string containing only newline is the default.
4535The usual backslash escapes
4536(\er, \en, \ef, \eb)
4537may be used.
4538.pp
4539Finally,
4540an argv template is given as the E field.
4541It may have embedded spaces.
4542If there is no argv with a
4543.b $u
4544macro in it,
f3e184c1 4545.i sendmail
f13b6b36
EA
4546will speak SMTP
4547to the mailer.
4548If the pathname for this mailer is
4549.q [IPC],
4550the argv should be
4551.(b
4552IPC $h [ \fIport\fP ]
4553.)b
4554where
4555.i port
4556is the optional port number
4557to connect to.
4558.pp
4559For example,
4560the specifications:
4561.(b
4562.ta \w'Mlocal, 'u +\w'P=/bin/mail, 'u +\w'F=rlsm, 'u +\w'S=10, 'u +\w'R=20, 'u
4563Mlocal, P=/bin/mail, F=rlsm S=10, R=20, A=mail \-d $u
4564Mether, P=[IPC], F=meC, S=11, R=21, A=IPC $h, M=100000
4565.)b
4566specifies a mailer to do local delivery
4567and a mailer for ethernet delivery.
4568The first is called
4569.q local,
4570is located in the file
4571.q /bin/mail,
4572takes a picky
4573.b \-r
4574flag,
4575does local delivery,
4576quotes should be stripped from addresses,
4577and multiple users can be delivered at once;
4578ruleset ten
4579should be applied to sender addresses in the message
4580and ruleset twenty
4581should be applied to recipient addresses;
4582the argv to send to a message will be the word
4583.q mail,
4584the word
4585.q \-d,
4586and words containing the name of the receiving user.
4587If a
4588.b \-r
4589flag is inserted
4590it will be between the words
4591.q mail
4592and
4593.q \-d.
4594The second mailer is called
4595.q ether,
4596it should be connected to via an IPC connection,
4597it can handle multiple users at once,
4598connections should be deferred,
4599and any domain from the sender address
4600should be appended to any receiver name
4601without a domain;
4602sender addresses should be processed by ruleset eleven
4603and recipient addresses by ruleset twenty-one.
4604There is a 100,000 byte limit on messages passed through this mailer.
4605.sh 2 "The User Database"
4606.pp
4607If you have a version of sendmail with the user database package
4608compiled in,
4609the handling of sender and recipient addresses
4610is modified.
4611.pp
4612The location of this database is controlled with the
4613.b U
4614option.
4615.sh 3 "Structure of the user database"
4616.pp
4617The database is a sorted (BTree-based) structure.
4618User records are stored with the key:
55c435aa 4619.(b
f13b6b36 4620\fIuser-name\fP\fB:\fP\fIfield-name\fP
55c435aa 4621.)b
f13b6b36
EA
4622The sorted database format ensures that user records are clustered together.
4623Meta-information is always stored with a leading colon.
4624.pp
4625Field names define both the syntax and semantics of the value.
4626Defined fields include:
4627.nr ii 1i
4628.ip maildrop
4629The delivery address for this user.
4630There may be multiple values of this record.
4631In particular,
4632mailing lists will have one
4633.i maildrop
4634record for each user on the list.
4635.ip "mailname"
4636The outgoing mailname for this user.
4637For each outgoing name,
4638there should be an appropriate
4639.i maildrop
4640record for that name to allow return mail.
4641See also
4642.i :default:mailname .
4643.ip fullname
4644The full name of the user.
4645.ip office-address
4646The office address for this user.
4647.ip office-phone
4648The office phone number for this user.
4649.ip office-fax
4650The office FAX number for this user.
4651.ip home-address
4652The home address for this user.
4653.ip home-phone
4654The home phone number for this user.
4655.ip home-fax
4656The home FAX number for this user.
4657.ip project
4658A (short) description of the project this person is affiliated with.
4659In the University this is often just the name of their graduate advisor.
4660.ip plan
4661A pointer to a file from which plan information can be gathered.
4662.pp
4663As of this writing,
4664only a few of these fields are actually being used by sendmail:
4665.i maildrop
4666and
4667.i mailname .
4668A
4669.i finger
4670program that uses the other fields is planned.
4671.sh 3 "User database semantics"
4672.pp
4673When the rewriting rules submit an address to the local mailer,
4674the user name is passed through the alias file.
4675If no alias is found (or if the alias points back to the same address),
4676the name (with
4677.q :maildrop
4678appended)
4679is then used as a key in the user database.
4680If no match occurs (or if the maildrop points at the same address),
4681forwarding is tried.
4682.pp
4683If the first token of the user name returned by ruleset 0
4684is an
4685.q @
4686sign, the user database lookup is skipped.
4687The intent is that the user database will act as a set of defaults
4688for a cluster (in our case, the Computer Science Division);
4689mail sent to a specific machine should ignore these defaults.
4690.pp
4691When mail is sent,
4692the name of the sending user is looked up in the database.
4693If that user has a
4694.q mailname
4695record,
4696the value of that record is used as their outgoing name.
4697For example, I might have a record:
55c435aa 4698.(b
f13b6b36 4699eric:mailname Eric.Allman@CS.Berkeley.EDU
55c435aa 4700.)b
f13b6b36
EA
4701This would cause my outgoing mail to be sent as Eric.Allman.
4702.pp
4703If a
4704.q maildrop
4705is found for the user,
4706but no corresponding
4707.q maildrop
4708record exists,
4709the record
4710.q :default:mailname
4711is consulted.
4712If present, this is the name of a host to override the local host.
4713For example, in our case we would set it to
4714.q CS.Berkeley.EDU .
4715The effect is that anyone known in the database
4716gets their outgoing mail stamped as
4717.q user@CS.Berkeley.EDU ,
4718but people not listed in the database use the local hostname.
4719.sh 1 "OTHER CONFIGURATION"
4da134f8
EA
4720.pp
4721There are some configuration changes that can be made by
4722recompiling
4723.i sendmail .
f13b6b36
EA
4724This section describes what changes can be made
4725and what has to be modified to make them.
4726.sh 2 "Parameters in src/Makefile"
55c435aa 4727.pp
102e8f9c
EA
4728These parameters are intended to describe the compilation environment,
4729not site policy,
4730and should normally be defined in src/Makefile.
55c435aa
EA
4731.ip NDBM
4732If set,
4733the new version of the DBM library
4734that allows multiple databases will be used.
102e8f9c
EA
4735If neither NDBM nor NEWDB are set,
4736a much less efficient method of alias lookup is used.
55c435aa
EA
4737.ip NEWDB
4738If set, use the new database package from Berkeley (from 4.4BSD).
4739This package is substantially faster than DBM or NDBM.
102e8f9c
EA
4740If NEWDB and NDBM are both set,
4741sendmail will read DBM files,
55c435aa 4742but will create and use NEWDB files.
102e8f9c
EA
4743.ip YPCOMPAT
4744If set together with
4745.i both
4746NEWDB and NDBM,
4747.i sendmail
4748will create both DBM and NEWDB files if and only if
4749the file /var/yp/Makefile
4750exists and is readable.
4751This is intended for compatibility with Sun Microsystems'
4752.i mkalias
4753program used on YP masters.
dfd63518
EA
4754.ip SYSTEM5
4755Set all of the compilation parameters appropriate for System V.
55c435aa
EA
4756.ip LOCKF
4757Use System V
4758.b lockf
4759instead of Berkeley
4760.b flock .
32c5f422
EA
4761Due to the highly unusual semantics of locks
4762across forks in
55c435aa
EA
4763.b lockf ,
4764this should never be used unless absolutely necessary.
dfd63518
EA
4765Set by default if
4766SYSTEM5 is set.
55c435aa
EA
4767.ip SYS5TZ
4768Use System V
4769time zone semantics.
dfd63518
EA
4770.ip HASINITGROUPS
4771Set this if your system has the
4772.i initgroups()
4773call
4774(if you have multiple group support).
4775This is the default if SYSTEM5 is
4776.i not
4777defined or if you are on HPUX.
4778.ip HASUNAME
4779Set this if you have the
59baf33c 4780.i uname (2)
dfd63518
EA
4781system call (or corresponding library routine).
4782Set by default if
4783SYSTEM5
4784is set.
59baf33c
EA
4785.ip HASSTATFS
4786Set this if you have the
4787.i statfs (2)
4788system call.
4789This will allow you to give a temporary failure
4790message to incoming SMTP email
4791when you are low on disk space.
4792It is set by default on 4.4 BSD and OSF/1 systems.
f90dac5e
EA
4793.ip HASUSTAT
4794Set if you have the
4795.i ustat (2)
4796system call.
4797This is an alternative implementation of disk space control.
4798You should only set one of HASSTATFS or HASUSTAT;
4799the first is preferred.
4800.ip _PATH_SENDMAILCF
4801The pathname of the sendmail.cf file.
4802.ip _PATH_SENDMAILFC
4803The pathname of the sendmail.fc file.
4804.ip _PATH_SENDMAILPID
4805The pathname of the sendmail.pid file.
55c435aa
EA
4806.ip LA_TYPE
4807The load average type.
4808Details are described below.
de7324ac
EA
4809.lp
4810The are four built-in ways of computing the load average.
4811.i Sendmail
4812tries to auto-configure them based on imperfect guesses;
4813you can select one using the
4814.i cc
4815option
4816.b \-DLA_TYPE= \c
4817.i type ,
4818where
4819.i type
4820is:
4821.ip LA_INT
4822The kernel stores the load average in the kernel as an array of long integers.
4823The actual values are scaled by a factor FSCALE
4824(default 256).
4825.ip LA_FLOAT
4826The kernel stores the load average in the kernel as an array of
4827double precision floats.
4828.ip LA_SUBR
4829Call the
4830.i getloadavg
4831routine to get the load average as an array of doubles.
4832.ip LA_ZERO
4833Always return zero as the load average.
4834This is the fallback case.
4835.lp
4836If type
4837.sm LA_INT
4838or
4839.sm LA_FLOAT
4840is specified,
4841you may also need to specify
4842.sm _PATH_UNIX
4843(the path to your system binary)
4844and
4845.sm LA_AVENRUN
4846(the name of the variable containing the load average in the kernel;
4847usually
4848.q _avenrun
4849or
4850.q avenrun ).
f13b6b36 4851.sh 2 "Parameters in src/conf.h"
b16e27c4
EA
4852.pp
4853Parameters and compilation options
4854are defined in conf.h.
4855Most of these need not normally be tweaked;
4856common parameters are all in sendmail.cf.
4857However, the sizes of certain primitive vectors, etc.,
4858are included in this file.
4859The numbers following the parameters
4860are their default value.
74b6e641 4861.nr ii 1.2i
367a5dcd 4862.ip "MAXLINE [1024]"
b16e27c4
EA
4863The maximum line length of any input line.
4864If message lines exceed this length
4865they will still be processed correctly;
4866however, header lines,
4867configuration file lines,
4868alias lines,
4869etc.,
4870must fit within this limit.
367a5dcd 4871.ip "MAXNAME [256]"
b16e27c4
EA
4872The maximum length of any name,
4873such as a host or a user name.
b16e27c4
EA
4874.ip "MAXPV [40]"
4875The maximum number of parameters to any mailer.
4876This limits the number of recipients that may be passed in one transaction.
f13b6b36
EA
4877It can be set to any arbitrary number above about 10,
4878since
4879.i sendmail
4880will break up a delivery into smaller batches as needed.
4881A higher number may reduce load on your system, however.
b16e27c4
EA
4882.ip "MAXATOM [100]"
4883The maximum number of atoms
4884(tokens)
4885in a single address.
4886For example,
4887the address
55c435aa
EA
4888.q "eric@CS.Berkeley.EDU"
4889is seven atoms.
b16e27c4
EA
4890.ip "MAXMAILERS [25]"
4891The maximum number of mailers that may be defined
4892in the configuration file.
f13b6b36 4893.ip "MAXRWSETS [100]"
b16e27c4
EA
4894The maximum number of rewriting sets
4895that may be defined.
4896.ip "MAXPRIORITIES [25]"
4897The maximum number of values for the
4898.q Precedence:
4899field that may be defined
4900(using the
4901.b P
4902line in sendmail.cf).
367a5dcd
EA
4903.ip "MAXUSERENVIRON [40]"
4904The maximum number of items in the user environment
4905that will be passed to subordinate mailers.
f13b6b36 4906.ip "QUEUESIZE [1000]"
4f24419a
EA
4907The maximum number of entries that will be processed
4908in a single queue run.
f13b6b36 4909.ip "MAXMXHOSTS [20]"
daae36f7 4910The maximum number of MX records we will accept for any single host.
e920f7ff
EA
4911.ip "MAXIPADDR [16]"
4912The maximum number of numeric IP addresses we will accept
4913for this host.
4914This does not limit the number the number of addresses for other hosts.
b16e27c4
EA
4915.lp
4916A number of other compilation options exist.
4917These specify whether or not specific code should be compiled in.
55c435aa 4918.nr ii 1.2i
4da134f8
EA
4919.ip DEBUG
4920If set, debugging information is compiled in.
4921To actually get the debugging output,
4922the
4923.b \-d
4924flag must be used.
f13b6b36
EA
4925.b "WE STRONGLY RECOMMEND THAT THIS BE LEFT ON."
4926Some people, believing that it was a security hole
4927(it was, once)
4928have turned it off and thus crippled debuggers.
959bbd2e 4929.ip NETINET
f13b6b36 4930If set,
959bbd2e
EA
4931support for Internet protocol networking is compiled in.
4932Previous versions of
4933.b sendmail
4934referred to this as
4935.sm DAEMON ;
4936this old usage is now incorrect.
4937.ip NETISO
4938If set,
337767a9
EA
4939support for ISO protocol networking is compiled in
4940(it may be appropriate to #define this in the Makefile instead of conf.h).
4da134f8
EA
4941.ip LOG
4942If set,
4943the
4944.i syslog
4945routine in use at some sites is used.
4946This makes an informational log record
4947for each message processed,
4948and makes a higher priority log record
4949for internal system errors.
f13b6b36
EA
4950.ip MATCHGECOS
4951Compile in the code to do ``fuzzy matching'' on the GECOS field
4952in /etc/passwd.
4953This also requires that option G be turned on.
4954.ip NAMED_BIND
4955Compile in code to use the
4956Berkeley Internet Name Domain (BIND) server
4957to resolve TCP/IP host names.
4958.ip NOTUNIX
4959If you are using a non-UNIX mail format,
4960you can set this flag to turn off special processing
4961of UNIX-style
4962.q "From "
4963lines.
4da134f8
EA
4964.ip QUEUE
4965This flag should be set to compile in the queueing code.
4966If this is not set,
4967mailers must accept the mail immediately
4968or it will be returned to the sender.
f13b6b36
EA
4969.ip SETPROCTITLE
4970If defined,
4971.i sendmail
4972will change its
4973.i argv
4974array to indicate its current status.
4975This can be used in conjunction with the
4976.i ps
4977command to find out just what it's up to.
4da134f8
EA
4978.ip SMTP
4979If set,
4980the code to handle user and server SMTP will be compiled in.
4981This is only necessary if your machine has some mailer
f13b6b36
EA
4982that speaks SMTP
4983(this means most machines everywhere).
4da134f8
EA
4984.ip UGLYUUCP
4985If you have a UUCP host adjacent to you which is not running
4986a reasonable version of
4987.i rmail ,
4988you will have to set this flag to include the
4989.q "remote from sysname"
4990info on the from line.
4991Otherwise, UUCP gets confused about where the mail came from.
daae36f7 4992.ip USERDB
55c435aa
EA
4993Include the
4994.b experimental
4995Berkeley user information database package.
daae36f7
EA
4996This adds a new level of local name expansion
4997between aliasing and forwarding.
4998It also uses the NEWDB package.
55c435aa 4999This may change in future releases.
337767a9
EA
5000.ip IDENTPROTO
5001Compile in the IDENT protocol as defined in RFC 1413.
5002This defaults on for all systems except Ultrix,
5003which apparently has the interesting
5004.q feature
5005that when it receives a
5006.q "host unreachable"
5007message it closes all open connections to that host.
5008Since some firewall gateways send this error code
5009when you access an unauthorized port (such as 113, used by IDENT),
5010Ultrix cannot receive email from such hosts.
f13b6b36 5011.sh 2 "Configuration in src/conf.c"
4da134f8 5012.pp
de7324ac
EA
5013The following changes can be made in conf.c.
5014.sh 3 "Built-in Header Semantics"
5015.pp
4da134f8
EA
5016Not all header semantics are defined in the configuration file.
5017Header lines that should only be included by certain mailers
5018(as well as other more obscure semantics)
5019must be specified in the
5020.i HdrInfo
5021table in
5022.i conf.c .
5023This table contains the header name
b16e27c4
EA
5024(which should be in all lower case)
5025and a set of header control flags (described below),
5026The flags are:
4da134f8 5027.ip H_ACHECK
b16e27c4
EA
5028Normally when the check is made to see if a header line is compatible
5029with a mailer,
5030.i sendmail
5031will not delete an existing line.
5032If this flag is set,
5033.i sendmail
5034will delete
5035even existing header lines.
4da134f8
EA
5036That is,
5037if this bit is set and the mailer does not have flag bits set
b16e27c4
EA
5038that intersect with the required mailer flags
5039in the header definition in
5040sendmail.cf,
4da134f8
EA
5041the header line is
5042.i always
5043deleted.
5044.ip H_EOH
5045If this header field is set,
5046treat it like a blank line,
5047i.e.,
5048it will signal the end of the header
5049and the beginning of the message text.
5050.ip H_FORCE
5051Add this header entry
5052even if one existed in the message before.
5053If a header entry does not have this bit set,
5054.i sendmail
5055will not add another header line if a header line
5056of this name already existed.
5057This would normally be used to stamp the message
5058by everyone who handled it.
5059.ip H_TRACE
5060If set,
5061this is a timestamp
5062(trace)
5063field.
5064If the number of trace fields in a message
5065exceeds a preset amount
5066the message is returned
5067on the assumption that it has an aliasing loop.
5068.ip H_RCPT
5069If set,
5070this field contains recipient addresses.
5071This is used by the
5072.b \-t
5073flag to determine who to send to
5074when it is collecting recipients from the message.
5075.ip H_FROM
5076This flag indicates that this field
5077specifies a sender.
5078The order of these fields in the
5079.i HdrInfo
5080table specifies
5081.i sendmail's
5082preference
5083for which field to return error messages to.
5084.nr ii 5n
5085.lp
5086Let's look at a sample
5087.i HdrInfo
5088specification:
5089.(b
be2fcca9 5090.ta 4n +\w'"return-receipt-to", 'u
4da134f8 5091struct hdrinfo HdrInfo[] =
367a5dcd 5092\&{
69a914e1 5093 /* originator fields, most to least significant */
be2fcca9
EA
5094 "resent-sender", H_FROM,
5095 "resent-from", H_FROM,
5096 "sender", H_FROM,
5097 "from", H_FROM,
5098 "full-name", H_ACHECK,
69a914e1 5099 /* destination fields */
be2fcca9
EA
5100 "to", H_RCPT,
5101 "resent-to", H_RCPT,
5102 "cc", H_RCPT,
69a914e1 5103 /* message identification and control */
be2fcca9
EA
5104 "message", H_EOH,
5105 "text", H_EOH,
69a914e1 5106 /* trace fields */
be2fcca9 5107 "received", H_TRACE|H_FORCE,
4da134f8 5108
be2fcca9 5109 NULL, 0,
4da134f8 5110};
4da134f8 5111.)b
be2fcca9 5112This structure indicates that the
4da134f8
EA
5113.q To: ,
5114.q Resent-To: ,
5115and
5116.q Cc:
be2fcca9 5117fields
4da134f8 5118all specify recipient addresses.
be2fcca9
EA
5119Any
5120.q Full-Name:
5121field will be deleted unless the required mailer flag
5122(indicated in the configuration file)
5123is specified.
4da134f8
EA
5124The
5125.q Message:
5126and
5127.q Text:
5128fields will terminate the header;
55c435aa 5129these are used by random dissenters around the network world.
4da134f8
EA
5130The
5131.q Received:
5132field will always be added,
5133and can be used to trace messages.
4da134f8
EA
5134.pp
5135There are a number of important points here.
5136First,
5137header fields are not added automatically just because they are in the
5138.i HdrInfo
5139structure;
5140they must be specified in the configuration file
5141in order to be added to the message.
5142Any header fields mentioned in the configuration file but not
5143mentioned in the
5144.i HdrInfo
5145structure have default processing performed;
5146that is,
5147they are added unless they were in the message already.
5148Second,
5149the
5150.i HdrInfo
5151structure only specifies cliched processing;
5152certain headers are processed specially by ad hoc code
5153regardless of the status specified in
5154.i HdrInfo .
5155For example,
5156the
5157.q Sender:
5158and
5159.q From:
5160fields are always scanned on ARPANET mail
6d5ff626
EA
5161to determine the sender\**;
5162.(f
5163\**Actually, this is no longer true in SMTP;
5164this information is contained in the envelope.
5165The older ARPANET protocols did not completely distinguish
5166envelope from header.
5167.)f
4da134f8
EA
5168this is used to perform the
5169.q "return to sender"
5170function.
5171The
5172.q "From:"
5173and
5174.q "Full-Name:"
5175fields are used to determine the full name of the sender
5176if possible;
5177this is stored in the macro
5178.b $x
5179and used in a number of ways.
de7324ac 5180.sh 3 "Restricting Use of Email"
4da134f8 5181.pp
69a914e1 5182If it is necessary to restrict mail through a relay,
4da134f8
EA
5183the
5184.i checkcompat
5185routine can be modified.
5186This routine is called for every recipient address.
d1e44f94
EA
5187It returns an exit status
5188indicating the status of the message.
5189The status
5190.sm EX_OK
5191accepts the address,
5192.sm EX_TEMPFAIL
5193queues the message for a later try,
5194and other values
5195(commonly
5196.sm EX_UNAVAILABLE )
5197reject the message.
5198It is up to
4da134f8
EA
5199.i checkcompat
5200to print an error message
5201(using
5202.i usrerr )
d1e44f94 5203if the message is rejected.
4da134f8
EA
5204For example,
5205.i checkcompat
5206could read:
5207.(b
5208.re
74b6e641 5209.sz -1
69a914e1 5210.ta 4n +4n +4n +4n +4n +4n +4n
d1e44f94
EA
5211int
5212checkcompat(to, e)
4da134f8 5213 register ADDRESS *to;
d1e44f94 5214 register ENVELOPE *e;
367a5dcd 5215\&{
d1e44f94
EA
5216 register STAB *s;
5217
5218 s = stab("private", ST_MAILER, ST_FIND);
5219 if (s != NULL && e\->e_from.q_mailer != LocalMailer &&
5220 to->q_mailer == s->s_mailer)
5221 {
5222 usrerr("No private net mail allowed through this machine");
5223 return (EX_UNAVAILABLE);
5224 }
5225 if (MsgSize > 50000 && to\->q_mailer != LocalMailer)
4da134f8
EA
5226 {
5227 usrerr("Message too large for non-local delivery");
7a316267 5228 NoReturn = TRUE;
d1e44f94 5229 return (EX_UNAVAILABLE);
4da134f8 5230 }
d1e44f94 5231 return (EX_OK);
4da134f8
EA
5232}
5233.sz
5234.)b
5235This would reject messages greater than 50000 bytes
5236unless they were local.
7a316267 5237The
f13b6b36
EA
5238.i NoReturn
5239flag can be sent to suppress the return of the actual body
5240of the message in the error return.
5241The actual use of this routine is highly dependent on the
5242implementation,
5243and use should be limited.
de7324ac 5244.sh 3 "Load Average Computation"
f13b6b36
EA
5245.pp
5246The routine
5247.i getla
5248should return an approximation of the current system load average
5249as an integer.
de7324ac
EA
5250There are four versions included on compilation flags
5251as described above.
5252.sh 3 "New Database Map Classes"
f13b6b36
EA
5253.pp
5254New key maps can be added by creating a class initialization function
5255and a lookup function.
5256These are then added to the routine
5257.i setupmaps.
5258.pp
5259The initialization function is called as
5260.(b
5261\fIxxx\fP_map_init(MAP *map, char *mapname, char *args)
5262.)b
5263The
5264.i map
5265is an internal data structure.
5266The
5267.i mapname
5268is the name of the map (used for error messages).
5269The
5270.i args
5271is a pointer to the rest of the configuration file line;
5272flags and filenames can be extracted from this line.
5273The initialization function must return
5274.sm TRUE
5275if it successfully opened the map,
5276.sm FALSE
5277otherwise.
5278.pp
5279The lookup function is called as
5280.(b
e9305caa 5281\fIxxx\fP_map_lookup(MAP *map, char buf[], int bufsize, char **av, int *statp)
f13b6b36
EA
5282.)b
5283The
5284.i map
5285defines the map internally.
5286The parameters
5287.i buf
5288and
5289.i bufsize
5290have the input key.
5291This may be (and often is) used destructively.
5292The
5293.i av
5294is a list of arguments passed in from the rewrite line.
5295The lookup function should return a pointer to the new value.
e9305caa
EA
5296IF the map lookup fails,
5297.i *statp
5298should be set to an exit status code;
5299in particular, it should be set to
5300.sm EX_TEMPFAIL
5301if recovery is to be attempted by the higher level code.
55aab950
EA
5302.sh 3 "Queueing Function"
5303.pp
5304The routine
5305.i shouldqueue
5306is called to decide if a message should be queued
5307or processed immediately.
5308Typically this compares the message priority to the current load average.
5309The default definition is:
5310.(b
5311bool
5312shouldqueue(pri, ctime)
5313 long pri;
5314 time_t ctime;
5315{
5316 if (CurrentLA < QueueLA)
5317 return (FALSE);
859d056a
EA
5318 if (CurrentLA >= RefuseLA)
5319 return (TRUE);
55aab950
EA
5320 return (pri > (QueueFactor / (CurrentLA \- QueueLA + 1)));
5321}
5322.)b
5323If the current load average
5324(global variable
5325.i CurrentLA ,
5326which is set before this function is called)
859d056a 5327is less than the low threshold load average
55aab950
EA
5328(option
5329.b x ,
5330variable
5331.i QueueLA ),
5332.i shouldqueue
5333returns
5334.sm FALSE
5335immediately
5336(that is, it should
5337.i not
5338queue).
859d056a
EA
5339If the current load average exceeds the high threshold load average
5340(option
5341.b X ,
5342variable
5343.i RefuseLA ),
5344.i shouldqueue
5345returns
5346.sm TRUE
5347immediately.
55aab950
EA
5348Otherwise, it computes the function based on the message priority,
5349the queue factor
5350(option
5351.b q ,
5352global variable
5353.i QueueFactor ),
5354and the current and threshold load averages.
5355.pp
5356An implementation wishing to take the actual age of the message into account
5357can also use the
5358.i ctime
5359parameter,
5360which is the time that the message was first submitted to
5361.i sendmail .
5362Note that the
5363.i pri
5364parameter is already weighted
5365by the number of times the message has been tried
5366(although this tends to lower the priority of the message with time);
5367the expectation is that the
5368.i ctime
5369would be used as an
5370.q "escape clause"
5371to ensure that messages are eventually processed.
5372.sh 3 "Refusing Incoming SMTP Connections"
5373.pp
5374The function
5375.i refuseconnections
5376returns
5377.sm TRUE
5378if incoming SMTP connections should be refused.
5379The current implementation is based exclusively on the current load average
5380and the refuse load average option
5381(option
5382.b X ,
5383global variable
5384.i RefuseLA ):
5385.(b
5386bool
5387refuseconnections()
5388{
859d056a 5389 return (CurrentLA >= RefuseLA);
55aab950
EA
5390}
5391.)b
5392A more clever implementation
5393could look at more system resources.
5394.sh 3 "Load Average Computation"
5395.pp
5396The routine
5397.i getla
5398returns the current load average (as a rounded integer).
5399The distribution includes several possible implementations.
f13b6b36
EA
5400.sh 2 "Configuration in src/daemon.c"
5401.pp
5402The file
5403.i src/daemon.c
5404contains a number of routines that are dependent
5405on the local networking environment.
5406The version supplied is specific to 4.3 BSD.
5407.pp
5408In previous releases,
5409we recommended that you modify the routine
5410.i maphostname
5411if you wanted to generalize
5412.b $[
5413\&...\&
5414.b $]
5415lookups.
5416We now recommend that you create a new keyed map instead.
f90dac5e 5417.sh 1 "CHANGES IN VERSION 6"
f13b6b36
EA
5418.pp
5419The following summarizes changes
5420since the last commonly available version of
5421.b sendmail
5422(5.67):
5423.sh 2 "Connection Caching"
5424.pp
5425Instead of closing SMTP connections immediately,
5426those connections are cached for possible future use.
5427The advent of MX records made this effective for mailing lists;
5428in addition,
5429substantial performance improvements can be expected for queue processing.
d1e44f94
EA
5430.sh 2 "MX Piggybacking"
5431.pp
5432If two hosts with different names in a single message
5433happen to have the same set of MX hosts,
5434they can be sent in the same transaction.
acbfac81 5435Version 6 notices this and tries to batch the messages.
f13b6b36
EA
5436.sh 2 "Eight-Bit Clean"
5437.pp
5438Previous versions of
5439.b sendmail
5440used the 0200 bit for quoting.
5441This version avoids that use.
5442However, for compatibility with RFC 822,
5443the default is still to strip the eighth bit;
5444set option `8' to get full 8-bit clean processing.
5445.pp
5446Individual mailers can still produce seven bit out put using the
5447`7' mailer flag.
5448.sh 2 "User Database"
5449.pp
5450The user database is an as-yet experimental attempt
5451to provide unified large-site name support.
5452We are installing it at Berkeley;
5453future versions may show significant modifications.
5454.sh 2 "Improved BIND Support"
5455.pp
5456The BIND support,
5457particularly for MX records,
5458had a number of annoying
5459.q features
5460which have been removed in this release.
5461In particular,
5462these more tightly bind (pun intended) the name server to sendmail,
5463so that the name server resolution rules are incorporated directly into
5464.b sendmail .
5465.sh 2 "Keyed Files"
5466.pp
5467Generalized keyed files is an idea taken directly from
5468.sm IDA
5469.b sendmail
5470(albeit with a completely different implementation).
5471They can be useful on large sites.
de7324ac
EA
5472.pp
5473R6 also understands YP.
9873c4c7
EA
5474.sh 2 "Multi-Word Classes"
5475.pp
5476Classes can now be multiple words.
5477For example,
5478.(b
5479CShofmann.CS.Berkeley.EDU
5480.)b
5481allows you to match the entire string
5482.q hofmann.CS.Berkeley.EDU
5483using the single construct
5484.q $=S .
25e4e430
EA
5485.sh 2 "Deferred Macro Expansion"
5486.pp
5487The
5488.b $& \c
5489.i x
5490construct has been adopted from
5491.sm IDA .
5492.sh 2 "IDENT Protocol Support"
5493.pp
5494The IDENT protocol as defined in RFC 1413 is supported.
f13b6b36
EA
5495.sh 2 "Parsing Bug Fixes"
5496.pp
5497A number of small bugs having to do with things like
5498backslash-escaped quotes inside of comments
5499have been fixed.
f90dac5e 5500.sh 2 "Separate Envelope/Header Processing"
f13b6b36
EA
5501.pp
5502Since the From: line is passed in separately from the envelope sender,
5503these have both been made visible;
5504the
91679fc8
EA
5505.b $g
5506macro is set to the envelope sender during processing
5507of mailer argument vectors
5508and the header sender during processing of headers.
6ebbc09a 5509.pp
f90dac5e
EA
5510It is also possible to specify separate per-mailer
5511envelope and header processing.
6ebbc09a
EA
5512The
5513.b S enderRWSet
5514and
5515.b R ecipientRWset
5516arguments for mailers
5517can be specified as
5518.i envelope/header
5519to give different rewritings for envelope versus header addresses.
f90dac5e
EA
5520.sh 2 "Owner-List Propagates to Envelope"
5521.pp
5522When an alias has an associated owner\-list name,
5523that alias is used to change the envelope sender address.
5524This will cause downstream errors to be returned to that owner.
f13b6b36
EA
5525.sh 2 "Dynamic Header Allocation"
5526.pp
5527The fixed size limit on header lines has been eliminated.
5528.sh 2 "New Command Line Flag"
5529.pp
5530The \-p flag has been added
5531to pass in protocol information.
f90dac5e
EA
5532.sh 2 "New and Old Configuration Line Types"
5533.pp
5534The
5535.b T
5536(Trusted users) configuration line has been deleted.
5537It will still be accepted but will be ignored.
5538.pp
5539The
5540.b K
5541line has been added to declare database maps.
5542.pp
5543The
5544.b V
5545line has been added to declare the configuration version level.
f13b6b36
EA
5546.sh 2 "New Options"
5547.pp
5548Several new options have been added,
5549many to support new features,
5550others to allow tuning that was previously available
5551only by recompiling.
de7324ac 5552They are described in detail in Section 5.1.5.
f13b6b36 5553Briefly,
859d056a
EA
5554.ip b
5555Insist on a minimum number of disk blocks.
f13b6b36
EA
5556.ip C
5557Set checkpoint interval.
5558.ip E
5559Default error message.
de7324ac
EA
5560.ip G
5561Enable GECOS matching.
f13b6b36
EA
5562.ip h
5563Maximum hop count.
5564.ip J
5565Forward file path.
5566.ip k
5567Connection cache size
5568.ip K
5569Connection cache lifetime.
859d056a
EA
5570.ip p
5571Privacy options.
f13b6b36
EA
5572.ip U
5573User database spec.
f13b6b36
EA
5574.ip 8
5575Run eight bit clean.
859d056a
EA
5576.sh 2 "Extended Options"
5577.pp
5578The
5579.b r
31e506e2 5580(read timeout),
859d056a 5581.b I
31e506e2
EA
5582(use BIND),
5583and
5584.b T
5585(queue timeout)
859d056a
EA
5586options have been extended to pass in more information.
5587.sh 2 "New Mailer Flag"
5588.pp
5589The
5590.b c
5591mailer flag will strip all comments
5592from addresses;
5593this should only be used as a last resort
5594when dealing with cranky mailers.
acbfac81
EA
5595.sh 2 "New LHS Token"
5596.pp
5597Version 6 allows
5598.b $@
5599on the Left Hand Side of an
5600.q R
5601line to match zero tokens.
5602This is intended to be used to match the null input.
f13b6b36
EA
5603.sh 2 "Bigger Defaults"
5604.pp
acbfac81 5605Version 6 allows up to 100 rulesets instead of 30.
f13b6b36
EA
5606It is recommended that rulesets 0\-9 be reserved for
5607.i sendmail 's
5608dedicated use in future releases.
5609.pp
5610The total number of MX records that can be used has been raised to 20.
5611.pp
5612The number of queued messages that can be handled at one time
5613has been raised from 600 to 1000.
d1e44f94
EA
5614.sh 2 "Different Default Tuning Parameters"
5615.pp
acbfac81 5616Version 6 has changed the default parameters
d1e44f94
EA
5617for tuning queue costs
5618to make the number of recipients more important
5619than the size of the message (for small messages).
5620This is reasonable if you are connected with reasonably fast links.
de7324ac
EA
5621.sh 2 "Auto-Quoting in Addresses"
5622.pp
5623Previously, the
5624.q "Full Name <email address>"
5625syntax would generate incorrect protocol output
5626if
5627.q "Full Name"
5628had special characters such as dot.
5629This version puts quotes around such names.
5630.sh 2 "Symbolic Names On Error Mailer"
5631.pp
5632Several names have been built in to the $@ portion of the $#error
5633mailer.
59baf33c
EA
5634.sh 2 "SMTP VRFY Doesn't Expand"
5635.pp
5636Previous versions of
5637.i sendmail
5638treated VRFY and EXPN the same.
5639In this version,
5640VRFY doesn't expand aliases or follow .forward files.
5641.pp
5642As an optimization, if you run with your default delivery mode being
5643queue-only,
5644the RCPT command will also not chase aliases and .forward files.
5645It will chase them when it processes the queue.
337767a9
EA
5646.sh 2 "[IPC] Mailers Allow Multiple Hosts"
5647.pp
5648When an address resolves to a mailer that has
5649.q [IPC]
5650as its
5651.q Path ,
5652the $@ part (host name)
5653can be a colon-separated list of hosts instead of a single hostname.
5654This asks sendmail to search the list for the first entry that is available
5655exactly as though it were an MX record.
5656The intent is to route internal traffic through internal networks
5657without publishing an MX record to the net.
5658MX expansion is still done on the individual items.
de7324ac
EA
5659.sh 2 "Portability and Security Enhancements"
5660.pp
5661A number of internal changes have been made to enhance portability.
5662.pp
5663Several fixes have been made to increase the paranoia factor.
6d5ff626
EA
5664.sh 1 "ACKNOWLEDGEMENTS"
5665.pp
5666I've worked on
5667.i sendmail
5668for many years,
5669and many employers have been remarkably patient
5670about letting me work on a large project
5671that was not part of my official job.
5672This includes time on the INGRES Project at Berkeley,
5673at Britton Lee,
5674and again on the Mammoth Project at Berkeley.
5675.pp
5676Much of the second wave of improvements
5677should be credited to Bryan Costales of ICSI.
5678As he passed me drafts of his book on
5679.i sendmail
5680I was inspired to start working on things again.
5681Bryan was also available to bounce ideas off of.
5682.pp
5683Many, many people contributed chunks of code and ideas to
5684.i sendmail .
5685It has proven to be a group network effort.
50d4a65c
EA
5686Version 6 in particular was a group project.
5687The following people made notable contributions:
5688.(l
5689Keith Bostic, CSRG, University of California, Berkeley
5690Michael J. Corrigan, University of California, San Diego
5691Bryan Costales, International Computer Science Institute
5692P{r (Pell) Emanuelsson
5693Craig Everhart, Transarc Corporation
5694Tom Ivar Helbekkmo, Norwegian School of Economics
5695Allan E. Johannesen, WPI
5696Takahiro Kanbe, FujiXerox
5697Brian Kantor, University of California, San Diego
5698Bruce Lilly, Sony U.S.
5699Nakamura Motonori, Kyoto University
5700John Gardiner Myers, Carnegie Mellon University
5701Neil Rickert, Northern Illinois University
5702Eric Wassenaar, National Institute for Nuclear and High Energy Physics, Amsterdam
5703Christophe Wolfhugel, INSA (???)
5704.)l
5705I apologize for anyone I have omitted, misspelled, misattributed, or
5706otherwise missed.
5707Many other people have contributed ideas, comments, and encouragement.
5708I appreciate their contribution as well.
f13b6b36
EA
5709.++ A
5710.+c "COMMAND LINE FLAGS"
5711.ba 0
5712.nr ii 1i
5713.pp
5714Arguments must be presented with flags before addresses.
5715The flags are:
5716.ip \-b\fIx\fP
5717Set operation mode to
5718.i x .
5719Operation modes are:
5720.(b
5721.ta 4n
5722m Deliver mail (default)
5723s Speak SMTP on input side
5724d Run as a daemon
5725t Run in test mode
5726v Just verify addresses, don't collect or deliver
5727i Initialize the alias database
5728p Print the mail queue
5729z Freeze the configuration file
5730.)b
5731.ip \-C\fIfile\fP
5732Use a different configuration file.
5733.i Sendmail
5734runs as the invoking user (rather than root)
5735when this flag is specified.
5736.ip \-d\fIlevel\fP
5737Set debugging level.
5738.ip "\-f\ \fIaddr\fP"
5739The sender's machine address is
5740.i addr .
f13b6b36
EA
5741.ip \-F\fIname\fP
5742Sets the full name of this user to
5743.i name .
5744.ip "\-h\ \fIcnt\fP"
5745Sets the
5746.q "hop count"
5747to
5748.i cnt .
5749This represents the number of times this message has been processed
5750by
5751.i sendmail
5752(to the extent that it is supported by the underlying networks).
5753.i Cnt
5754is incremented during processing,
5755and if it reaches
5756MAXHOP
5757(currently 30)
5758.i sendmail
5759throws away the message with an error.
5760.ip \-n
5761Don't do aliasing or forwarding.
5762.ip "\-r\ \fIaddr\fP"
5763An obsolete form of
5764.b \-f .
5765.ip \-o\fIx\|value\fP
5766Set option
5767.i x
5768to the specified
5769.i value .
5770These options are described in Appendix B.
5771.ip \-p\fIprotocol\fP
5772Set the sending protocol.
5773Programs are encouraged to set this.
5774The protocol field can be in the form
5775.i protocol \c
5776.b : \c
5777.i host
5778to set both the sending protocol and sending host.
5779For example,
5780.q \-pUUCP:uunet
5781sets the sending protocol to UUCP
5782and the sending host to uunet.
5783(Some existing programs use \-oM to set the r and s macros;
5784this is equivalent to using \-p.)
5785.ip \-q\fItime\fP
5786Try to process the queued up mail.
5787If the time is given,
5788a sendmail will run through the queue at the specified interval
5789to deliver queued mail;
5790otherwise, it only runs once.
0780838b
EA
5791.ip \-q\fIXstring\fP
5792Run the queue once,
5793limiting the jobs to those matching
5794.i Xstring .
5795The key letter
5796.i X
5797can be
5798.b I
5799to limit based on queue identifier,
5800.b R
5801to limit based on recipient,
5802or
5803.b S
5804to limit based on sender.
5805A particular queued job is accepted if one of the corresponding addresses
5806contains the indicated
5807.i string .
f13b6b36
EA
5808.ip \-t
5809Read the header for
5810.q To: ,
5811.q Cc: ,
5812and
5813.q Bcc:
5814lines, and send to everyone listed in those lists.
5815The
5816.q Bcc:
5817line will be deleted before sending.
5818Any addresses in the argument vector will be deleted
5819from the send list.
daae36f7 5820.pp
f13b6b36
EA
5821There are a number of options that may be specified as
5822primitive flags
5823(provided for compatibility with
5824.i delivermail ).
5825These are the e, i, m, and v options.
5826Also,
5827the f option
5828may be specified as the
5829.b \-s
5830flag.
5831.+c "QUEUE FILE FORMATS"
5832.pp
5833This appendix describes the format of the queue files.
5834These files live in the directory defined by the
5835.b Q
5836option in the
5837.i sendmail.cf
5838file, usually
5839.i /var/spool/mqueue
daae36f7 5840or
f13b6b36
EA
5841.i /usr/spool/mqueue .
5842.pp
5843All queue files have the name
b3c10f97 5844\fIx\fP\|\fBf\fP\fIAAA99999\fP
f13b6b36 5845where
b3c10f97 5846.i AAA99999
f13b6b36
EA
5847is the
5848.i id
5849for this message
5850and the
5851.i x
5852is a type.
b3c10f97
EA
5853The first letter of the id encodes the hour of the day
5854that the message was received by the system
5855(with A being the hour between midnight and 1:00AM).
f13b6b36
EA
5856All files with the same id collectively define one message.
5857.pp
5858The types are:
5859.nr ii 0.5i
5860.ip d
5861The data file.
5862The message body (excluding the header) is kept in this file.
5863.ip l
5864The lock file.
5865If this file exists,
5866the job is currently being processed,
5867and a queue run will not process the file.
5868For that reason,
5869an extraneous
5870.b lf
5871file can cause a job to apparently disappear
5872(it will not even time out!).
5873[Actually, this file is obsolete on most systems that support the
5874.b flock
daae36f7 5875or
f13b6b36
EA
5876.b lockf
5877system calls.]
5878.ip n
5879This file is created when an id is being created.
5880It is a separate file to insure that no mail can ever be destroyed
5881due to a race condition.
5882It should exist for no more than a few milliseconds
5883at any given time.
5884[This is only used on old versions of
5885sendmail;
5886it is not used
5887on newer versions.]
5888.ip q
5889The queue control file.
5890This file contains the information necessary to process the job.
5891.ip t
5892A temporary file.
5893These are an image of the
5894.b qf
5895file when it is being rebuilt.
5896It should be renamed to a
5897.b qf
5898file very quickly.
5899.ip x
5900A transcript file,
5901existing during the life of a session
5902showing everything that happens
5903during that session.
367a5dcd 5904.pp
f13b6b36
EA
5905The
5906.b qf
5907file is structured as a series of lines
5908each beginning with a code letter.
5909The lines are as follows:
5910.ip D
5911The name of the data file.
5912There may only be one of these lines.
5913.ip H
5914A header definition.
5915There may be any number of these lines.
5916The order is important:
5917they represent the order in the final message.
5918These use the same syntax
5919as header definitions in the configuration file.
5920.ip C
5921The controlling address.
5922Recipient addresses following this line
5923will be flagged as having resulted from an alias of this name.
5924This affect the actual UNIX user id used for delivery.
5925.ip R
5926A recipient address.
5927This will normally be completely aliased,
5928but is actually realiased when the job is processed.
5929There will be one line
5930for each recipient.
5931.ip S
5932The sender address.
5933There may only be one of these lines.
5934.ip E
5935An error address.
5936If any such lines exist,
5937they represent the addresses that should receive error messages.
5938.ip T
5939The job creation time.
5940This is used to compute when to time out the job.
5941.ip P
5942The current message priority.
5943This is used to order the queue.
5944Higher numbers mean lower priorities.
5945The priority changes
5946as the message sits in the queue.
5947The initial priority depends on the message class
5948and the size of the message.
5949.ip M
5950A message.
5951This line is printed by the
5952.i mailq
5953command,
5954and is generally used to store status information.
5955It can contain any text.
d93f0185
EA
5956.ip F
5957Flag bits, represented as one letter per flag.
5958Defined flag bits are
5959.b r
5960indicating that this is a response message
5961and
5962.b w
5963indicating that a warning message has been sent
5964announcing that the mail has been delayed.
f13b6b36
EA
5965.ip $
5966A macro definition.
5967The values of certain macros
5968(as of this writing, only
5969.b $r
5970and
5971.b $s )
5972are passed through to the queue run phase.
40eb61ea
EA
5973.ip B
5974The body type.
5975The remainder of the line is a text string defining the body type.
5976If this field is missing,
5977the body type is assumed to be
5978.q "undefined"
5979and no special processing is attempted.
5980Legal values are
5981.q 7BIT
5982and
5983.q 8BITMIME .
367a5dcd 5984.pp
f13b6b36
EA
5985As an example,
5986the following is a queue file sent to
5987.q eric@mammoth.Berkeley.EDU
5988and
5989.q bostic@okeeffe.CS.Berkeley.EDU \**:
5990.(f
5991\**This example is contrived and probably inaccurate for your environment.
5992Glance over it to get an idea;
5993nothing can replace looking at what your own system generates.
5994.)f
5995.(b
5996P835771
5997T404261372
b3c10f97 5998DdfAAA13557
f13b6b36
EA
5999Seric
6000Cdaemon
6001Eowner-sendmail@vangogh.CS.Berkeley.EDU
6002Ceric
6003Reric@mammoth.Berkeley.EDU
6004Rbostic@okeeffe.CS.Berkeley.EDU
6005H?P?return-path: <owner-sendmail@vangogh.CS.Berkeley.EDU>
b3c10f97 6006Hreceived: by vangogh.CS.Berkeley.EDU (5.108/2.7) id AAA06703;
f13b6b36
EA
6007 Fri, 17 Jul 92 00:28:55 -0700
6008Hreceived: from mail.CS.Berkeley.EDU by vangogh.CS.Berkeley.EDU (5.108/2.7)
b3c10f97 6009 id AAA06698; Fri, 17 Jul 92 00:28:54 -0700
f13b6b36
EA
6010Hreceived: from [128.32.31.21] by mail.CS.Berkeley.EDU (5.96/2.5)
6011 id AA22777; Fri, 17 Jul 92 03:29:14 -0400
6012Hreceived: by foo.bar.baz.de (5.57/Ultrix3.0-C)
6013 id AA22757; Fri, 17 Jul 92 09:31:25 GMT
6014H?F?from: eric@foo.bar.baz.de (Eric Allman)
6015H?x?full-name: Eric Allman
6016Hmessage-id: <9207170931.AA22757@foo.bar.baz.de>
6017HTo: sendmail@vangogh.CS.Berkeley.EDU
6018Hsubject: this is an example message
6019.)b
6020This shows the name of the data file,
6021the person who sent the message,
6022the submission time
6023(in seconds since January 1, 1970),
6024the message priority,
6025the message class,
6026the recipients,
6027and the headers for the message.
69a914e1
EA
6028.+c "SUMMARY OF SUPPORT FILES"
6029.pp
6030This is a summary of the support files
6031that
6032.i sendmail
6033creates or generates.
f13b6b36
EA
6034Many of these can be changed by editing the sendmail.cf file;
6035check there to find the actual pathnames.
69a914e1 6036.nr ii 1i
55c435aa 6037.ip "/usr/\*(SD/sendmail"
69a914e1
EA
6038The binary of
6039.i sendmail .
6040.ip /usr/bin/newaliases
55c435aa 6041A link to /usr/\*(SD/sendmail;
69a914e1 6042causes the alias database to be rebuilt.
74b6e641
EA
6043Running this program is completely equivalent to giving
6044.i sendmail
6045the
6046.b \-bi
6047flag.
69a914e1
EA
6048.ip /usr/bin/mailq
6049Prints a listing of the mail queue.
74b6e641
EA
6050This program is equivalent to using the
6051.b \-bp
6052flag to
6053.i sendmail .
daae36f7 6054.ip /etc/sendmail.cf
69a914e1
EA
6055The configuration file,
6056in textual form.
daae36f7 6057.ip /etc/sendmail.fc
69a914e1
EA
6058The configuration file
6059represented as a memory image.
6060.ip /usr/lib/sendmail.hf
6061The SMTP help file.
daae36f7 6062.ip /etc/sendmail.st
69a914e1 6063A statistics file; need not be present.
859d056a
EA
6064.ip /etc/sendmail.pid
6065Created in daemon mode;
6066it contains the process id of the current SMTP daemon.
6067If you use this in scripts;
6068use ``head \-1'' to get just the first line;
6069later versions of
6070.i sendmail
6071may add information to subsequent lines.
daae36f7 6072.ip /etc/aliases
69a914e1 6073The textual version of the alias file.
daae36f7 6074.ip /etc/aliases.{pag,dir}
69a914e1 6075The alias file in
74b6e641 6076.i dbm \|(3)
69a914e1 6077format.
daae36f7 6078.ip /var/spool/mqueue
69a914e1
EA
6079The directory in which the mail queue
6080and temporary files reside.
daae36f7 6081.ip /var/spool/mqueue/qf*
69a914e1 6082Control (queue) files for messages.
daae36f7 6083.ip /var/spool/mqueue/df*
69a914e1 6084Data files.
daae36f7 6085.ip /var/spool/mqueue/tf*
69a914e1
EA
6086Temporary versions of the qf files,
6087used during queue file rebuild.
daae36f7 6088.ip /var/spool/mqueue/xf*
69a914e1 6089A transcript of the current session.
28719ec2
JB
6090.\".ro
6091.\".ls 1
6092.\".tp
6093.\".sp 2i
6094.\".in 0
6095.\".ce 100
6096.\".sz 24
6097.\".b SENDMAIL
6098.\".sz 14
6099.\".sp
6100.\"INSTALLATION AND OPERATION GUIDE
6101.\".sp
6102.\".sz 10
6103.\"Eric Allman
6104.\"Britton-Lee, Inc.
6105.\".sp
50d4a65c 6106.\"Version 6.42
28719ec2
JB
6107.\".ce 0
6108.pn 2
6109.bp
4da134f8 6110.ce
74b6e641 6111.sz 12
4da134f8 6112TABLE OF CONTENTS
74b6e641 6113.sz 10
28719ec2 6114.sp
3702dbcc
EA
6115.\" remove some things to avoid "out of temp file space" problem
6116.rm sh
6117.rm (x
6118.rm )x
6119.rm ip
6120.rm pp
6121.rm lp
6122.rm he
6123.rm fo
6124.rm eh
6125.rm oh
6126.rm ef
6127.rm of
4da134f8 6128.xp