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