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