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