reverse sense of 'w' option; delete obsolete discussion of
[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.\"
daf6b53c 7.\" @(#)op.me 5.15 (Berkeley) %G%
28719ec2 8.\"
367a5dcd
EA
9.\" eqn % | troff -me
10.\"if n .ls 2
28719ec2 11.\".he 'Sendmail Installation and Operation Guide''%'
daf6b53c 12.\".fo 'Version 5.15''Last Mod %G%'
28719ec2
JB
13.eh 'SMM:07-%''Sendmail Installation and Operation Guide'
14.oh 'Sendmail Installation and Operation Guide''SMM:07-%'
4da134f8
EA
15.nr si 3n
16.de $0
17.(x
2fb78b49
EA
18.in \\$3u*3n
19.ti -3n
4da134f8
EA
20\\$2. \\$1
21.)x
22..
69a914e1
EA
23.de $C
24.(x
25.in 0
26\\$1 \\$2. \\$3
27.)x
28..
4da134f8
EA
29.+c
30.(l C
74b6e641
EA
31.sz 16
32.b SENDMAIL
4da134f8 33.sz 12
74b6e641
EA
34.sp
35.b "INSTALLATION AND OPERATION GUIDE"
36.sz 10
37.sp
4da134f8 38.r
4da134f8 39Eric Allman
d754edf0
EA
40University of California, Berkeley
41Mammoth Project
69a914e1 42.sp
daf6b53c 43Version 5.15
18843c53
PL
44.sp
45For Sendmail Version 5.61
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
76Although
77.i sendmail
78is intended to run
79without the need for monitoring,
80it has a number of features
81that may be used to monitor or adjust the operation
82under unusual circumstances.
83These features are described.
84.pp
85Section one describes how to do a basic
86.i sendmail
87installation.
88Section two
69a914e1 89explains the day-to-day information you should know
4da134f8
EA
90to maintain your mail system.
91If you have a relatively normal site,
92these two sections should contain sufficient information
93for you to install
94.i sendmail
95and keep it happy.
96Section three
2fb78b49
EA
97describes some parameters that may be safely tweaked.
98Section four
99has information regarding the command line arguments.
100Section five
4da134f8
EA
101contains the nitty-gritty information about the configuration
102file.
103This section is for masochists
104and people who must write their own configuration file.
4da134f8
EA
105The appendixes give a brief
106but detailed explanation of a number of features
107not described in the rest of the paper.
74b6e641
EA
108.pp
109The references in this paper are actually found
110in the companion paper
111.ul
112Sendmail \- An Internetwork Mail Router.
113This other paper should be read before this manual
114to gain a basic understanding
115of how the pieces fit together.
28719ec2
JB
116.pn 4
117.bp
4da134f8
EA
118.sh 1 "BASIC INSTALLATION"
119.pp
120There are two basic steps to installing sendmail.
121The hard part is to build the configuration table.
122This is a file that sendmail reads when it starts up
123that describes the mailers it knows about,
124how to parse addresses,
125how to rewrite the message header,
126and the settings of various options.
127Although the configuration table is quite complex,
128a configuration can usually be built
129by adjusting an existing off-the-shelf configuration.
130The second part is actually doing the installation,
131i.e., creating the necessary files, etc.
132.pp
133The remainder of this section will describe the installation of sendmail
134assuming you can use one of the existing configurations
135and that the standard installation parameters are acceptable.
2fb78b49
EA
136All pathnames and examples
137are given from the root of the
138.i sendmail
318b7556
EA
139subtree,
140normally
141.i /usr/src/usr.lib/sendmail
142on 4.3BSD.
4da134f8
EA
143.sh 2 "Off-The-Shelf Configurations"
144.pp
18843c53
PL
145Configuration files currently in use at Berkeley are in
146the directory
147.i cf
4da134f8 148of the sendmail directory.
18843c53
PL
149This directory contains three subdirectories:
150.i cf ,
151.i m4 ,
152and
153.i sitedep .
28719ec2 154The directory
18843c53
PL
155.i cf/m4
156contains site-independent
157.i m4 (1)
158include files that have information common to all configuration files,
159while
160.i cf/sitedep
161contains
162.i m4 (1)
163include files that have site-specific information in them.
164These files are used by the master configuration (``.mc'')
165in
166.i cf/cf
167and produce standard configuration files (with
4da134f8 168.q .cf
18843c53
PL
169suffix) when run through
170.i m4 (1).
4da134f8 171.pp
305e3ca1 172Three off the shelf configurations are supplied
4da134f8 173to handle the basic cases:
305e3ca1 174.np
18843c53
PL
175Internet sites running the nameserver
176(or using host tables wherein the fully-qualfied domain
177name of each host is listed first)
305e3ca1 178can use
18843c53 179.i cf/tcpproto.cf .
305e3ca1
EA
180For simple sites,
181you should be able to use this file without modification.
182This file is not in
e3611808
EA
183.i m4
184format.
305e3ca1 185.np
18843c53
PL
186UUCP only sites can use
187.i cf/uucpproto.cf .
305e3ca1
EA
188This file is not in
189.i m4
190format.
191.np
192A group of machines at a single site
18843c53
PL
193connected by an ethernet (or other networking
194that supports TCP/IP)
305e3ca1
EA
195with (only) one host connected to the outside world
196via UUCP
197is represented by two configuration files:
18843c53 198.i cf/tcpuucpproto.cf
305e3ca1
EA
199should be installed on the host with outside connections
200and
18843c53 201.i cf/tcpproto.cf
305e3ca1 202should be installed on all other hosts.
305e3ca1 203.pp
18843c53
PL
204Some configuration will be needed in each of the
205above cases.
206Just be sure to correctly fill in the
207.q blanks
208as shown in the instructions in the configuration file.
209Then install the file as
f0b465a8 210.i /usr/lib/sendmail.cf .
18843c53
PL
211.pp
212If you are running a larger or more complex site, it
213is to your advantage to read the
214.q README
215file in the
216.i cf
217subdirectory.
218This file explains how to use
219.i m4 (1)
220to automatically create configuration files for
221non-standard situations.
f0b465a8
EA
222.sh 2 "Installation Using the Makefile"
223.pp
224A makefile exists in the root of the
225.i sendmail
226directory that will do all of these steps
28719ec2 227for a 4.3BSD system.
f0b465a8
EA
228It may have to be slightly tailored
229for use on other systems.
230.pp
28719ec2
JB
231Before using this makefile, you should create a symbolic link from
232.i cf
233to the directory containing your configuration files.
234You should also have created your configuration file
f0b465a8
EA
235and left it in the file
236.q cf/\fIsystem\fP.cf
237where
238.i system
239is the name of your system
240(i.e., what is returned by
74b6e641 241.i hostname \|(1)).
f0b465a8
EA
242If you do not have
243.i hostname
244you can use the declaration
245.q HOST=\fIsystem\fP
246on the
74b6e641 247.i make \|(1)
f0b465a8 248command line.
bff69eb1
EA
249You should also examine the file
250.i md/config.m4
251and change the
252.i m4
253macros there to reflect any libraries and compilation flags
254you may need.
f0b465a8
EA
255.pp
256The basic installation procedure is to type:
69a914e1 257.(b
f0b465a8
EA
258make
259make install
28719ec2 260make installcf
69a914e1 261.)b
f0b465a8
EA
262in the root directory of the
263.i sendmail
264distribution.
265This will make all binaries
266and install them in the standard places.
28719ec2 267The second and third
f0b465a8 268.i make
28719ec2 269commands must be executed as the superuser (root).
f0b465a8 270.sh 2 "Installation by Hand"
4da134f8
EA
271.pp
272Along with building a configuration file,
f0b465a8
EA
273you will have to install the
274.i sendmail
275startup into your UNIX system.
2fb78b49 276If you are doing this installation
69a914e1
EA
277in conjunction with a regular Berkeley UNIX install,
278these steps will already be complete.
f0b465a8 279Many of these steps will have to be executed as the superuser (root).
69a914e1
EA
280.sh 3 "/usr/lib/sendmail"
281.pp
282The binary for sendmail is located in /usr/lib.
18843c53
PL
283If it becomes necessary to recompile and reinstall the
284entire system, the following sequence will do it:
69a914e1
EA
285.(b
286cd src
28719ec2 287make clean
18843c53 288make install
69a914e1 289.)b
f0b465a8
EA
290.sh 3 "/usr/lib/sendmail.cf"
291.pp
292The configuration file
293that you created earlier
294should be installed in /usr/lib/sendmail.cf:
295.(b
296cp cf/\fIsystem\fP.cf /usr/lib/sendmail.cf
297.)b
2fb78b49
EA
298.sh 3 "/usr/ucb/newaliases"
299.pp
300If you are running delivermail,
301it is critical that the
302.i newaliases
303command be replaced.
304This can just be a link to
305.i sendmail :
306.(b
74b6e641 307rm \-f /usr/ucb/newaliases
2fb78b49
EA
308ln /usr/lib/sendmail /usr/ucb/newaliases
309.)b
4da134f8
EA
310.sh 3 "/usr/spool/mqueue"
311.pp
312The directory
313.i /usr/spool/mqueue
314should be created to hold the mail queue.
18843c53
PL
315This directory should be mode 755
316and owned by root.
69a914e1
EA
317.sh 3 "/usr/lib/aliases*"
318.pp
319The system aliases are held in three files.
320The file
321.q /usr/lib/aliases
322is the master copy.
323A sample is given in
324.q lib/aliases
325which includes some aliases which
326.i must
327be defined:
328.(b
329cp lib/aliases /usr/lib/aliases
330.)b
331You should extend this file with any aliases that are apropos to your system.
332.pp
333Normally
334.i sendmail
335looks at a version of these files maintained by the
74b6e641 336.i dbm \|(3)
69a914e1
EA
337routines.
338These are stored in
339.q /usr/lib/aliases.dir
340and
341.q /usr/lib/aliases.pag.
342These can initially be created as empty files,
343but they will have to be initialized promptly.
18843c53 344These should be mode 644:
69a914e1
EA
345.(b
346cp /dev/null /usr/lib/aliases.dir
347cp /dev/null /usr/lib/aliases.pag
18843c53 348chmod 644 /usr/lib/aliases.*
74b6e641 349newaliases
69a914e1
EA
350.)b
351.sh 3 "/usr/lib/sendmail.fc"
352.pp
353If you intend to install the frozen version of the configuration file
354(for quick startup)
355you should create the file /usr/lib/sendmail.fc
356and initialize it.
357This step may be safely skipped.
358.(b
359cp /dev/null /usr/lib/sendmail.fc
3f83c754 360/usr/lib/sendmail \-bz
69a914e1 361.)b
4da134f8
EA
362.sh 3 "/etc/rc"
363.pp
364It will be necessary to start up the sendmail daemon when your system reboots.
365This daemon performs two functions:
366it listens on the SMTP socket for connections
367(to receive mail from a remote system)
368and it processes the queue periodically
369to insure that mail gets delivered when hosts come up.
370.pp
371Add the following lines to
69a914e1 372.q /etc/rc
4da134f8 373(or
69a914e1 374.q /etc/rc.local
4da134f8
EA
375as appropriate)
376in the area where it is starting up the daemons:
377.(b
378if [ \-f /usr/lib/sendmail ]; then
bff69eb1
EA
379 (cd /usr/spool/mqueue; rm \-f [lnx]f*)
380 /usr/lib/sendmail \-bd \-q30m &
4da134f8
EA
381 echo \-n ' sendmail' >/dev/console
382fi
383.)b
384The
385.q cd
386and
387.q rm
388commands insure that all lock files have been removed;
389extraneous lock files may be left around
390if the system goes down in the middle of processing a message.
391The line that actually invokes
392.i sendmail
393has two flags:
394.q \-bd
395causes it to listen on the SMTP port,
396and
bff69eb1
EA
397.q \-q30m
398causes it to run the queue every half hour.
69a914e1
EA
399.pp
400If you are not running a version of UNIX
401that supports Berkeley TCP/IP,
402do not include the
403.b \-bd
404flag.
405.sh 3 "/usr/lib/sendmail.hf"
406.pp
407This is the help file used by the SMTP
408.b HELP
409command.
410It should be copied from
411.q lib/sendmail.hf :
412.(b
413cp lib/sendmail.hf /usr/lib
414.)b
415.sh 3 "/usr/lib/sendmail.st"
416.pp
417If you wish to collect statistics
418about your mail traffic,
419you should create the file
2fb78b49
EA
420.q /usr/lib/sendmail.st :
421.(b
422cp /dev/null /usr/lib/sendmail.st
423chmod 666 /usr/lib/sendmail.st
424.)b
69a914e1
EA
425This file does not grow.
426It is printed with the program
427.q aux/mailstats.
3f83c754
EA
428.sh 3 "/usr/ucb/newaliases"
429.pp
430If
431.i sendmail
432is invoked as
433.q newaliases,
434it will simulate the
435.b \-bi
436flag
437(i.e., will rebuild the alias database;
438see below).
439This should be a link to /usr/lib/sendmail.
440.sh 3 "/usr/ucb/mailq"
441.pp
442If
443.i sendmail
444is invoked as
445.q mailq,
446it will simulate the
447.b \-bp
448flag
449(i.e.,
450.i sendmail
451will print the contents of the mail queue;
452see below).
453This should be a link to /usr/lib/sendmail.
4da134f8 454.sh 1 "NORMAL OPERATIONS"
817683ae
EA
455.sh 2 "Quick Configuration Startup"
456.pp
457A fast version of the configuration file
458may be set up by using the
b16e27c4 459.b \-bz
817683ae
EA
460flag:
461.(b
b16e27c4 462/usr/lib/sendmail \-bz
817683ae
EA
463.)b
464This creates the file
b16e27c4
EA
465.i /usr/lib/sendmail.fc
466(\c
69a914e1 467.q "frozen configuration" ).
817683ae
EA
468This file is an image of
469.i sendmail 's
470data space after reading in the configuration file.
471If this file exists,
472it is used instead of
473.i /usr/lib/sendmail.cf
69a914e1
EA
474.i sendmail.fc
475must be rebuilt manually every time
817683ae
EA
476.i sendmail.cf
477is changed.
478.pp
69a914e1 479The frozen configuration file will be ignored
817683ae
EA
480if a
481.b \-C
482flag is specified
483or if sendmail detects that it is out of date.
484However, the heuristics are not strong
485so this should not be trusted.
4da134f8
EA
486.sh 2 "The System Log"
487.pp
488The system log is supported by the
367a5dcd 489.i syslogd \|(8)
4da134f8
EA
490program.
491.sh 3 "Format"
492.pp
493Each line in the system log
494consists of a timestamp,
495the name of the machine that generated it
496(for logging from several machines
18843c53 497over the local area network),
4da134f8
EA
498the word
499.q sendmail: ,
500and a message.
501.sh 3 "Levels"
502.pp
69a914e1 503If you have
367a5dcd 504.i syslogd \|(8)
69a914e1
EA
505or an equivalent installed,
506you will be able to do logging.
507There is a large amount of information that can be logged.
508The log is arranged as a succession of levels.
509At the lowest level
510only extremely strange situations are logged.
511At the highest level,
512even the most mundane and uninteresting events
513are recorded for posterity.
514As a convention,
515log levels under ten
516are considered
517.q useful;
518log levels above ten
519are usually for debugging purposes.
520.pp
521A complete description of the log levels
367a5dcd 522is given in section 4.6.
4da134f8
EA
523.sh 2 "The Mail Queue"
524.pp
525The mail queue should be processed transparently.
526However, you may find that manual intervention is sometimes necessary.
527For example,
528if a major host is down for a period of time
529the queue may become clogged.
530Although sendmail ought to recover gracefully when the host comes up,
531you may find performance unacceptably bad in the meantime.
3f83c754
EA
532.sh 3 "Printing the queue"
533.pp
534The contents of the queue can be printed
535using the
74b6e641
EA
536.i mailq
537command
538(or by specifying the
3f83c754 539.b \-bp
74b6e641 540flag to sendmail):
3f83c754 541.(b
74b6e641 542mailq
3f83c754
EA
543.)b
544This will produce a listing of the queue id's,
545the size of the message,
546the date the message entered the queue,
547and the sender and recipients.
4da134f8
EA
548.sh 3 "Format of queue files"
549.pp
550All queue files have the form
74b6e641 551\fIx\fP\|\fBf\fP\fIAA99999\fP
4da134f8 552where
74b6e641 553.i AA99999
4da134f8
EA
554is the
555.i id
556for this file
557and the
558.i x
559is a type.
560The types are:
4da134f8
EA
561.ip d
562The data file.
563The message body (excluding the header) is kept in this file.
564.ip l
565The lock file.
566If this file exists,
567the job is currently being processed,
568and a queue run will not process the file.
569For that reason,
570an extraneous
571.b lf
572file can cause a job to apparently disappear
573(it will not even time out!).
817683ae
EA
574.ip n
575This file is created when an id is being created.
576It is a separate file to insure that no mail can ever be destroyed
577due to a race condition.
578It should exist for no more than a few milliseconds
579at any given time.
580.ip q
581The queue control file.
582This file contains the information necessary to process the job.
4da134f8
EA
583.ip t
584A temporary file.
585These are an image of the
586.b qf
587file when it is being rebuilt.
588It should be renamed to a
589.b qf
590file very quickly.
591.ip x
817683ae
EA
592A transcript file,
593existing during the life of a session
594showing everything that happens
595during that session.
4da134f8
EA
596.pp
597The
598.b qf
599file is structured as a series of lines
600each beginning with a code letter.
601The lines are as follows:
602.ip D
603The name of the data file.
604There may only be one of these lines.
605.ip H
606A header definition.
607There may be any number of these lines.
608The order is important:
609they represent the order in the final message.
610These use the same syntax
611as header definitions in the configuration file.
612.ip R
613A recipient address.
614This will normally be completely aliased,
615but is actually realiased when the job is processed.
616There will be one line
617for each recipient.
618.ip S
619The sender address.
620There may only be one of these lines.
4f24419a
EA
621.ip E
622An error address.
623If any such lines exist,
624they represent the addresses that should receive error messages.
4da134f8
EA
625.ip T
626The job creation time.
627This is used to compute when to time out the job.
4da134f8
EA
628.ip P
629The current message priority.
630This is used to order the queue.
631Higher numbers mean lower priorities.
367a5dcd 632The priority changes
4da134f8
EA
633as the message sits in the queue.
634The initial priority depends on the message class
635and the size of the message.
636.ip M
fa8fc495
EA
637A message.
638This line is printed by the
639.i mailq
640command,
641and is generally used to store status information.
642It can contain any text.
4da134f8
EA
643.pp
644As an example,
645the following is a queue file sent to
631e7688 646.q mckusick@calder
4da134f8
EA
647and
648.q wnj :
649.(b
650DdfA13557
651Seric
652T404261372
653P132
4da134f8
EA
654Rmckusick@calder
655Rwnj
656H?D?date: 23-Oct-82 15:49:32-PDT (Sat)
657H?F?from: eric (Eric Allman)
658H?x?full-name: Eric Allman
659Hsubject: this is an example message
18843c53
PL
660Hmessage-id: <8209232249.13557@UCBARPA.BERKELEY.EDU>
661Hreceived: by UCBARPA.BERKELEY.EDU (3.227 [10/22/82])
4da134f8 662 id A13557; 23-Oct-82 15:49:32-PDT (Sat)
74b6e641 663HTo: mckusick@calder, wnj
4da134f8
EA
664.)b
665This shows the name of the data file,
666the person who sent the message,
667the submission time
668(in seconds since January 1, 1970),
669the message priority,
670the message class,
631e7688 671the recipients,
4da134f8
EA
672and the headers for the message.
673.sh 3 "Forcing the queue"
674.pp
675.i Sendmail
676should run the queue automatically
677at intervals.
678The algorithm is to read and sort the queue,
679and then to attempt to process all jobs in order.
680When it attempts to run the job,
681.i sendmail
682first checks to see if the job is locked.
683If so, it ignores the job.
684.pp
685There is no attempt to insure that only one queue processor
686exists at any time,
687since there is no guarantee that a job cannot take forever
688to process.
689Due to the locking algorithm,
690it is impossible for one job to freeze the queue.
691However,
692an uncooperative recipient host
693or a program recipient
694that never returns
695can accumulate many processes in your system.
696Unfortunately,
697there is no way to resolve this
698without violating the protocol.
699.pp
700In some cases,
701you may find that a major host going down
702for a couple of days
703may create a prohibitively large queue.
704This will result in
705.i sendmail
706spending an inordinate amount of time
707sorting the queue.
708This situation can be fixed by moving the queue to a temporary place
709and creating a new queue.
710The old queue can be run later when the offending host returns to service.
711.pp
712To do this,
713it is acceptable to move the entire queue directory:
714.(b
715cd /usr/spool
18843c53 716mv mqueue omqueue; mkdir mqueue; chmod 755 mqueue
4da134f8
EA
717.)b
718You should then kill the existing daemon
719(since it will still be processing in the old queue directory)
720and create a new daemon.
721.pp
722To run the old mail queue,
723run the following command:
724.(b
2fb78b49 725/usr/lib/sendmail \-oQ/usr/spool/omqueue \-q
4da134f8
EA
726.)b
727The
2fb78b49 728.b \-oQ
4da134f8
EA
729flag specifies an alternate queue directory
730and the
731.b \-q
732flag says to just run every job in the queue.
733If you have a tendency toward voyeurism,
734you can use the
735.b \-v
736flag to watch what is going on.
737.pp
738When the queue is finally emptied,
739you can remove the directory:
740.(b
741rmdir /usr/spool/omqueue
742.)b
743.sh 2 "The Alias Database"
744.pp
745The alias database exists in two forms.
746One is a text form,
747maintained in the file
748.i /usr/lib/aliases.
749The aliases are of the form
750.(b
751name: name1, name2, ...
752.)b
753Only local names may be aliased;
754e.g.,
755.(b
367a5dcd 756eric@mit-xx: eric@berkeley.EDU
4da134f8
EA
757.)b
758will not have the desired effect.
759Aliases may be continued by starting any continuation lines
760with a space or a tab.
761Blank lines and lines beginning with a sharp sign
762(\c
763.q # )
764are comments.
765.pp
766The second form is processed by the
74b6e641 767.i dbm \|(3)
4da134f8
EA
768library.
769This form is in the files
770.i /usr/lib/aliases.dir
771and
772.i /usr/lib/aliases.pag.
773This is the form that
774.i sendmail
775actually uses to resolve aliases.
776This technique is used to improve performance.
777.sh 3 "Rebuilding the alias database"
778.pp
779The DBM version of the database
780may be rebuilt explicitly by executing the command
781.(b
74b6e641
EA
782newaliases
783.)b
784This is equivalent to giving
785.i sendmail
786the
787.b \-bi
788flag:
789.(b
b16e27c4 790/usr/lib/sendmail \-bi
4da134f8
EA
791.)b
792.pp
69a914e1
EA
793If the
794.q D
795option is specified in the configuration,
4da134f8 796.i sendmail
69a914e1
EA
797will rebuild the alias database automatically
798if possible
799when it is out of date.
4da134f8
EA
800The conditions under which it will do this are:
801.np
802The DBM version of the database is mode 666. -or-
803.np
804.i Sendmail
805is running setuid to root.
b16e27c4 806.lp
69a914e1
EA
807Auto-rebuild can be dangerous
808on heavily loaded machines
b16e27c4
EA
809with large alias files;
810if it might take more than five minutes
811to rebuild the database,
812there is a chance that several processes will start the rebuild process
813simultaneously.
69a914e1 814.sh 3 "Potential problems"
4da134f8
EA
815.pp
816There are a number of problems that can occur
817with the alias database.
818They all result from a
819.i sendmail
820process accessing the DBM version
821while it is only partially built.
822This can happen under two circumstances:
823One process accesses the database
824while another process is rebuilding it,
825or the process rebuilding the database dies
826(due to being killed or a system crash)
827before completing the rebuild.
828.pp
829Sendmail has two techniques to try to relieve these problems.
830First, it ignores interrupts while rebuilding the database;
831this avoids the problem of someone aborting the process
832leaving a partially rebuilt database.
833Second,
834at the end of the rebuild
835it adds an alias of the form
836.(b
837@: @
838.)b
839(which is not normally legal).
840Before sendmail will access the database,
69a914e1
EA
841it checks to insure that this entry exists\**.
842.(f
843\**The
844.q a
845option is required in the configuration
846for this action to occur.
847This should normally be specified
848unless you are running
849.i delivermail
850in parallel with
851.i sendmail.
852.)f
9b1ebb21
EA
853.i Sendmail
854will wait for this entry to appear,
631e7688
EA
855at which point it will force a rebuild itself\**.
856.(f
857\**Note:
858the
b16e27c4 859.q D
69a914e1 860option must be specified in the configuration file
631e7688 861for this operation to occur.
9b1ebb21
EA
862If the
863.q D
864option is not specified,
865a warning message is generated and
866.i sendmail
867continues.
631e7688
EA
868.)f
869.sh 3 "List owners"
870.pp
871If an error occurs on sending to a certain address,
872say
873.q \fIx\fP ,
874.i sendmail
875will look for an alias
876of the form
877.q owner-\fIx\fP
878to receive the errors.
879This is typically useful
880for a mailing list
881where the submitter of the list
28719ec2 882has no control over the maintenance of the list itself;
631e7688
EA
883in this case the list maintainer would be the owner of the list.
884For example:
885.(b
69a914e1
EA
886unix-wizards: eric@ucbarpa, wnj@monet, nosuchuser,
887 sam@matisse
631e7688
EA
888owner-unix-wizards: eric@ucbarpa
889.)b
890would cause
891.q eric@ucbarpa
892to get the error that will occur
893when someone sends to
894unix-wizards
895due to the inclusion of
896.q nosuchuser
897on the list.
2fb78b49 898.sh 2 "Per-User Forwarding (.forward Files)"
4da134f8 899.pp
2fb78b49
EA
900As an alternative to the alias database,
901any user may put a file with the name
902.q .forward
903in his or her home directory.
904If this file exists,
905.i sendmail
906redirects mail for that user
907to the list of addresses listed in the .forward file.
908For example, if the home directory for user
909.q mckusick
910has a .forward file with contents:
911.(b
912mckusick@ernie
913kirk@calder
914.)b
915then any mail arriving for
916.q mckusick
917will be redirected to the specified accounts.
918.sh 2 "Special Header Lines"
4da134f8 919.pp
2fb78b49
EA
920Several header lines have special interpretations
921defined by the configuration file.
922Others have interpretations built into
4da134f8 923.i sendmail
2fb78b49
EA
924that cannot be changed without changing the code.
925These builtins are described here.
bff69eb1 926.sh 3 "Return-Receipt-To:"
4da134f8 927.pp
2fb78b49
EA
928If this header is sent,
929a message will be sent to any specified addresses
318b7556
EA
930when the final delivery is complete,
931that is,
932when successfully delivered to a mailer with the
2fb78b49 933.b l
bff69eb1
EA
934flag (local delivery) set in the mailer descriptor.
935.sh 3 "Errors-To:"
4da134f8 936.pp
2fb78b49
EA
937If errors occur anywhere during processing,
938this header will cause error messages to go to
939the listed addresses
940rather than to the sender.
941This is intended for mailing lists.
bff69eb1 942.sh 3 "Apparently-To:"
4da134f8 943.pp
2fb78b49
EA
944If a message comes in with no recipients listed in the message
945(in a To:, Cc:, or Bcc: line)
946then
947.i sendmail
948will add an
949.q "Apparently-To:"
950header line for any recipients it is aware of.
951This is not put in as a standard recipient line
952to warn any recipients that the list is not complete.
4da134f8 953.pp
2fb78b49
EA
954At least one recipient line is required under RFC 822.
955.sh 1 "ARGUMENTS"
4da134f8 956.pp
2fb78b49
EA
957The complete list of arguments to
958.i sendmail
959is described in detail in Appendix A.
960Some important arguments are described here.
961.sh 2 "Queue Interval"
4da134f8 962.pp
2fb78b49
EA
963The amount of time between forking a process
964to run through the queue
965is defined by the
966.b \-q
967flag.
968If you run in mode
969.b f
970or
971.b a
972this can be relatively large,
973since it will only be relevant
974when a host that was down comes back up.
975If you run in
976.b q
977mode
978it should be relatively short,
979since it defines the maximum amount of time that a message
980may sit in the queue.
981.sh 2 "Daemon Mode"
4da134f8 982.pp
2fb78b49
EA
983If you allow incoming mail over an IPC connection,
984you should have a daemon running.
985This should be set by your
986.i /etc/rc
987file using the
988.b \-bd
989flag.
990The
991.b \-bd
992flag and the
993.b \-q
994flag may be combined in one call:
995.(b
bff69eb1 996/usr/lib/sendmail \-bd \-q30m
4da134f8 997.)b
2fb78b49 998.sh 2 "Forcing the Queue"
4da134f8 999.pp
2fb78b49
EA
1000In some cases you may find that the queue has gotten clogged for some reason.
1001You can force a queue run
1002using the
1003.b \-q
1004flag (with no value).
bff69eb1 1005It is entertaining to use the
2fb78b49
EA
1006.b \-v
1007flag (verbose)
1008when this is done to watch what happens:
1009.(b
1010/usr/lib/sendmail \-q \-v
4da134f8 1011.)b
2fb78b49
EA
1012.sh 2 "Debugging"
1013.pp
1014There are a fairly large number of debug flags
1015built into
1016.i sendmail .
1017Each debug flag has a number and a level,
1018where higher levels means to print out more information.
1019The convention is that levels greater than nine are
1020.q absurd,
1021i.e.,
1022they print out so much information that you wouldn't normally
1023want to see them except for debugging that particular piece of code.
1024Debug flags are set using the
1025.b \-d
1026option;
1027the syntax is:
4da134f8 1028.(b
2fb78b49
EA
1029.ta \w'debug-option 'u
1030debug-flag: \fB\-d\fP debug-list
1031debug-list: debug-option [ , debug-option ]
1032debug-option: debug-range [ . debug-level ]
1033debug-range: integer | integer \- integer
1034debug-level: integer
4da134f8 1035.)b
2fb78b49
EA
1036where spaces are for reading ease only.
1037For example,
4da134f8 1038.(b
2fb78b49
EA
1039\-d12 Set flag 12 to level 1
1040\-d12.3 Set flag 12 to level 3
1041\-d3-17 Set flags 3 through 17 to level 1
1042\-d3-17.4 Set flags 3 through 17 to level 4
4da134f8 1043.)b
2fb78b49
EA
1044For a complete list of the available debug flags
1045you will have to look at the code
1046(they are too dynamic to keep this documentation up to date).
1047.sh 2 "Trying a Different Configuration File"
4da134f8 1048.pp
2fb78b49
EA
1049An alternative configuration file
1050can be specified using the
1051.b \-C
1052flag; for example,
1053.(b
1054/usr/lib/sendmail \-Ctest.cf
4da134f8 1055.)b
2fb78b49
EA
1056uses the configuration file
1057.i test.cf
1058instead of the default
1059.i /usr/lib/sendmail.cf.
4da134f8 1060If the
2fb78b49
EA
1061.b \-C
1062flag has no value
1063it defaults to
1064.i sendmail.cf
1065in the current directory.
1066.sh 2 "Changing the Values of Options"
4da134f8 1067.pp
2fb78b49
EA
1068Options can be overridden using the
1069.b \-o
4da134f8 1070flag.
2fb78b49 1071For example,
4da134f8 1072.(b
2fb78b49 1073/usr/lib/sendmail \-oT2m
4da134f8 1074.)b
2fb78b49
EA
1075sets the
1076.b T
1077(timeout) option to two minutes
1078for this run only.
1079.sh 1 "TUNING"
1080.pp
1081There are a number of configuration parameters
1082you may want to change,
1083depending on the requirements of your site.
1084Most of these are set
1085using an option in the configuration file.
4da134f8 1086For example,
2fb78b49
EA
1087the line
1088.q OT3d
1089sets option
1090.q T
1091to the value
1092.q 3d
1093(three days).
1ef34914
EA
1094.pp
1095Most of these options default appropriately for most sites.
1096However,
1097sites having very high mail loads may find they need to tune them
1098as appropriate for their mail load.
1099In particular,
1100sites experiencing a large number of small messages,
1101many of which are delivered to many recipients,
1102may find that they need to adjust the parameters
1103dealing with queue priorities.
2fb78b49
EA
1104.sh 2 "Timeouts"
1105.pp
1106All time intervals are set
1107using a scaled syntax.
1108For example,
1109.q 10m
1110represents ten minutes, whereas
1111.q 2h30m
1112represents two and a half hours.
1113The full set of scales is:
4da134f8 1114.(b
2fb78b49
EA
1115.ta 4n
1116s seconds
1117m minutes
1118h hours
1119d days
1120w weeks
4da134f8 1121.)b
2fb78b49 1122.sh 3 "Queue interval"
4da134f8 1123.pp
2fb78b49
EA
1124The argument to the
1125.b \-q
1126flag
1127specifies how often a subdaemon will run the queue.
1ef34914
EA
1128This is typically set to between fifteen minutes
1129and one hour.
2fb78b49 1130.sh 3 "Read timeouts"
4da134f8 1131.pp
2fb78b49
EA
1132It is possible to time out when reading the standard input
1133or when reading from a remote SMTP server.
1134Technically,
1135this is not acceptable within the published protocols.
1136However,
1137it might be appropriate to set it to something large
1138in certain environments
1139(such as an hour).
1140This will reduce the chance of large numbers of idle daemons
1141piling up on your system.
1142This timeout is set using the
1143.b r
1144option in the configuration file.
1145.sh 3 "Message timeouts"
4da134f8 1146.pp
2fb78b49
EA
1147After sitting in the queue for a few days,
1148a message will time out.
1149This is to insure that at least the sender is aware
1150of the inability to send a message.
1151The timeout is typically set to three days.
1152This timeout is set using the
1153.b T
1154option in the configuration file.
1155.pp
1156The time of submission is set in the queue,
1157rather than the amount of time left until timeout.
1158As a result, you can flush messages that have been hanging
1159for a short period
1160by running the queue
1161with a short message timeout.
1162For example,
4da134f8 1163.(b
74b6e641 1164/usr/lib/sendmail \-oT1d \-q
4da134f8 1165.)b
2fb78b49
EA
1166will run the queue
1167and flush anything that is one day old.
1ef34914
EA
1168.sh 2 "Forking During Queue Runs"
1169.pp
1170By setting the
1171.b Y
1172option,
1173.i sendmail
1174will fork before each individual message
1175while running the queue.
1176This will prevent
1177.i sendmail
1178from consuming large amounts of memory,
1179so it may be useful in memory-poor environments.
1180However, if the
1181.b Y
1182option is not set,
1183.i sendmail
1184will keep track of hosts that are down during a queue run,
1185which can improve performance dramatically.
1186.sh 2 "Queue Priorities"
1187.pp
1188Every message is assigned a priority when it is first instantiated,
1189consisting of the message size (in bytes)
1190offset by the message class times the
1191.q "work class factor"
1192and the number of recipients times the
1193.q "work recipient factor."
1194The priority plus the creation time of the message
1195(in seconds since January 1, 1970)
1196are used to order the queue.
1197Higher numbers for the priority mean that the message will be processed later
1198when running the queue.
1199.pp
1200The message size is included so that large messages are penalized
1201relative to small messages.
1202The message class allows users to send
1203.q "high priority"
1204messages by including a
1205.q Precedence:
1206field in their message;
1207the value of this field is looked up in the
1208.b P
1209lines of the configuration file.
1210Since the number of recipients affects the amount of load a message presents
1211to the system,
1212this is also included into the priority.
1213.pp
1214The recipient and class factors
1215can be set in the configuration file using the
1216.b y
1217and
1218.b z
1219options respectively.
1220They default to 1000 (for the recipient factor)
1221and 1800
1222(for the class factor).
367a5dcd
EA
1223The initial priority is:
1224.(b
318b7556 1225pri = size \- (class * z) + (nrcpt * y)
367a5dcd
EA
1226.)b
1227(Remember, higher values for this parameter actually mean
1228that the job will be treated with lower priority.)
1ef34914
EA
1229.pp
1230The priority of a job can also be adjusted each time it is processed
1231(that is, each time an attempt is made to deliver it)
1232using the
1233.q "work time factor,"
1234set by the
1235.b Z
1236option.
1237This is added to the priority,
1238so it normally decreases the precedence of the job,
1239on the grounds that jobs that have failed many times
1240will tend to fail again in the future.
1241.sh 2 "Load Limiting"
1242.pp
1243.i Sendmail
1244can be asked to queue (but not deliver)
1245mail if the system load average gets too high
1246using the
1247.b x
1248option.
1249When the load average exceeds the value of the
1250.b x
1251option,
1252the delivery mode is set to
1253.b q
1254(queue only)
1255if the
1256.i "Queue Factor"
1257(\c
1258.b q
1259option)
1260divided by the difference in the current load average and the
1261.b x
1262option
1263plus one
1264exceeds the priority of the message \(em
1265that is, the message is queued iff:
1266.EQ
1267pri > QF over { LA - x + 1 }
1268.EN
1269The
1270.b q
1271option defaults to 10000,
1272so each point of load average is worth 10000
1273priority points
1274(as described above, that is, bytes + seconds + offsets).
1275.pp
1276For drastic cases,
1277the
1278.b X
1279option defines a load average at which sendmail will refuse
1280to accept network connections.
1281Locally generated mail
1282(including incoming UUCP mail)
1283is still accepted.
2fb78b49 1284.sh 2 "Delivery Mode"
4da134f8 1285.pp
2fb78b49 1286There are a number of delivery modes that
4da134f8 1287.i sendmail
2fb78b49
EA
1288can operate in,
1289set by the
1290.q d
1291configuration option.
1292These modes
1293specify how quickly mail will be delivered.
1294Legal modes are:
4da134f8 1295.(b
2fb78b49
EA
1296.ta 4n
1297i deliver interactively (synchronously)
1298b deliver in background (asynchronously)
1299q queue only (don't deliver)
4da134f8 1300.)b
2fb78b49
EA
1301There are tradeoffs.
1302Mode
1303.q i
1304passes the maximum amount of information to the sender,
1305but is hardly ever necessary.
1306Mode
1307.q q
1308puts the minimum load on your machine,
1309but means that delivery may be delayed for up to the queue interval.
1310Mode
1311.q b
1312is probably a good compromise.
74b6e641
EA
1313However, this mode can cause large numbers of processes
1314if you have a mailer that takes a long time to deliver a message.
2fb78b49 1315.sh 2 "Log Level"
4da134f8 1316.pp
2fb78b49
EA
1317The level of logging can be set for sendmail.
1318The default using a standard configuration table is level 9.
1319The levels are as follows:
1320.ip 0
1321No logging.
1322.ip 1
1323Major problems only.
1324.ip 2
1325Message collections and failed deliveries.
1326.ip 3
1327Successful deliveries.
1328.ip 4
28719ec2 1329Messages being deferred
2fb78b49
EA
1330(due to a host being down, etc.).
1331.ip 5
1332Normal message queueups.
1333.ip 6
1334Unusual but benign incidents,
1335e.g.,
1336trying to process a locked queue file.
ef1c322e
EA
1337.ip 9
1338Log internal queue id to external message id mappings.
1339This can be useful for tracing a message
1340as it travels between several hosts.
2fb78b49
EA
1341.ip 12
1342Several messages that are basically only of interest
1343when debugging.
1344.ip 16
1345Verbose information regarding the queue.
42581a7c
EA
1346.sh 2 "Wildcard MX Records"
1347.pp
1348Normally, when
1349.i sendmail
1350is looking up host names from the name server,
1351it uses the querytype of
daf6b53c
EA
1352.q CNAME .
1353The
1354.b w
1355option will ask the name server to use a querytype of
42581a7c
EA
1356.q ANY .
1357This finds CNAME, A, and MX records,
1358and causes the local name server to cache all records it finds,
1359thus improving performance.
1360.pp
1361However, if your site has wildcard MX records, this can cause problems.
1362For example, suppose your site has a record directing
1363.q "*.HiTech.COM"
1364to
1365.q "gateway.HiTech.COM" .
1366When the resolver looks for (e.g.)
1367.q "mammoth.Berkeley.EDU" ,
1368it starts by appending the local domain name (in this case,
1369.q "HiTech.COM" ),
1370thus looking for
1371.q "mammoth.Berkeley.EDU.HiTech.COM"
1372\*- which of course matches
1373.q "*.HiTech.COM" .
daf6b53c
EA
1374.pp
1375If you do not have wildcard MX records in your domain,
1376you can set the
42581a7c 1377.b w
daf6b53c 1378option to get better performance.
2fb78b49 1379.sh 2 "File Modes"
4da134f8 1380.pp
2fb78b49
EA
1381There are a number of files
1382that may have a number of modes.
1383The modes depend on what functionality you want
1384and the level of security you require.
1385.sh 3 "To suid or not to suid?"
4da134f8 1386.pp
2fb78b49
EA
1387.i Sendmail
1388can safely be made
1389setuid to root.
1390At the point where it is about to
74b6e641 1391.i exec \|(2)
2fb78b49
EA
1392a mailer,
1393it checks to see if the userid is zero;
1394if so,
1395it resets the userid and groupid to a default
1396(set by the
1397.b u
4da134f8 1398and
2fb78b49
EA
1399.b g
1400options).
1401(This can be overridden
1402by setting the
1403.b S
1404flag to the mailer
1405for mailers that are trusted
1406and must be called as root.)
1407However,
1408this will cause mail processing
1409to be accounted
1410(using
74b6e641 1411.i sa \|(8))
2fb78b49
EA
1412to root
1413rather than to the user sending the mail.
2fb78b49 1414.sh 3 "Should my alias database be writable?"
4da134f8 1415.pp
2fb78b49
EA
1416At Berkeley
1417we have the alias database
1418(/usr/lib/aliases*)
18843c53
PL
1419mode 644.
1420While this is not as flexible as if the database
1421were more 666, it avoids potential security problems
1422with a globally writable database.
4da134f8 1423.pp
2fb78b49
EA
1424The database that
1425.i sendmail
1426actually used
1427is represented by the two files
1428.i aliases.dir
4da134f8 1429and
2fb78b49
EA
1430.i aliases.pag
1431(both in /usr/lib).
1432The mode on these files should match the mode
1433on /usr/lib/aliases.
1434If
1435.i aliases
1436is writable
1437and the
1438DBM
1439files
4da134f8 1440(\c
2fb78b49
EA
1441.i aliases.dir
1442and
1443.i aliases.pag )
1444are not,
1445users will be unable to reflect their desired changes
1446through to the actual database.
1447However,
1448if
1449.i aliases
1450is read-only
1451and the DBM files are writable,
1452a slightly sophisticated user
1453can arrange to steal mail anyway.
4da134f8 1454.pp
2fb78b49
EA
1455If your DBM files are not writable by the world
1456or you do not have auto-rebuild enabled
1457(with the
1458.q D
1459option),
1460then you must be careful to reconstruct the alias database
1461each time you change the text version:
4da134f8 1462.(b
74b6e641 1463newaliases
4da134f8 1464.)b
2fb78b49
EA
1465If this step is ignored or forgotten
1466any intended changes will also be ignored or forgotten.
1467.sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
4da134f8 1468.pp
2fb78b49
EA
1469This section describes the configuration file
1470in detail,
1471including hints on how to write one of your own
1472if you have to.
4da134f8 1473.pp
2fb78b49
EA
1474There is one point that should be made clear immediately:
1475the syntax of the configuration file
1476is designed to be reasonably easy to parse,
1477since this is done every time
1478.i sendmail
1479starts up,
1480rather than easy for a human to read or write.
1481On the
1482.q "future project"
1483list is a
1484configuration-file compiler.
4da134f8 1485.pp
2fb78b49
EA
1486An overview of the configuration file
1487is given first,
1488followed by details of the semantics.
1489.sh 2 "The Syntax"
1490.pp
1491The configuration file is organized as a series of lines,
1492each of which begins with a single character
1493defining the semantics for the rest of the line.
1494Lines beginning with a space or a tab
1495are continuation lines
1496(although the semantics are not well defined in many places).
1497Blank lines and lines beginning with a sharp symbol
1498(`#')
1499are comments.
1500.sh 3 "R and S \*- rewriting rules"
1501.pp
1502The core of address parsing
1503are the rewriting rules.
1504These are an ordered production system.
1505.i Sendmail
1506scans through the set of rewriting rules
1507looking for a match on the left hand side
1508(LHS)
1509of the rule.
1510When a rule matches,
1511the address is replaced by the right hand side
1512(RHS)
1513of the rule.
1514.pp
1515There are several sets of rewriting rules.
1516Some of the rewriting sets are used internally
1517and must have specific semantics.
1518Other rewriting sets
1519do not have specifically assigned semantics,
1520and may be referenced by the mailer definitions
1521or by other rewriting sets.
1522.pp
1523The syntax of these two commands are:
1524.(b F
1525.b S \c
4da134f8 1526.i n
2fb78b49
EA
1527.)b
1528Sets the current ruleset being collected to
4da134f8 1529.i n .
2fb78b49
EA
1530If you begin a ruleset more than once
1531it deletes the old definition.
1532.(b F
1533.b R \c
1534.i lhs
1535.i rhs
1536.i comments
4da134f8 1537.)b
4da134f8 1538The
2fb78b49
EA
1539fields must be separated
1540by at least one tab character;
1541there may be embedded spaces
1542in the fields.
4da134f8 1543The
2fb78b49
EA
1544.i lhs
1545is a pattern that is applied to the input.
1546If it matches,
1547the input is rewritten to the
1548.i rhs .
1549The
1550.i comments
1551are ignored.
1552.sh 3 "D \*- define macro"
1553.pp
1554Macros are named with a single character.
1555These may be selected from the entire ASCII set,
1556but user-defined macros
1557should be selected from the set of upper case letters only.
1558Lower case letters
1559and special symbols
1560are used internally.
1561.pp
1562The syntax for macro definitions is:
1563.(b F
1564.b D \c
1565.i x\|val
1566.)b
1567where
1568.i x
1569is the name of the macro
4da134f8 1570and
2fb78b49
EA
1571.i val
1572is the value it should have.
1573Macros can be interpolated in most places using the escape sequence
1574.b $ \c
1575.i x .
1576.sh 3 "C and F \*- define classes"
1577.pp
1578Classes of words may be defined
18843c53
PL
1579to match on the left hand side of rewriting rules,
1580where a
1581.q word
1582is a sequence of characters that do not contain characters
1583in the $o macro.
2fb78b49
EA
1584For example
1585a class of all local names for this site
1586might be created
1587so that attempts to send to oneself
1588can be eliminated.
1589These can either be defined directly in the configuration file
1590or read in from another file.
1591Classes may be given names
1592from the set of upper case letters.
7a316267
EA
1593Lower case letters and special characters
1594are reserved for system use.
2fb78b49
EA
1595.pp
1596The syntax is:
1597.(b F
1598.b C \c
1599.i c\|word1
1600.i word2...
1601.br
1602.b F \c
1603.i c\|file
2fb78b49
EA
1604.)b
1605The first form defines the class
1606.i c
1607to match any of the named words.
1608It is permissible to split them among multiple lines;
1609for example, the two forms:
4da134f8 1610.(b
2fb78b49 1611CHmonet ucbmonet
4da134f8 1612.)b
2fb78b49
EA
1613and
1614.(b
1615CHmonet
1616CHucbmonet
1617.)b
1618are equivalent.
1619The second form
1620reads the elements of the class
1621.i c
1622from the named
318b7556 1623.i file .
2fb78b49 1624.sh 3 "M \*- define mailer"
4da134f8 1625.pp
2fb78b49
EA
1626Programs and interfaces to mailers
1627are defined in this line.
1628The format is:
1629.(b F
1630.b M \c
0a9ea158 1631.i name ,
74b6e641 1632{\c
0a9ea158 1633.i field =\c
74b6e641 1634.i value \|}*
4da134f8 1635.)b
2fb78b49
EA
1636where
1637.i name
1638is the name of the mailer
0a9ea158
EA
1639(used internally only)
1640and the
1641.q field=name
1642pairs define attributes of the mailer.
1643Fields are:
1644.(b
1645.ta 1i
1646Path The pathname of the mailer
1647Flags Special flags for this mailer
1648Sender A rewriting set for sender addresses
1649Recipient A rewriting set for recipient addresses
1650Argv An argument vector to pass to this mailer
1651Eol The end-of-line string for this mailer
7a316267 1652Maxsize The maximum message length to this mailer
0a9ea158
EA
1653.)b
1654Only the first character of the field name is checked.
2fb78b49 1655.sh 3 "H \*- define header"
4da134f8 1656.pp
2fb78b49
EA
1657The format of the header lines that sendmail inserts into the message
1658are defined by the
1659.b H
1660line.
1661The syntax of this line is:
1662.(b F
1663.b H [\c
1664.b ? \c
1665.i mflags \c
1666.b ? ]\c
1667.i hname \c
1668.b :
1669.i htemplate
1670.)b
1671Continuation lines in this spec
1672are reflected directly into the outgoing message.
4da134f8 1673The
2fb78b49
EA
1674.i htemplate
1675is macro expanded before insertion into the message.
1676If the
1677.i mflags
1678(surrounded by question marks)
1679are specified,
1680at least one of the specified flags
1681must be stated in the mailer definition
1682for this header to be automatically output.
1683If one of these headers is in the input
1684it is reflected to the output
1685regardless of these flags.
4da134f8 1686.pp
2fb78b49
EA
1687Some headers have special semantics
1688that will be described below.
1689.sh 3 "O \*- set option"
4da134f8 1690.pp
2fb78b49
EA
1691There are a number of
1692.q random
1693options that
1694can be set from a configuration file.
1695Options are represented by single characters.
1696The syntax of this line is:
1697.(b F
1698.b O \c
1699.i o\|value
1700.)b
1701This sets option
1702.i o
1703to be
1704.i value .
1705Depending on the option,
1706.i value
1707may be a string, an integer,
1708a boolean
1709(with legal values
1710.q t ,
1711.q T ,
1712.q f ,
1713or
1714.q F ;
1715the default is TRUE),
1716or
1717a time interval.
1718.sh 3 "T \*- define trusted users"
4da134f8 1719.pp
2fb78b49
EA
1720Trusted users
1721are those users who are permitted
1722to override the sender address
1723using the
1724.b \-f
1725flag.
1726These typically are
1727.q root,
1728.q uucp,
1729and
1730.q network,
1731but on some users it may be convenient
1732to extend this list to include other users,
1733perhaps to support
1734a separate
1735UUCP
1736login for each host.
1737The syntax of this line is:
1738.(b F
1739.b T \c
1740.i user1
1741.i user2 ...
1742.)b
1743There may be more than one of these lines.
1744.sh 3 "P \*- precedence definitions"
4da134f8 1745.pp
2fb78b49
EA
1746Values for the
1747.q "Precedence:"
1748field may be defined using the
1749.b P
1750control line.
1751The syntax of this field is:
1752.(b
1753\fBP\fP\fIname\fP\fB=\fP\fInum\fP
1754.)b
1755When the
1756.i name
1757is found in a
1758.q Precedence:
1759field,
1760the message class is set to
1761.i num .
1762Higher numbers mean higher precedence.
1763Numbers less than zero
1764have the special property
1765that error messages will not be returned.
1766The default precedence is zero.
4da134f8 1767For example,
2fb78b49
EA
1768our list of precedences is:
1769.(b
1770Pfirst-class=0
1771Pspecial-delivery=100
74b6e641 1772Pjunk=\-100
2fb78b49
EA
1773.)b
1774.sh 2 "The Semantics"
4da134f8 1775.pp
2fb78b49
EA
1776This section describes the semantics of the configuration file.
1777.sh 3 "Special macros, conditionals"
4da134f8 1778.pp
2fb78b49
EA
1779Macros are interpolated
1780using the construct
1781.b $ \c
1782.i x ,
1783where
1784.i x
1785is the name of the macro to be interpolated.
1786In particular,
1787lower case letters are reserved to have
1788special semantics,
1789used to pass information in or out of sendmail,
1790and some special characters are reserved to
1791provide conditionals, etc.
4da134f8 1792.pp
367a5dcd
EA
1793Conditionals can be specified using the syntax:
1794.(b
1795$?x text1 $| text2 $.
1796.)b
1797This interpolates
1798.i text1
1799if the macro
1800.b $x
1801is set,
1802and
1803.i text2
1804otherwise.
1805The
1806.q else
1807(\c
1808.b $| )
1809clause may be omitted.
1810.pp
2fb78b49
EA
1811The following macros
1812.i must
1813be defined to transmit information into
1814.i sendmail:
1815.(b
1816.ta 4n
1b165f11 1817e The SMTP entry message
2fb78b49
EA
1818j The \*(lqofficial\*(rq domain name for this site
1819l The format of the UNIX from line
1820n The name of the daemon (for error messages)
1821o The set of "operators" in addresses
1822q default format of sender address
1823.)b
1824The
1b165f11
EA
1825.b $e
1826macro is printed out when SMTP starts up.
1827The first word must be the
1828.b $j
1829macro.
1830The
2fb78b49
EA
1831.b $j
1832macro
1833should be in RFC821 format.
1834The
1835.b $l
1836and
1837.b $n
1838macros can be considered constants
1839except under terribly unusual circumstances.
1840The
1841.b $o
1842macro consists of a list of characters
1843which will be considered tokens
1844and which will separate tokens
1845when doing parsing.
1846For example, if
367a5dcd 1847.q @
2fb78b49
EA
1848were in the
1849.b $o
1850macro, then the input
367a5dcd 1851.q a@b
2fb78b49 1852would be scanned as three tokens:
367a5dcd
EA
1853.q a,
1854.q @,
4da134f8 1855and
367a5dcd 1856.q b.
2fb78b49
EA
1857Finally, the
1858.b $q
1859macro specifies how an address should appear in a message
1860when it is defaulted.
1861For example, on our system these definitions are:
1862.(b
1b165f11 1863De$j Sendmail $v ready at $b
2fb78b49
EA
1864DnMAILER-DAEMON
1865DlFrom $g $d
1866Do.:%@!^=/
1867Dq$g$?x ($x)$.
1868Dj$H.$D
1869.)b
1870An acceptable alternative for the
1871.b $q
1872macro is
1873.q "$?x$x $.<$g>" .
1874These correspond to the following two formats:
1875.(b
1876eric@Berkeley (Eric Allman)
1877Eric Allman <eric@Berkeley>
1878.)b
4da134f8 1879.pp
2fb78b49
EA
1880Some macros are defined by
1881.i sendmail
1882for interpolation into argv's for mailers
1883or for other contexts.
1884These macros are:
4da134f8 1885.(b
18843c53
PL
1886a The origination date in RFC 822 format
1887b The current date in RFC 822 format
2fb78b49
EA
1888c The hop count
1889d The date in UNIX (ctime) format
1890f The sender (from) address
1891g The sender address relative to the recipient
1892h The recipient host
1893i The queue id
1894p Sendmail's pid
1895r Protocol used
1896s Sender's host name
1897t A numeric representation of the current time
1898u The recipient user
1899v The version number of sendmail
b01d261b 1900w The hostname of this site
2fb78b49 1901x The full name of the sender
2fb78b49 1902z The home directory of the recipient
4da134f8 1903.)b
4da134f8 1904.pp
2fb78b49
EA
1905There are three types of dates that can be used.
1906The
1907.b $a
4da134f8 1908and
2fb78b49 1909.b $b
18843c53 1910macros are in RFC 822 format;
2fb78b49
EA
1911.b $a
1912is the time as extracted from the
1913.q Date:
1914line of the message
1915(if there was one),
1916and
1917.b $b
1918is the current date and time
1919(used for postmarks).
1920If no
1921.q Date:
1922line is found in the incoming message,
1923.b $a
1924is set to the current time also.
1925The
1926.b $d
1927macro is equivalent to the
1928.b $a
1929macro in UNIX
1930(ctime)
1931format.
4da134f8 1932.pp
2fb78b49
EA
1933The
1934.b $f
1935macro is the id of the sender
1936as originally determined;
1937when mailing to a specific host
1938the
1939.b $g
1940macro is set to the address of the sender
1941.ul
1942relative to the recipient.
1943For example,
1944if I send to
1945.q bollard@matisse
1946from the machine
1947.q ucbarpa
1948the
1949.b $f
1950macro will be
1951.q eric
1952and the
1953.b $g
1954macro will be
1955.q eric@ucbarpa.
4da134f8 1956.pp
2fb78b49
EA
1957The
1958.b $x
1959macro is set to the full name of the sender.
1960This can be determined in several ways.
1961It can be passed as flag to
1962.i sendmail.
1963The second choice is the value of the
1964.q Full-name:
1965line in the header if it exists,
1966and the third choice is the comment field
1967of a
1968.q From:
1969line.
1970If all of these fail,
1971and if the message is being originated locally,
1972the full name is looked up in the
1973.i /etc/passwd
1974file.
4da134f8 1975.pp
2fb78b49
EA
1976When sending,
1977the
1978.b $h ,
1979.b $u ,
1980and
1981.b $z
1982macros get set to the host, user, and home directory
1983(if local)
1984of the recipient.
1985The first two are set from the
1986.b $@
1987and
1988.b $:
1989part of the rewriting rules, respectively.
1990.pp
1991The
1992.b $p
1993and
1994.b $t
1995macros are used to create unique strings
1996(e.g., for the
1997.q Message-Id:
1998field).
1999The
2000.b $i
2001macro is set to the queue id on this host;
2002if put into the timestamp line
2003it can be extremely useful for tracking messages.
2004The
2fb78b49
EA
2005.b $v
2006macro is set to be the version number of
2007.i sendmail ;
2008this is normally put in timestamps
2009and has been proven extremely useful for debugging.
2010The
b01d261b
EA
2011.b $w
2012macro is set to the name of this host
2013if it can be determined.
2014The
2fb78b49
EA
2015.b $c
2016field is set to the
2017.q "hop count,"
2018i.e., the number of times this message has been processed.
2019This can be determined
2020by the
2021.b \-h
2022flag on the command line
2023or by counting the timestamps in the message.
4da134f8 2024.pp
2fb78b49
EA
2025The
2026.b $r
2027and
2028.b $s
2029fields are set to the protocol used to communicate with sendmail
2030and the sending hostname;
2031these are not supported in the current version.
7a316267
EA
2032.sh 3 "Special classes"
2033.pp
2034The class
2035.b $=w
2036is set to be the set of all names
2037this host is known by.
18843c53 2038This can be used to match local hostnames.
2fb78b49
EA
2039.sh 3 "The left hand side"
2040.pp
2041The left hand side of rewriting rules contains a pattern.
2042Normal words are simply matched directly.
2043Metasyntax is introduced using a dollar sign.
2044The metasymbols are:
4da134f8 2045.(b
74b6e641 2046.ta \w'\fB$=\fP\fIx\fP 'u
2fb78b49
EA
2047\fB$*\fP Match zero or more tokens
2048\fB$+\fP Match one or more tokens
74b6e641 2049\fB$\-\fP Match exactly one token
2fb78b49 2050\fB$=\fP\fIx\fP Match any token in class \fIx\fP
6ca09d34 2051\fB$~\fP\fIx\fP Match any token not in class \fIx\fP
4da134f8 2052.)b
2fb78b49
EA
2053If any of these match,
2054they are assigned to the symbol
2055.b $ \c
2056.i n
2057for replacement on the right hand side,
4da134f8 2058where
2fb78b49
EA
2059.i n
2060is the index in the LHS.
2061For example,
2062if the LHS:
631e7688 2063.(b
74b6e641 2064$\-:$+
631e7688 2065.)b
2fb78b49 2066is applied to the input:
4da134f8 2067.(b
2fb78b49 2068UCBARPA:eric
4da134f8 2069.)b
2fb78b49
EA
2070the rule will match, and the values passed to the RHS will be:
2071.(b
2072.ta 4n
2073$1 UCBARPA
2074$2 eric
2075.)b
2076.sh 3 "The right hand side"
631e7688 2077.pp
9b1ebb21 2078When the left hand side of a rewriting rule matches,
2fb78b49
EA
2079the input is deleted and replaced by the right hand side.
2080Tokens are copied directly from the RHS
367a5dcd 2081unless they begin with a dollar sign.
2fb78b49
EA
2082Metasymbols are:
2083.(b
2084.ta \w'$#mailer 'u
2085\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
9b1ebb21 2086\fB$[\fP\fIname\fP\fB$]\fP Canonicalize \fIname\fP
2fb78b49
EA
2087\fB$>\fP\fIn\fP \*(lqCall\*(rq ruleset \fIn\fP
2088\fB$#\fP\fImailer\fP Resolve to \fImailer\fP
2089\fB$@\fP\fIhost\fP Specify \fIhost\fP
2090\fB$:\fP\fIuser\fP Specify \fIuser\fP
2091.)b
631e7688 2092.pp
2fb78b49
EA
2093The
2094.b $ \c
2095.i n
2096syntax substitutes the corresponding value from a
2097.b $+ ,
74b6e641 2098.b $\- ,
2fb78b49 2099.b $* ,
6ca09d34 2100.b $= ,
631e7688 2101or
6ca09d34 2102.b $~
2fb78b49
EA
2103match on the LHS.
2104It may be used anywhere.
2105.pp
9b1ebb21
EA
2106A host name enclosed between
2107.b $[
2108and
2109.b $]
28719ec2
JB
2110is looked up using the
2111.i gethostent \|(3)
2112routines and replaced by the canonical name.
9b1ebb21
EA
2113For example,
2114.q $[csam$]
18843c53 2115might become
367a5dcd
EA
2116.q lbl-csam.arpa
2117and
2118.q $[[128.32.130.2]$]
2119would become
2120.q vangogh.berkeley.edu.
9b1ebb21 2121.pp
631e7688 2122The
2fb78b49
EA
2123.b $> \c
2124.i n
2125syntax
2126causes the remainder of the line to be substituted as usual
2127and then passed as the argument to ruleset
2128.i n .
2129The final value of ruleset
2130.i n
2131then becomes
2132the substitution for this rule.
631e7688 2133.pp
2fb78b49
EA
2134The
2135.b $#
2136syntax should
2137.i only
2138be used in ruleset zero.
2139It causes evaluation of the ruleset to terminate immediately,
2140and signals to sendmail that the address has completely resolved.
2141The complete syntax is:
631e7688 2142.(b
2fb78b49 2143\fB$#\fP\fImailer\fP\fB$@\fP\fIhost\fP\fB$:\fP\fIuser\fP
631e7688 2144.)b
2fb78b49
EA
2145This specifies the
2146{mailer, host, user}
21473-tuple necessary to direct the mailer.
2148If the mailer is local
2149the host part may be omitted.
2150The
2151.i mailer
2152and
2153.i host
2154must be a single word,
2155but the
2156.i user
2157may be multi-part.
2158.pp
28719ec2 2159A RHS may also be preceded by a
2fb78b49
EA
2160.b $@
2161or a
2162.b $:
2163to control evaluation.
2164A
2165.b $@
2166prefix causes the ruleset to return with the remainder of the RHS
2167as the value.
2168A
2169.b $:
2170prefix causes the rule to terminate immediately,
2171but the ruleset to continue;
2172this can be used to avoid continued application of a rule.
2173The prefix is stripped before continuing.
2174.pp
2175The
2176.b $@
2177and
2178.b $:
28719ec2 2179prefixes may precede a
2fb78b49
EA
2180.b $>
2181spec;
2182for example:
631e7688 2183.(b
2fb78b49
EA
2184.ta 8n
2185R$+ $:$>7$1
631e7688 2186.)b
2fb78b49
EA
2187matches anything,
2188passes that to ruleset seven,
2189and continues;
631e7688 2190the
2fb78b49
EA
2191.b $:
2192is necessary to avoid an infinite loop.
9b1ebb21
EA
2193.pp
2194Substitution occurs in the order described,
2195that is,
2196parameters from the LHS are substituted,
2197hostnames are canonicalized,
2198.q subroutines
2199are called,
2200and finally
2201.b $# ,
2202.b $@ ,
2203and
2204.b $:
2205are processed.
2fb78b49 2206.sh 3 "Semantics of rewriting rule sets"
631e7688 2207.pp
2fb78b49
EA
2208There are five rewriting sets
2209that have specific semantics.
2210These are related as depicted by figure 2.
2211.(z
2212.hl
8ca4ce88 2213.ie n \{\
3702dbcc 2214.(c
2fb78b49
EA
2215 +---+
2216 -->| 0 |-->resolved address
2217 / +---+
2218 / +---+ +---+
2219 / ---->| 1 |-->| S |--
2220 +---+ / +---+ / +---+ +---+ \e +---+
2221addr-->| 3 |-->| D |-- --->| 4 |-->msg
2222 +---+ +---+ \e +---+ +---+ / +---+
2223 --->| 2 |-->| R |--
2224 +---+ +---+
2225.)c
2226
8ca4ce88
EA
2227.\}
2228.el .ie !"\*(.T"" \
2229\{\
2230.PS
2231boxwid = 0.3i
2232boxht = 0.3i
2233movewid = 0.3i
2234moveht = 0.3i
2235linewid = 0.3i
2236lineht = 0.3i
2237
2238 box invis "addr"; arrow
2239Box3: box "3"
2240A1: arrow
2241BoxD: box "D"; line; L1: Here
2242C: [
2243 C1: arrow; box "1"; arrow; box "S"; line; E1: Here
2244 move to C1 down 0.5; right
2245 C2: arrow; box "2"; arrow; box "R"; line; E2: Here
2246 ] with .w at L1 + (0.5, 0)
2247 move to C.e right 0.5
2248L4: arrow; box "4"; arrow; box invis "msg"
2249 line from L1 to C.C1
2250 line from L1 to C.C2
2251 line from C.E1 to L4
2252 line from C.E2 to L4
2253 move to BoxD.n up 0.6; right
2254Box0: arrow; box "0"
2255 arrow; box invis "resolved address" width 1.3
2256 line from 1/3 of the way between A1 and BoxD.w to Box0
2257.PE
2258.\}
2259.el .sp 2i
2fb78b49
EA
2260.ce
2261Figure 2 \*- Rewriting set semantics
2262.(c
2263D \*- sender domain addition
2264S \*- mailer-specific sender rewriting
2265R \*- mailer-specific recipient rewriting
2266.)c
2fb78b49
EA
2267.hl
2268.)z
631e7688 2269.pp
2fb78b49
EA
2270Ruleset three
2271should turn the address into
2272.q "canonical form."
2273This form should have the basic syntax:
631e7688 2274.(b
2fb78b49 2275local-part@host-domain-spec
631e7688 2276.)b
2fb78b49
EA
2277If no
2278.q @
2279sign is specified,
2280then the
2281host-domain-spec
2282.i may
2283be appended from the
2284sender address
2285(if the
2286.b C
2287flag is set in the mailer definition
2288corresponding to the
2289.i sending
2290mailer).
2291Ruleset three
2292is applied by sendmail
2293before doing anything with any address.
2294.pp
2295Ruleset zero
2296is applied after ruleset three
2297to addresses that are going to actually specify recipients.
2298It must resolve to a
2299.i "{mailer, host, user}"
2300triple.
2301The
2302.i mailer
2303must be defined in the mailer definitions
2304from the configuration file.
2305The
2306.i host
2307is defined into the
2308.b $h
2309macro
2310for use in the argv expansion of the specified mailer.
2311.pp
2312Rulesets one and two
2313are applied to all sender and recipient addresses respectively.
2314They are applied before any specification
2315in the mailer definition.
2316They must never resolve.
2317.pp
2318Ruleset four is applied to all addresses
2319in the message.
2320It is typically used
2321to translate internal to external form.
2322.sh 3 "Mailer flags etc."
2323.pp
7a316267
EA
2324There are a number of flags that may be associated with each mailer,
2325each identified by a letter of the alphabet.
2326Many of them are assigned semantics internally.
2fb78b49 2327These are detailed in Appendix C.
7a316267
EA
2328Any other flags may be used freely
2329to conditionally assign headers to messages
2330destined for particular mailers.
b66b7f9a
EA
2331.sh 3 "The \*(lqerror\*(rq mailer"
2332.pp
2333The mailer with the special name
2334.q error
2335can be used to generate a user error.
2336The (optional) host field is a numeric exit status to be returned,
2337and the user field is a message to be printed.
2338For example, the entry:
2339.(b
2340$#error$:Host unknown in this domain
2341.)b
2342on the RHS of a rule
2343will cause the specified error to be generated
2344if the LHS matches.
2345This mailer is only functional in ruleset zero.
2fb78b49
EA
2346.sh 2 "Building a Configuration File From Scratch"
2347.pp
2348Building a configuration table from scratch is an extremely difficult job.
2349Fortunately,
2350it is almost never necessary to do so;
2351nearly every situation that may come up
2352may be resolved by changing an existing table.
2353In any case,
2354it is critical that you understand what it is that you are trying to do
2355and come up with a philosophy for the configuration table.
2356This section is intended to explain what the real purpose
2357of a configuration table is
2358and to give you some ideas
2359for what your philosophy might be.
2360.sh 3 "What you are trying to do"
2361.pp
2362The configuration table has three major purposes.
2363The first and simplest
2364is to set up the environment for
2365.i sendmail .
2366This involves setting the options,
2367defining a few critical macros,
2368etc.
2369Since these are described in other places,
2370we will not go into more detail here.
631e7688 2371.pp
2fb78b49
EA
2372The second purpose is to rewrite addresses in the message.
2373This should typically be done in two phases.
2374The first phase maps addresses in any format
2375into a canonical form.
2376This should be done in ruleset three.
2377The second phase maps this canonical form
2378into the syntax appropriate for the receiving mailer.
2379.i Sendmail
2380does this in three subphases.
2381Rulesets one and two
2382are applied to all sender and recipient addresses respectively.
2383After this,
2384you may specify per-mailer rulesets
2385for both sender and recipient addresses;
2386this allows mailer-specific customization.
631e7688 2387Finally,
2fb78b49
EA
2388ruleset four is applied to do any default conversion
2389to external form.
631e7688 2390.pp
2fb78b49
EA
2391The third purpose
2392is to map addresses into the actual set of instructions
2393necessary to get the message delivered.
2394Ruleset zero must resolve to the internal form,
2395which is in turn used as a pointer to a mailer descriptor.
2396The mailer descriptor describes the interface requirements
2397of the mailer.
2398.sh 3 "Philosophy"
4da134f8 2399.pp
2fb78b49
EA
2400The particular philosophy you choose will depend heavily
2401on the size and structure of your organization.
2402I will present a few possible philosophies here.
4da134f8 2403.pp
2fb78b49
EA
2404One general point applies to all of these philosophies:
2405it is almost always a mistake
2406to try to do full name resolution.
4da134f8 2407For example,
2fb78b49
EA
2408if you are trying to get names of the form
2409.q user@host
2410to the Arpanet,
2411it does not pay to route them to
2412.q xyzvax!decvax!ucbvax!c70:user@host
2413since you then depend on several links not under your control.
2414The best approach to this problem
2415is to simply forward to
2416.q xyzvax!user@host
2417and let xyzvax
2418worry about it from there.
2419In summary,
2420just get the message closer to the destination,
2421rather than determining the full path.
2422.sh 4 "Large site, many hosts \*- minimum information"
4da134f8 2423.pp
2fb78b49 2424Berkeley is an example of a large site,
28719ec2
JB
2425i.e., more than two or three hosts
2426and multiple mail connections.
2fb78b49
EA
2427We have decided that the only reasonable philosophy
2428in our environment
2429is to designate one host as the guru for our site.
2430It must be able to resolve any piece of mail it receives.
2431The other sites should have the minimum amount of information
2432they can get away with.
2433In addition,
2434any information they do have
2435should be hints rather than solid information.
4da134f8 2436.pp
2fb78b49
EA
2437For example,
2438a typical site on our local ether network is
2439.q monet.
28719ec2 2440When monet receives mail for delivery,
318b7556
EA
2441it checks whether it knows
2442that the destination host is directly reachable;
28719ec2 2443if so, mail is sent to that host.
2fb78b49
EA
2444If it receives mail for any unknown host,
2445it just passes it directly to
2446.q ucbvax,
2447our master host.
2448Ucbvax may determine that the host name is illegal
2449and reject the message,
2450or may be able to do delivery.
28719ec2 2451However, it is important to note that when a new mail connection is added,
2fb78b49
EA
2452the only host that
2453.i must
2454have its tables updated
2455is ucbvax;
2456the others
2457.i may
28719ec2 2458be updated if convenient,
2fb78b49
EA
2459but this is not critical.
2460.pp
2461This picture is slightly muddied
2462due to network connections that are not actually located
2463on ucbvax.
2464For example,
28719ec2 2465some UUCP connections are currently on
2fb78b49 2466.q ucbarpa.
4da134f8 2467However,
2fb78b49
EA
2468monet
2469.i "does not"
2470know about this;
2471the information is hidden totally between ucbvax and ucbarpa.
28719ec2
JB
2472Mail going from monet to a UUCP host
2473is transferred via the ethernet
2fb78b49
EA
2474from monet to ucbvax,
2475then via the ethernet from ucbvax to ucbarpa,
28719ec2 2476and then is submitted to UUCP.
2fb78b49
EA
2477Although this involves some extra hops,
2478we feel this is an acceptable tradeoff.
4da134f8 2479.pp
2fb78b49
EA
2480An interesting point is that it would be possible
2481to update monet
28719ec2 2482to send appropriate UUCP mail directly to ucbarpa
2fb78b49 2483if the load got too high;
28719ec2 2484if monet failed to note a host as connected to ucbarpa
2fb78b49
EA
2485it would go via ucbvax as before,
2486and if monet incorrectly sent a message to ucbarpa
2487it would still be sent by ucbarpa
2488to ucbvax as before.
2489The only problem that can occur is loops,
318b7556
EA
2490for example,
2491if ucbarpa thought that ucbvax had the UUCP connection
2fb78b49
EA
2492and vice versa.
2493For this reason,
2494updates should
2495.i always
2496happen to the master host first.
4da134f8 2497.pp
2fb78b49
EA
2498This philosophy results as much from the need
2499to have a single source for the configuration files
2500(typically built using
74b6e641 2501.i m4 \|(1)
2fb78b49
EA
2502or some similar tool)
2503as any logical need.
2504Maintaining more than three separate tables by hand
2505is essentially an impossible job.
2506.sh 4 "Small site \*- complete information"
2507.pp
2508A small site
28719ec2 2509(two or three hosts and few external connections)
2fb78b49
EA
2510may find it more reasonable to have complete information
2511at each host.
2512This would require that each host
2513know exactly where each network connection is,
2514possibly including the names of each host on that network.
2515As long as the site remains small
2516and the the configuration remains relatively static,
2517the update problem will probably not be too great.
2518.sh 4 "Single host"
2519.pp
2520This is in some sense the trivial case.
2521The only major issue is trying to insure that you don't
2522have to know too much about your environment.
69a914e1 2523For example,
2fb78b49
EA
2524if you have a UUCP connection
2525you might find it useful to know about the names of hosts
2526connected directly to you,
2527but this is really not necessary
2528since this may be determined from the syntax.
2529.sh 3 "Relevant issues"
4da134f8 2530.pp
2fb78b49
EA
2531The canonical form you use
2532should almost certainly be as specified in
2533the Arpanet protocols
2534RFC819 and RFC822.
2535Copies of these RFC's are included on the
4da134f8 2536.i sendmail
2fb78b49
EA
2537tape
2538as
2539.i doc/rfc819.lpr
2540and
2541.i doc/rfc822.lpr .
2542.pp
2543RFC822
2544describes the format of the mail message itself.
2545.i Sendmail
2546follows this RFC closely,
2547to the extent that many of the standards described in this document
2548can not be changed without changing the code.
2549In particular,
2550the following characters have special interpretations:
4da134f8 2551.(b
2fb78b49 2552< > ( ) " \e
4da134f8 2553.)b
2fb78b49
EA
2554Any attempt to use these characters for other than their RFC822
2555purpose in addresses is probably doomed to disaster.
2556.pp
2557RFC819
2558describes the specifics of the domain-based addressing.
2559This is touched on in RFC822 as well.
2560Essentially each host is given a name
2561which is a right-to-left dot qualified pseudo-path
2562from a distinguished root.
2563The elements of the path need not be physical hosts;
2564the domain is logical rather than physical.
2565For example,
2566at Berkeley
28719ec2 2567one legal host might be
367a5dcd 2568.q a.CC.Berkeley.EDU ;
2fb78b49 2569reading from right to left,
367a5dcd 2570.q EDU
2fb78b49 2571is a top level domain
367a5dcd
EA
2572comprising educational institutions,
2573.q Berkeley
2574is a logical domain name,
2575.q CC
2fb78b49
EA
2576represents the Computer Center,
2577(in this case a strictly logical entity),
2578and
2579.q a
367a5dcd 2580is a host in the Computer Center.
4da134f8 2581.pp
2fb78b49
EA
2582Beware when reading RFC819
2583that there are a number of errors in it.
2584.sh 3 "How to proceed"
4da134f8 2585.pp
2fb78b49
EA
2586Once you have decided on a philosophy,
2587it is worth examining the available configuration tables
2588to decide if any of them are close enough
2589to steal major parts of.
2590Even under the worst of conditions,
2591there is a fair amount of boiler plate that can be collected safely.
4da134f8 2592.pp
2fb78b49
EA
2593The next step is to build ruleset three.
2594This will be the hardest part of the job.
2595Beware of doing too much to the address in this ruleset,
2596since anything you do will reflect through
2597to the message.
2598In particular,
2599stripping of local domains is best deferred,
2600since this can leave you with addresses with no domain spec at all.
2601Since
2602.i sendmail
2603likes to append the sending domain to addresses with no domain,
2604this can change the semantics of addresses.
2605Also try to avoid
2606fully qualifying domains in this ruleset.
2607Although technically legal,
2608this can lead to unpleasantly and unnecessarily long addresses
2609reflected into messages.
2610The Berkeley configuration files
2611define ruleset nine
2612to qualify domain names and strip local domains.
2613This is called from ruleset zero
2614to get all addresses into a cleaner form.
4da134f8 2615.pp
2fb78b49
EA
2616Once you have ruleset three finished,
2617the other rulesets should be relatively trivial.
2618If you need hints,
2619examine the supplied configuration tables.
2620.sh 3 "Testing the rewriting rules \*- the \-bt flag"
4da134f8 2621.pp
2fb78b49
EA
2622When you build a configuration table,
2623you can do a certain amount of testing
2624using the
2625.q "test mode"
2626of
2627.i sendmail .
2628For example,
2629you could invoke
4da134f8 2630.i sendmail
2fb78b49
EA
2631as:
2632.(b
2633sendmail \-bt \-Ctest.cf
2634.)b
2635which would read the configuration file
2636.q test.cf
2637and enter test mode.
2638In this mode,
2639you enter lines of the form:
2640.(b
2641rwset address
2642.)b
2643where
2644.i rwset
2645is the rewriting set you want to use
4da134f8 2646and
2fb78b49
EA
2647.i address
2648is an address to apply the set to.
2649Test mode shows you the steps it takes
2650as it proceeds,
2651finally showing you the address it ends up with.
2652You may use a comma separated list of rwsets
2653for sequential application of rules to an input;
2654ruleset three is always applied first.
2655For example:
2656.(b
26571,21,4 monet:bollard
2658.)b
2659first applies ruleset three to the input
2660.q monet:bollard.
2661Ruleset one is then applied to the output of ruleset three,
2662followed similarly by rulesets twenty-one and four.
4da134f8 2663.pp
2fb78b49
EA
2664If you need more detail,
2665you can also use the
2666.q \-d21
2667flag to turn on more debugging.
2668For example,
4da134f8 2669.(b
2fb78b49 2670sendmail \-bt \-d21.99
4da134f8 2671.)b
2fb78b49
EA
2672turns on an incredible amount of information;
2673a single word address
2674is probably going to print out several pages worth of information.
2675.sh 3 "Building mailer descriptions"
4da134f8 2676.pp
2fb78b49
EA
2677To add an outgoing mailer to your mail system,
2678you will have to define the characteristics of the mailer.
2679.pp
0a9ea158
EA
2680Each mailer must have an internal name.
2681This can be arbitrary,
2682except that the names
2683.q local
2684and
2685.q prog
2686must be defined.
2fb78b49 2687.pp
0a9ea158 2688The pathname of the mailer must be given in the P field.
2fb78b49
EA
2689If this mailer should be accessed via an IPC connection,
2690use the string
2691.q [IPC]
2692instead.
2693.pp
0a9ea158 2694The F field defines the mailer flags.
2fb78b49
EA
2695You should specify an
2696.q f
2697or
2698.q r
2699flag to pass the name of the sender as a
2700.b \-f
2701or
2702.b \-r
2703flag respectively.
2704These flags are only passed if they were passed to
2705.i sendmail,
2706so that mailers that give errors under some circumstances
2707can be placated.
2708If the mailer is not picky
2709you can just specify
2710.q "\-f $g"
2711in the argv template.
2712If the mailer must be called as
2713.b root
2714the
2715.q S
2716flag should be given;
2717this will not reset the userid
2718before calling the mailer\**.
2719.(f
2720\**\c
2721.i Sendmail
2722must be running setuid to root
2723for this to work.
2724.)f
2725If this mailer is local
2726(i.e., will perform final delivery
2727rather than another network hop)
2728the
2729.q l
2730flag should be given.
2731Quote characters
2732(backslashes and " marks)
2733can be stripped from addresses if the
2734.q s
2735flag is specified;
2736if this is not given
2737they are passed through.
2738If the mailer is capable of sending to more than one user
2739on the same host
2740in a single transaction
2741the
2742.q m
2743flag should be stated.
2744If this flag is on,
2745then the argv template containing
2746.b $u
2747will be repeated for each unique user
2748on a given host.
2749The
2750.q e
2751flag will mark the mailer as being
2752.q expensive,
2753which will cause
631e7688 2754.i sendmail
2fb78b49 2755to defer connection
74b6e641 2756until a queue run\**.
2fb78b49
EA
2757.(f
2758\**The
2759.q c
2760configuration option must be given
2761for this to be effective.
2762.)f
4da134f8 2763.pp
2fb78b49
EA
2764An unusual case is the
2765.q C
4da134f8 2766flag.
2fb78b49
EA
2767This flag applies to the mailer that the message is received from,
2768rather than the mailer being sent to;
2769if set,
2770the domain spec of the sender
2771(i.e., the
2772.q @host.domain
2773part)
2774is saved
2775and is appended to any addresses in the message
2776that do not already contain a domain spec.
2777For example,
2778a message of the form:
4da134f8 2779.(b
2fb78b49
EA
2780From: eric@ucbarpa
2781To: wnj@monet, mckusick
4da134f8 2782.)b
2fb78b49 2783will be modified to:
4da134f8 2784.(b
2fb78b49
EA
2785From: eric@ucbarpa
2786To: wnj@monet, mckusick@ucbarpa
4da134f8 2787.)b
2fb78b49
EA
2788.i "if and only if"
2789the
2790.q C
2791flag is defined in the mailer corresponding to
2792.q eric@ucbarpa.
4da134f8 2793.pp
2fb78b49
EA
2794Other flags are described
2795in Appendix C.
2796.pp
0a9ea158 2797The S and R fields in the mailer description
2fb78b49
EA
2798are per-mailer rewriting sets
2799to be applied to sender and recipient addresses
2800respectively.
2801These are applied after the sending domain is appended
2802and the general rewriting sets
2803(numbers one and two)
2804are applied,
2805but before the output rewrite
2806(ruleset four)
2807is applied.
2808A typical use is to append the current domain
2809to addresses that do not already have a domain.
2810For example,
2811a header of the form:
4da134f8 2812.(b
2fb78b49 2813From: eric
4da134f8 2814.)b
2fb78b49 2815might be changed to be:
4da134f8 2816.(b
2fb78b49 2817From: eric@ucbarpa
4da134f8 2818.)b
2fb78b49
EA
2819or
2820.(b
2821From: ucbvax!eric
2822.)b
2823depending on the domain it is being shipped into.
2824These sets can also be used
2825to do special purpose output rewriting
2826in cooperation with ruleset four.
4da134f8 2827.pp
0a9ea158
EA
2828The E field defines the string to use
2829as an end-of-line indication.
2830A string containing only newline is the default.
2831The usual backslash escapes
2832(\er, \en, \ef, \eb)
2833may be used.
2834.pp
2fb78b49 2835Finally,
0a9ea158 2836an argv template is given as the E field.
2fb78b49
EA
2837It may have embedded spaces.
2838If there is no argv with a
2839.b $u
2840macro in it,
2841.i sendmail
2842will speak SMTP
2843to the mailer.
2844If the pathname for this mailer is
2845.q [IPC],
2846the argv should be
4da134f8 2847.(b
2fb78b49 2848IPC $h [ \fIport\fP ]
4da134f8 2849.)b
2fb78b49
EA
2850where
2851.i port
2852is the optional port number
2853to connect to.
4da134f8 2854.pp
4da134f8 2855For example,
2fb78b49 2856the specifications:
4da134f8 2857.(b
7a316267
EA
2858.ta \w'Mlocal, 'u +\w'P=/bin/mail, 'u +\w'F=rlsm, 'u +\w'S=10, 'u +\w'R=20, 'u
2859Mlocal, P=/bin/mail, F=rlsm S=10, R=20, A=mail \-d $u
2860Mether, P=[IPC], F=meC, S=11, R=21, A=IPC $h, M=100000
4da134f8 2861.)b
2fb78b49
EA
2862specifies a mailer to do local delivery
2863and a mailer for ethernet delivery.
2864The first is called
2865.q local,
2866is located in the file
2867.q /bin/mail,
2868takes a picky
2869.b \-r
2870flag,
2871does local delivery,
2872quotes should be stripped from addresses,
2873and multiple users can be delivered at once;
2874ruleset ten
2875should be applied to sender addresses in the message
2876and ruleset twenty
2877should be applied to recipient addresses;
2878the argv to send to a message will be the word
2879.q mail,
2880the word
2881.q \-d,
2882and words containing the name of the receiving user.
2883If a
2884.b \-r
2885flag is inserted
2886it will be between the words
2887.q mail
2888and
2889.q \-d.
2890The second mailer is called
2891.q ether,
2892it should be connected to via an IPC connection,
2893it can handle multiple users at once,
2894connections should be deferred,
2895and any domain from the sender address
2896should be appended to any receiver name
2897without a domain;
2898sender addresses should be processed by ruleset eleven
2899and recipient addresses by ruleset twenty-one.
7a316267 2900There is a 100,000 byte limit on messages passed through this mailer.
4da134f8 2901.++ A
631e7688 2902.+c "COMMAND LINE FLAGS"
4da134f8 2903.ba 0
69a914e1 2904.nr ii 1i
4da134f8
EA
2905.pp
2906Arguments must be presented with flags before addresses.
2907The flags are:
4da134f8
EA
2908.ip "\-f\ \fIaddr\fP"
2909The sender's machine address is
2910.i addr .
2911This flag is ignored unless the real user
2912is listed as a
2913.q "trusted user"
2914or if
2915.i addr
2916contains an exclamation point
2917(because of certain restrictions in UUCP).
2918.ip "\-r\ \fIaddr\fP"
2919An obsolete form of
2920.b \-f .
2921.ip "\-h\ \fIcnt\fP"
2922Sets the
2923.q "hop count"
2924to
2925.i cnt .
2926This represents the number of times this message has been processed
2927by
2928.i sendmail
2929(to the extent that it is supported by the underlying networks).
2930.i Cnt
2931is incremented during processing,
2932and if it reaches
2933MAXHOP
2934(currently 30)
2935.i sendmail
2936throws away the message with an error.
2937.ip \-F\fIname\fP
2938Sets the full name of this user to
2939.i name .
2940.ip \-n
2941Don't do aliasing or forwarding.
2942.ip \-t
2943Read the header for
2944.q To: ,
2945.q Cc: ,
2946and
2947.q Bcc:
2948lines, and send to everyone listed in those lists.
2949The
2950.q Bcc:
2951line will be deleted before sending.
2952Any addresses in the argument vector will be deleted
2953from the send list.
6362a767
EA
2954.ip \-b\fIx\fP
2955Set operation mode to
2956.i x .
2957Operation modes are:
2958.(b
2959.ta 4n
2960m Deliver mail (default)
2961a Run in arpanet mode (see below)
2962s Speak SMTP on input side
2963d Run as a daemon
2964t Run in test mode
2965v Just verify addresses, don't collect or deliver
2966i Initialize the alias database
2967p Print the mail queue
2968z Freeze the configuration file
2969.)b
2970The special processing for the
2971ARPANET
2972includes reading the
4da134f8
EA
2973.q "From:"
2974line from the header to find the sender,
2975printing
2976ARPANET
2977style messages
2978(preceded by three digit reply codes for compatibility with
2979the FTP protocol
2980[Neigus73, Postel74, Postel77]),
2981and ending lines of error messages with <CRLF>.
4da134f8 2982.ip \-q\fItime\fP
69a914e1 2983Try to process the queued up mail.
4da134f8
EA
2984If the time is given,
2985a sendmail will run through the queue at the specified interval
2986to deliver queued mail;
2987otherwise, it only runs once.
2988.ip \-C\fIfile\fP
2989Use a different configuration file.
9b1ebb21
EA
2990.i Sendmail
2991runs as the invoking user (rather than root)
2992when this flag is specified.
4da134f8
EA
2993.ip \-d\fIlevel\fP
2994Set debugging level.
2995.ip \-o\fIx\|value\fP
2996Set option
2997.i x
2998to the specified
2999.i value .
3000These options are described in Appendix B.
3001.pp
3002There are a number of options that may be specified as
6362a767
EA
3003primitive flags
3004(provided for compatibility with
3005.i delivermail ).
3006These are the e, i, m, and v options.
4da134f8
EA
3007Also,
3008the f option
3009may be specified as the
3010.b \-s
3011flag.
631e7688 3012.+c "CONFIGURATION OPTIONS"
4da134f8
EA
3013.pp
3014The following options may be set using the
3015.b \-o
3016flag on the command line
3017or the
3018.b O
9b1ebb21
EA
3019line in the configuration file.
3020Many of them cannot be specified unless the invoking user is trusted.
74b6e641 3021.nr ii 1i
4da134f8
EA
3022.ip A\fIfile\fP
3023Use the named
3024.i file
3025as the alias file.
3026If no file is specified,
3027use
3028.i aliases
3029in the current directory.
9b1ebb21 3030.ip a\fIN\fP
631e7688 3031If set,
9b1ebb21
EA
3032wait up to
3033.i N
3034minutes for an
631e7688
EA
3035.q @:@
3036entry to exist in the alias database
3037before starting up.
9b1ebb21
EA
3038If it does not appear in
3039.i N
3040minutes,
3041rebuild the database
3042(if the
3043.b D
3044option is also set)
3045or issue a warning.
3046.ip B\fIc\fP
3047Set the blank substitution character to
3048.i c .
3049Unquoted spaces in addresses are replaced by this character.
4da134f8 3050.ip c
69a914e1 3051If an outgoing mailer is marked as being expensive,
4da134f8
EA
3052don't connect immediately.
3053This requires that queueing be compiled in,
69a914e1 3054since it will depend on a queue run process to
4da134f8 3055actually send the mail.
6362a767
EA
3056.ip d\fIx\fP
3057Deliver in mode
3058.i x .
3059Legal modes are:
3060.(b
3061.ta 4n
3062i Deliver interactively (synchronously)
3063b Deliver in background (asynchronously)
3064q Just queue the message (deliver during queue run)
3065.)b
b16e27c4
EA
3066.ip D
3067If set,
3068rebuild the alias database if necessary and possible.
3069If this option is not set,
3070.i sendmail
3071will never rebuild the alias database
3072unless explicitly requested
3073using
3074.b \-bi .
4da134f8
EA
3075.ip e\fIx\fP
3076Dispose of errors using mode
3077.i x .
3078The values for
3079.i x
3080are:
3081.(b
3082p Print error messages (default)
3083q No messages, just give exit status
3084m Mail back errors
3085w Write back errors (mail if user not logged in)
3086e Mail back errors and give zero exit stat always
3087.)b
3088.ip f
3089Save
3090Unix-style
3091.q From
3092lines at the front of headers.
3093Normally they are assumed redundant
3094and discarded.
3095.ip g\fIn\fP
3096Set the default group id
3097for mailers to run in
3098to
3099.i n .
3100.ip H\fIfile\fP
3101Specify the help file
3102for SMTP.
f3e184c1
EA
3103.ip I
3104Insist that the BIND name server be running
3105to resolve host names.
3106If this is not set and the name server is not running,
3107the
3108.i /etc/hosts
3109file will be considered complete.
3110In general, you do want to set this option
3111if your
3112.i /etc/hosts
3113file does not include all hosts known to you
3114or if you are using the MX (mail forwarding) feature of the BIND name server.
3115The name server will still be consulted
3116even if this option is not set, but
3117.i sendmail
3118will feel free to resort to reading
3119.i /etc/hosts
3120if the name server is not available.
3121Thus, you should
3122.i never
3123set this option if you do not run the name server.
4da134f8
EA
3124.ip i
3125Ignore dots in incoming messages.
42581a7c
EA
3126.ip k\fIN\fP
3127Checkpoints the queue every
3128.i N
3129(default 10)
3130addresses sent.
3131If your system crashes during delivery to a large list,
3132this prevents retransmission to any but the last
3133.I N
3134recipients.
4da134f8
EA
3135.ip L\fIn\fP
3136Set the default log level to
3137.i n .
3138.ip M\fIx\|value\fP
3139Set the macro
3140.i x
3141to
3142.i value .
69a914e1 3143This is intended only for use from the command line.
4da134f8
EA
3144.ip m
3145Send to me too,
3146even if I am in an alias expansion.
53cac5c2
EA
3147.ip N\fInetname\fP
3148The name of the home network;
3149.q ARPA
3150by default.
3151The the argument of an SMTP
3152.q HELO
3153command is checked against
3154.q hostname.netname
3155where
3156.i hostname
3157is requested from the kernel for the current connection.
3158If they do not match,
3159.q Received:
3160lines are augmented by the name that is determined in this manner
3161so that messages can be traced accurately.
4da134f8 3162.ip o
69a914e1 3163Assume that the headers may be in old format,
4da134f8 3164i.e.,
69a914e1
EA
3165spaces delimit names.
3166This actually turns on
3167an adaptive algorithm:
4da134f8
EA
3168if any recipient address contains a comma, parenthesis,
3169or angle bracket,
3170it will be assumed that commas already exist.
69a914e1
EA
3171If this flag is not on,
3172only commas delimit names.
4da134f8
EA
3173Headers are always output with commas between the names.
3174.ip Q\fIdir\fP
3175Use the named
3176.i dir
3177as the queue directory.
8de17835
EA
3178.ip q\fIfactor\fP
3179Use
3180.i factor
3181as the multiplier in the map function
3182to decide when to just queue up jobs rather than run them.
3183This value is divided by the difference between the current load average
3184and the load average limit
3185(\c
3186.b x
3187flag)
3188to determine the maximum message priority
3189that will be sent.
3190Defaults to 10000.
4da134f8
EA
3191.ip r\fItime\fP
3192Timeout reads after
3193.i time
3194interval.
3195.ip S\fIfile\fP
3196Log statistics in the named
3197.i file .
3198.ip s
3199Be super-safe when running things,
3200i.e.,
3201always instantiate the queue file,
3202even if you are going to attempt immediate delivery.
3203.i Sendmail
3204always instantiates the queue file
3205before returning control the the client
3206under any circumstances.
3207.ip T\fItime\fP
3208Set the queue timeout to
3209.i time .
3210After this interval,
3211messages that have not been successfully sent
3212will be returned to the sender.
3213.ip t\fIS,D\fP
28719ec2 3214Set the local time zone name to
4da134f8
EA
3215.i S
3216for standard time and
3217.i D
3218for daylight time;
3219this is only used under version six.
3220.ip u\fIn\fP
3221Set the default userid for mailers to
3222.i n .
3223Mailers without the
0a9ea158 3224.i S
4da134f8
EA
3225flag in the mailer definition
3226will run as this user.
3227.ip v
3228Run in verbose mode.
42581a7c 3229.ip w
daf6b53c 3230Asserts that this domain does not have wildcard MX records
42581a7c
EA
3231in the name server database.
3232These wildcards can
3233.q capture
3234names that are directed outward
3235and forward them back to your own site.
daf6b53c
EA
3236If there are no wildcards matching your domain,
3237this option will reduce name server load
3238and improve performance.
9b1ebb21
EA
3239.ip x\fILA\fP
3240When the system load average exceeds
3241.i LA ,
3242just queue messages
3243(i.e., don't try to send them).
3244.ip X\fILA\fP
3245When the system load average exceeds
3246.i LA ,
3247refuse incoming SMTP connections.
1ef34914
EA
3248.ip y\fIfact\fP
3249The indicated
3250.i fact or
3251is added to the priority (thus
3252.i lowering
3253the priority of the job)
3254for each recipient,
3255i.e., this value penalizes jobs with large numbers of recipients.
3256.ip Y
8de17835
EA
3257If set,
3258deliver each job that is run from the queue in a separate process.
3259Use this option if you are short of memory,
3260since the default tends to consume considerable amounts of memory
3261while the queue is being processed.
1ef34914
EA
3262.ip z\fIfact\fP
3263The indicated
3264.i fact or
3265is multiplied by the message class
3266(determined by the Precedence: field in the user header
3267and the
3268.b P
3269lines in the configuration file)
3270and subtracted from the priority.
3271Thus, messages with a higher Priority: will be favored.
3272.ip Z\fIfact\fP
3273The
3274.i fact or
3275is added to the priority
3276every time a job is processed.
3277Thus,
3278each time a job is processed,
3279its priority will be decreased by the indicated value.
3280In most environments this should be positive,
3281since hosts that are down are all too often down for a long time.
631e7688
EA
3282.+c "MAILER FLAGS"
3283The following flags may be set in the mailer description.
74b6e641 3284.nr ii 4n
631e7688
EA
3285.ip f
3286The mailer wants a
3287.b \-f
3288.i from
3289flag,
3290but only if this is a network forward operation
3291(i.e.,
3292the mailer will give an error
3293if the executing user
3294does not have special permissions).
3295.ip r
3296Same as
3297.b f ,
3298but sends a
3299.b \-r
3300flag.
631e7688
EA
3301.ip S
3302Don't reset the userid
3303before calling the mailer.
3304This would be used in a secure environment
3305where
3306.i sendmail
3307ran as root.
3308This could be used to avoid forged addresses.
3309This flag is suppressed if given from an
3310.q unsafe
3311environment
3312(e.g, a user's mail.cf file).
3313.ip n
3314Do not insert a UNIX-style
3315.q From
3316line on the front of the message.
3317.ip l
3318This mailer is local
3319(i.e.,
3320final delivery will be performed).
3321.ip s
3322Strip quote characters off of the address
3323before calling the mailer.
3324.ip m
3325This mailer can send to multiple users
3326on the same host
3327in one transaction.
3328When a
3329.b $u
3330macro occurs in the
3331.i argv
3332part of the mailer definition,
3333that field will be repeated as necessary
3334for all qualifying users.
3335.ip F
3336This mailer wants a
3337.q From:
3338header line.
3339.ip D
3340This mailer wants a
3341.q Date:
3342header line.
3343.ip M
3344This mailer wants a
3345.q Message-Id:
3346header line.
3347.ip x
3348This mailer wants a
3349.q Full-Name:
3350header line.
2fb78b49
EA
3351.ip P
3352This mailer wants a
3353.q Return-Path:
3354line.
631e7688
EA
3355.ip u
3356Upper case should be preserved in user names
3357for this mailer.
3358.ip h
3359Upper case should be preserved in host names
3360for this mailer.
3361.ip A
3362This is an Arpanet-compatible mailer,
3363and all appropriate modes should be set.
3364.ip U
3365This mailer wants Unix-style
3366.q From
3367lines with the ugly UUCP-style
3368.q "remote from <host>"
3369on the end.
3370.ip e
3371This mailer is expensive to connect to,
3372so try to avoid connecting normally;
3373any necessary connection will occur during a queue run.
3374.ip X
fa8fc495
EA
3375This mailer want to use the hidden dot algorithm
3376as specified in RFC821;
3377basically,
3378any line beginning with a dot
3379will have an extra dot prepended
3380(to be stripped at the other end).
3381This insures that lines in the message containing a dot
3382will not terminate the message prematurely.
3383.ip L
3384Limit the line lengths as specified in RFC821.
fa8fc495
EA
3385.ip P
3386Use the return-path in the SMTP
3387.q "MAIL FROM:"
3388command
3389rather than just the return address;
3390although this is required in RFC821,
3391many hosts do not process return paths properly.
2fb78b49
EA
3392.ip I
3393This mailer will be speaking SMTP
3394to another
3395.i sendmail
3396\*-
3397as such it can use special protocol features.
3398This option is not required
3399(i.e.,
3400if this option is omitted the transmission will still operate successfully,
3401although perhaps not as efficiently as possible).
631e7688
EA
3402.ip C
3403If mail is
3404.i received
3405from a mailer with this flag set,
3406any addresses in the header that do not have an at sign
3407(\c
3408.q @ )
3409after being rewritten by ruleset three
3410will have the
3411.q @domain
3412clause from the sender
3413tacked on.
3414This allows mail with headers of the form:
3415.(b
3416From: usera@hosta
3417To: userb@hostb, userc
3418.)b
3419to be rewritten as:
3420.(b
3421From: usera@hosta
3422To: userb@hostb, userc@hosta
3423.)b
3424automatically.
9b1ebb21
EA
3425.ip E
3426Escape lines beginning with
3427.q From
3428in the message with a `>' sign.
4da134f8 3429.+c "OTHER CONFIGURATION"
69a914e1 3430.rm $0
b16e27c4 3431.nr ii 1i
4da134f8
EA
3432.pp
3433There are some configuration changes that can be made by
3434recompiling
3435.i sendmail .
18843c53 3436These are located in two places:
bff69eb1 3437.ip src/conf.h
b16e27c4
EA
3438Configuration parameters that may be tweaked by the installer
3439are included in conf.h.
bff69eb1 3440.ip src/conf.c
b16e27c4
EA
3441Some special routines and a few variables
3442may be defined in conf.c.
3443For the most part these are selected from the settings
3444in conf.h.
bff69eb1 3445.uh "Parameters in src/conf.h"
b16e27c4
EA
3446.pp
3447Parameters and compilation options
3448are defined in conf.h.
3449Most of these need not normally be tweaked;
3450common parameters are all in sendmail.cf.
3451However, the sizes of certain primitive vectors, etc.,
3452are included in this file.
3453The numbers following the parameters
3454are their default value.
74b6e641 3455.nr ii 1.2i
367a5dcd 3456.ip "MAXLINE [1024]"
b16e27c4
EA
3457The maximum line length of any input line.
3458If message lines exceed this length
3459they will still be processed correctly;
3460however, header lines,
3461configuration file lines,
3462alias lines,
3463etc.,
3464must fit within this limit.
367a5dcd 3465.ip "MAXNAME [256]"
b16e27c4
EA
3466The maximum length of any name,
3467such as a host or a user name.
3468.ip "MAXFIELD [2500]"
3469The maximum total length of any header field,
3470including continuation lines.
3471.ip "MAXPV [40]"
3472The maximum number of parameters to any mailer.
3473This limits the number of recipients that may be passed in one transaction.
367a5dcd 3474.ip "MAXHOP [17]"
b16e27c4
EA
3475When a message has been processed more than this number of times,
3476sendmail rejects the message
3477on the assumption that there has been an aliasing loop.
3478This can be determined from the
3479.b \-h
3480flag
69a914e1 3481or by counting the number of trace fields
b16e27c4
EA
3482(i.e,
3483.q Received:
3484lines)
3485in the message header.
3486.ip "MAXATOM [100]"
3487The maximum number of atoms
3488(tokens)
3489in a single address.
3490For example,
3491the address
3492.q "eric@Berkeley"
3493is three atoms.
3494.ip "MAXMAILERS [25]"
3495The maximum number of mailers that may be defined
3496in the configuration file.
3497.ip "MAXRWSETS [30]"
3498The maximum number of rewriting sets
3499that may be defined.
3500.ip "MAXPRIORITIES [25]"
3501The maximum number of values for the
3502.q Precedence:
3503field that may be defined
3504(using the
3505.b P
3506line in sendmail.cf).
3507.ip "MAXTRUST [30]"
3508The maximum number of trusted users that may be defined
3509(using the
3510.b T
3511line in sendmail.cf).
367a5dcd
EA
3512.ip "MAXUSERENVIRON [40]"
3513The maximum number of items in the user environment
3514that will be passed to subordinate mailers.
4f24419a
EA
3515.ip "QUEUESIZE [600]"
3516The maximum number of entries that will be processed
3517in a single queue run.
b16e27c4
EA
3518.lp
3519A number of other compilation options exist.
3520These specify whether or not specific code should be compiled in.
74b6e641 3521.nr ii 1i
4da134f8
EA
3522.ip DBM
3523If set,
3524the
3525.q DBM
3526package in UNIX is used
4f24419a
EA
3527(see
3528.i dbm(3X)
3529in [UNIX80]).
4da134f8
EA
3530If not set,
3531a much less efficient algorithm for processing aliases is used.
4f24419a
EA
3532.ip NDBM
3533If set,
3534the new version of the DBM library
3535that allows multiple databases will be used.
3536.q DBM
3537must also be set.
4da134f8
EA
3538.ip DEBUG
3539If set, debugging information is compiled in.
3540To actually get the debugging output,
3541the
3542.b \-d
3543flag must be used.
3544.ip LOG
3545If set,
3546the
3547.i syslog
3548routine in use at some sites is used.
3549This makes an informational log record
3550for each message processed,
3551and makes a higher priority log record
3552for internal system errors.
3553.ip QUEUE
3554This flag should be set to compile in the queueing code.
3555If this is not set,
3556mailers must accept the mail immediately
3557or it will be returned to the sender.
3558.ip SMTP
3559If set,
3560the code to handle user and server SMTP will be compiled in.
3561This is only necessary if your machine has some mailer
3562that speaks SMTP.
b16e27c4
EA
3563.ip DAEMON
3564If set,
3565code to run a daemon is compiled in.
4f24419a 3566This code is for 4.2 or 4.3BSD.
4da134f8
EA
3567.ip UGLYUUCP
3568If you have a UUCP host adjacent to you which is not running
3569a reasonable version of
3570.i rmail ,
3571you will have to set this flag to include the
3572.q "remote from sysname"
3573info on the from line.
3574Otherwise, UUCP gets confused about where the mail came from.
4da134f8
EA
3575.ip NOTUNIX
3576If you are using a non-UNIX mail format,
3577you can set this flag to turn off special processing
3578of UNIX-style
3579.q "From "
3580lines.
f3e184c1
EA
3581.ip NAMED_BIND
3582Compile in code to use the Berkeley Internet Name Domain (BIND) server
3583to resolve TCP/IP host names.
18843c53
PL
3584.ip SETPROCTITLE
3585If defined,
3586.i sendmail
3587will change its
3588.i argv
3589array to indicate its current status.
3590This can be used in conjunction with the
3591.i ps
3592command to find out just what it's up to.
bff69eb1 3593.uh "Configuration in src/conf.c"
4da134f8
EA
3594.pp
3595Not all header semantics are defined in the configuration file.
3596Header lines that should only be included by certain mailers
3597(as well as other more obscure semantics)
3598must be specified in the
3599.i HdrInfo
3600table in
3601.i conf.c .
3602This table contains the header name
b16e27c4
EA
3603(which should be in all lower case)
3604and a set of header control flags (described below),
3605The flags are:
4da134f8 3606.ip H_ACHECK
b16e27c4
EA
3607Normally when the check is made to see if a header line is compatible
3608with a mailer,
3609.i sendmail
3610will not delete an existing line.
3611If this flag is set,
3612.i sendmail
3613will delete
3614even existing header lines.
4da134f8
EA
3615That is,
3616if this bit is set and the mailer does not have flag bits set
b16e27c4
EA
3617that intersect with the required mailer flags
3618in the header definition in
3619sendmail.cf,
4da134f8
EA
3620the header line is
3621.i always
3622deleted.
3623.ip H_EOH
3624If this header field is set,
3625treat it like a blank line,
3626i.e.,
3627it will signal the end of the header
3628and the beginning of the message text.
3629.ip H_FORCE
3630Add this header entry
3631even if one existed in the message before.
3632If a header entry does not have this bit set,
3633.i sendmail
3634will not add another header line if a header line
3635of this name already existed.
3636This would normally be used to stamp the message
3637by everyone who handled it.
3638.ip H_TRACE
3639If set,
3640this is a timestamp
3641(trace)
3642field.
3643If the number of trace fields in a message
3644exceeds a preset amount
3645the message is returned
3646on the assumption that it has an aliasing loop.
3647.ip H_RCPT
3648If set,
3649this field contains recipient addresses.
3650This is used by the
3651.b \-t
3652flag to determine who to send to
3653when it is collecting recipients from the message.
3654.ip H_FROM
3655This flag indicates that this field
3656specifies a sender.
3657The order of these fields in the
3658.i HdrInfo
3659table specifies
3660.i sendmail's
3661preference
3662for which field to return error messages to.
3663.nr ii 5n
3664.lp
3665Let's look at a sample
3666.i HdrInfo
3667specification:
3668.(b
be2fcca9 3669.ta 4n +\w'"return-receipt-to", 'u
4da134f8 3670struct hdrinfo HdrInfo[] =
367a5dcd 3671\&{
69a914e1 3672 /* originator fields, most to least significant */
be2fcca9
EA
3673 "resent-sender", H_FROM,
3674 "resent-from", H_FROM,
3675 "sender", H_FROM,
3676 "from", H_FROM,
3677 "full-name", H_ACHECK,
69a914e1 3678 /* destination fields */
be2fcca9
EA
3679 "to", H_RCPT,
3680 "resent-to", H_RCPT,
3681 "cc", H_RCPT,
69a914e1 3682 /* message identification and control */
be2fcca9
EA
3683 "message", H_EOH,
3684 "text", H_EOH,
69a914e1 3685 /* trace fields */
be2fcca9 3686 "received", H_TRACE|H_FORCE,
4da134f8 3687
be2fcca9 3688 NULL, 0,
4da134f8 3689};
4da134f8 3690.)b
be2fcca9 3691This structure indicates that the
4da134f8
EA
3692.q To: ,
3693.q Resent-To: ,
3694and
3695.q Cc:
be2fcca9 3696fields
4da134f8 3697all specify recipient addresses.
be2fcca9
EA
3698Any
3699.q Full-Name:
3700field will be deleted unless the required mailer flag
3701(indicated in the configuration file)
3702is specified.
4da134f8
EA
3703The
3704.q Message:
3705and
3706.q Text:
3707fields will terminate the header;
3708these are specified in new protocols
3709[NBS80]
3710or used by random dissenters around the network world.
3711The
3712.q Received:
3713field will always be added,
3714and can be used to trace messages.
4da134f8
EA
3715.pp
3716There are a number of important points here.
3717First,
3718header fields are not added automatically just because they are in the
3719.i HdrInfo
3720structure;
3721they must be specified in the configuration file
3722in order to be added to the message.
3723Any header fields mentioned in the configuration file but not
3724mentioned in the
3725.i HdrInfo
3726structure have default processing performed;
3727that is,
3728they are added unless they were in the message already.
3729Second,
3730the
3731.i HdrInfo
3732structure only specifies cliched processing;
3733certain headers are processed specially by ad hoc code
3734regardless of the status specified in
3735.i HdrInfo .
3736For example,
3737the
3738.q Sender:
3739and
3740.q From:
3741fields are always scanned on ARPANET mail
3742to determine the sender;
3743this is used to perform the
3744.q "return to sender"
3745function.
3746The
3747.q "From:"
3748and
3749.q "Full-Name:"
3750fields are used to determine the full name of the sender
3751if possible;
3752this is stored in the macro
3753.b $x
3754and used in a number of ways.
3755.pp
3756The file
3757.i conf.c
3758also contains the specification of ARPANET reply codes.
69a914e1 3759There are four classifications these fall into:
4da134f8 3760.(b
74b6e641 3761.sz -1
4da134f8
EA
3762.ta \w'char 'u +\w'Arpa_TUsrerr[] = 'u +\w'"888"; 'u
3763char Arpa_Info[] = "050"; /* arbitrary info */
3764char Arpa_TSyserr[] = "455"; /* some (transient) system error */
367a5dcd 3765char Arpa_PSyserr[] = "554"; /* some (permanent) system error */
4da134f8
EA
3766char Arpa_Usrerr[] = "554"; /* some (fatal) user error */
3767.sz
3768.)b
3769The class
3770.i Arpa_Info
3771is for any information that is not required by the protocol,
3772such as forwarding information.
3773.i Arpa_TSyserr
3774and
3775.i Arpa_PSyserr
3776is printed by the
3777.i syserr
3778routine.
3779TSyserr
3780is printed out for transient errors,
367a5dcd
EA
3781that is,
3782errors that are likely to go away without explicit action
3783on the part of a systems administrator.
3784PSyserr
3785is printed for permanent errors.
3786The distinction is made based on the value of
4da134f8
EA
3787.i errno .
3788Finally,
3789.i Arpa_Usrerr
3790is the result of a user error
3791and is generated by the
3792.i usrerr
3793routine;
3794these are generated when the user has specified something wrong,
3795and hence the error is permanent,
3796i.e.,
3797it will not work simply by resubmitting the request.
3798.pp
69a914e1 3799If it is necessary to restrict mail through a relay,
4da134f8
EA
3800the
3801.i checkcompat
3802routine can be modified.
3803This routine is called for every recipient address.
3804It can return
3805.b TRUE
3806to indicate that the address is acceptable
3807and mail processing will continue,
3808or it can return
3809.b FALSE
3810to reject the recipient.
3811If it returns false,
3812it is up to
3813.i checkcompat
3814to print an error message
3815(using
3816.i usrerr )
3817saying why the message is rejected.
3818For example,
3819.i checkcompat
3820could read:
3821.(b
3822.re
74b6e641 3823.sz -1
69a914e1 3824.ta 4n +4n +4n +4n +4n +4n +4n
4da134f8
EA
3825bool
3826checkcompat(to)
3827 register ADDRESS *to;
367a5dcd 3828\&{
69a914e1 3829 if (MsgSize > 50000 && to->q_mailer != LocalMailer)
4da134f8
EA
3830 {
3831 usrerr("Message too large for non-local delivery");
7a316267 3832 NoReturn = TRUE;
4da134f8
EA
3833 return (FALSE);
3834 }
3835 return (TRUE);
3836}
3837.sz
3838.)b
3839This would reject messages greater than 50000 bytes
3840unless they were local.
7a316267
EA
3841The
3842.i NoReturn
28719ec2 3843flag can be sent to suppress the return of the actual body
7a316267 3844of the message in the error return.
4da134f8
EA
3845The actual use of this routine is highly dependent on the
3846implementation,
3847and use should be limited.
367a5dcd
EA
3848.uh "Configuration in src/daemon.c"
3849.pp
3850The file
3851.i src/daemon.c
3852contains a number of routines that are dependent
3853on the local networking environment.
3854The version supplied is specific to 4.3 BSD.
3855.pp
3856The routine
3857.i maphostname
3858is called to convert strings within
3859.b $[
3860\&...\&
3861.b $]
3862symbols.
3863It can be modified if you wish to provide a more sophisticated service,
3864e.g.,
3865mapping UUCP host names to full paths.
69a914e1
EA
3866.+c "SUMMARY OF SUPPORT FILES"
3867.pp
3868This is a summary of the support files
3869that
3870.i sendmail
3871creates or generates.
3872.nr ii 1i
3873.ip "/usr/lib/sendmail"
3874The binary of
3875.i sendmail .
3876.ip /usr/bin/newaliases
3877A link to /usr/lib/sendmail;
3878causes the alias database to be rebuilt.
74b6e641
EA
3879Running this program is completely equivalent to giving
3880.i sendmail
3881the
3882.b \-bi
3883flag.
69a914e1
EA
3884.ip /usr/bin/mailq
3885Prints a listing of the mail queue.
74b6e641
EA
3886This program is equivalent to using the
3887.b \-bp
3888flag to
3889.i sendmail .
69a914e1
EA
3890.ip /usr/lib/sendmail.cf
3891The configuration file,
3892in textual form.
3893.ip /usr/lib/sendmail.fc
3894The configuration file
3895represented as a memory image.
3896.ip /usr/lib/sendmail.hf
3897The SMTP help file.
3898.ip /usr/lib/sendmail.st
3899A statistics file; need not be present.
3900.ip /usr/lib/aliases
3901The textual version of the alias file.
3902.ip /usr/lib/aliases.{pag,dir}
3903The alias file in
74b6e641 3904.i dbm \|(3)
69a914e1 3905format.
69a914e1
EA
3906.ip /usr/spool/mqueue
3907The directory in which the mail queue
3908and temporary files reside.
3909.ip /usr/spool/mqueue/qf*
3910Control (queue) files for messages.
3911.ip /usr/spool/mqueue/df*
3912Data files.
3913.ip /usr/spool/mqueue/lf*
3914Lock files
3915.ip /usr/spool/mqueue/tf*
3916Temporary versions of the qf files,
3917used during queue file rebuild.
3918.ip /usr/spool/mqueue/nf*
3919A file used when creating a unique id.
3920.ip /usr/spool/mqueue/xf*
3921A transcript of the current session.
28719ec2
JB
3922.\".ro
3923.\".ls 1
3924.\".tp
3925.\".sp 2i
3926.\".in 0
3927.\".ce 100
3928.\".sz 24
3929.\".b SENDMAIL
3930.\".sz 14
3931.\".sp
3932.\"INSTALLATION AND OPERATION GUIDE
3933.\".sp
3934.\".sz 10
3935.\"Eric Allman
3936.\"Britton-Lee, Inc.
3937.\".sp
daf6b53c 3938.\"Version 5.15
28719ec2
JB
3939.\".ce 0
3940.pn 2
3941.bp
4da134f8 3942.ce
74b6e641 3943.sz 12
4da134f8 3944TABLE OF CONTENTS
74b6e641 3945.sz 10
28719ec2 3946.sp
3702dbcc
EA
3947.\" remove some things to avoid "out of temp file space" problem
3948.rm sh
3949.rm (x
3950.rm )x
3951.rm ip
3952.rm pp
3953.rm lp
3954.rm he
3955.rm fo
3956.rm eh
3957.rm oh
3958.rm ef
3959.rm of
4da134f8 3960.xp