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