tp_error_emit doesn't set drefs; minor lint gotcha for cons
[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.\"
3edcb7c8 7.\" @(#)op.me 5.13 (Berkeley) %G%
28719ec2 8.\"
367a5dcd
EA
9.\" eqn % | troff -me
10.\"if n .ls 2
28719ec2 11.\".he 'Sendmail Installation and Operation Guide''%'
3edcb7c8 12.\".fo 'Version 5.13''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
3edcb7c8 43Version 5.13
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.
1346.sh 2 "File Modes"
4da134f8 1347.pp
2fb78b49
EA
1348There are a number of files
1349that may have a number of modes.
1350The modes depend on what functionality you want
1351and the level of security you require.
1352.sh 3 "To suid or not to suid?"
4da134f8 1353.pp
2fb78b49
EA
1354.i Sendmail
1355can safely be made
1356setuid to root.
1357At the point where it is about to
74b6e641 1358.i exec \|(2)
2fb78b49
EA
1359a mailer,
1360it checks to see if the userid is zero;
1361if so,
1362it resets the userid and groupid to a default
1363(set by the
1364.b u
4da134f8 1365and
2fb78b49
EA
1366.b g
1367options).
1368(This can be overridden
1369by setting the
1370.b S
1371flag to the mailer
1372for mailers that are trusted
1373and must be called as root.)
1374However,
1375this will cause mail processing
1376to be accounted
1377(using
74b6e641 1378.i sa \|(8))
2fb78b49
EA
1379to root
1380rather than to the user sending the mail.
2fb78b49 1381.sh 3 "Should my alias database be writable?"
4da134f8 1382.pp
2fb78b49
EA
1383At Berkeley
1384we have the alias database
1385(/usr/lib/aliases*)
18843c53
PL
1386mode 644.
1387While this is not as flexible as if the database
1388were more 666, it avoids potential security problems
1389with a globally writable database.
4da134f8 1390.pp
2fb78b49
EA
1391The database that
1392.i sendmail
1393actually used
1394is represented by the two files
1395.i aliases.dir
4da134f8 1396and
2fb78b49
EA
1397.i aliases.pag
1398(both in /usr/lib).
1399The mode on these files should match the mode
1400on /usr/lib/aliases.
1401If
1402.i aliases
1403is writable
1404and the
1405DBM
1406files
4da134f8 1407(\c
2fb78b49
EA
1408.i aliases.dir
1409and
1410.i aliases.pag )
1411are not,
1412users will be unable to reflect their desired changes
1413through to the actual database.
1414However,
1415if
1416.i aliases
1417is read-only
1418and the DBM files are writable,
1419a slightly sophisticated user
1420can arrange to steal mail anyway.
4da134f8 1421.pp
2fb78b49
EA
1422If your DBM files are not writable by the world
1423or you do not have auto-rebuild enabled
1424(with the
1425.q D
1426option),
1427then you must be careful to reconstruct the alias database
1428each time you change the text version:
4da134f8 1429.(b
74b6e641 1430newaliases
4da134f8 1431.)b
2fb78b49
EA
1432If this step is ignored or forgotten
1433any intended changes will also be ignored or forgotten.
1434.sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
4da134f8 1435.pp
2fb78b49
EA
1436This section describes the configuration file
1437in detail,
1438including hints on how to write one of your own
1439if you have to.
4da134f8 1440.pp
2fb78b49
EA
1441There is one point that should be made clear immediately:
1442the syntax of the configuration file
1443is designed to be reasonably easy to parse,
1444since this is done every time
1445.i sendmail
1446starts up,
1447rather than easy for a human to read or write.
1448On the
1449.q "future project"
1450list is a
1451configuration-file compiler.
4da134f8 1452.pp
2fb78b49
EA
1453An overview of the configuration file
1454is given first,
1455followed by details of the semantics.
1456.sh 2 "The Syntax"
1457.pp
1458The configuration file is organized as a series of lines,
1459each of which begins with a single character
1460defining the semantics for the rest of the line.
1461Lines beginning with a space or a tab
1462are continuation lines
1463(although the semantics are not well defined in many places).
1464Blank lines and lines beginning with a sharp symbol
1465(`#')
1466are comments.
1467.sh 3 "R and S \*- rewriting rules"
1468.pp
1469The core of address parsing
1470are the rewriting rules.
1471These are an ordered production system.
1472.i Sendmail
1473scans through the set of rewriting rules
1474looking for a match on the left hand side
1475(LHS)
1476of the rule.
1477When a rule matches,
1478the address is replaced by the right hand side
1479(RHS)
1480of the rule.
1481.pp
1482There are several sets of rewriting rules.
1483Some of the rewriting sets are used internally
1484and must have specific semantics.
1485Other rewriting sets
1486do not have specifically assigned semantics,
1487and may be referenced by the mailer definitions
1488or by other rewriting sets.
1489.pp
1490The syntax of these two commands are:
1491.(b F
1492.b S \c
4da134f8 1493.i n
2fb78b49
EA
1494.)b
1495Sets the current ruleset being collected to
4da134f8 1496.i n .
2fb78b49
EA
1497If you begin a ruleset more than once
1498it deletes the old definition.
1499.(b F
1500.b R \c
1501.i lhs
1502.i rhs
1503.i comments
4da134f8 1504.)b
4da134f8 1505The
2fb78b49
EA
1506fields must be separated
1507by at least one tab character;
1508there may be embedded spaces
1509in the fields.
4da134f8 1510The
2fb78b49
EA
1511.i lhs
1512is a pattern that is applied to the input.
1513If it matches,
1514the input is rewritten to the
1515.i rhs .
1516The
1517.i comments
1518are ignored.
1519.sh 3 "D \*- define macro"
1520.pp
1521Macros are named with a single character.
1522These may be selected from the entire ASCII set,
1523but user-defined macros
1524should be selected from the set of upper case letters only.
1525Lower case letters
1526and special symbols
1527are used internally.
1528.pp
1529The syntax for macro definitions is:
1530.(b F
1531.b D \c
1532.i x\|val
1533.)b
1534where
1535.i x
1536is the name of the macro
4da134f8 1537and
2fb78b49
EA
1538.i val
1539is the value it should have.
1540Macros can be interpolated in most places using the escape sequence
1541.b $ \c
1542.i x .
1543.sh 3 "C and F \*- define classes"
1544.pp
1545Classes of words may be defined
18843c53
PL
1546to match on the left hand side of rewriting rules,
1547where a
1548.q word
1549is a sequence of characters that do not contain characters
1550in the $o macro.
2fb78b49
EA
1551For example
1552a class of all local names for this site
1553might be created
1554so that attempts to send to oneself
1555can be eliminated.
1556These can either be defined directly in the configuration file
1557or read in from another file.
1558Classes may be given names
1559from the set of upper case letters.
7a316267
EA
1560Lower case letters and special characters
1561are reserved for system use.
2fb78b49
EA
1562.pp
1563The syntax is:
1564.(b F
1565.b C \c
1566.i c\|word1
1567.i word2...
1568.br
1569.b F \c
1570.i c\|file
2fb78b49
EA
1571.)b
1572The first form defines the class
1573.i c
1574to match any of the named words.
1575It is permissible to split them among multiple lines;
1576for example, the two forms:
4da134f8 1577.(b
2fb78b49 1578CHmonet ucbmonet
4da134f8 1579.)b
2fb78b49
EA
1580and
1581.(b
1582CHmonet
1583CHucbmonet
1584.)b
1585are equivalent.
1586The second form
1587reads the elements of the class
1588.i c
1589from the named
318b7556 1590.i file .
2fb78b49 1591.sh 3 "M \*- define mailer"
4da134f8 1592.pp
2fb78b49
EA
1593Programs and interfaces to mailers
1594are defined in this line.
1595The format is:
1596.(b F
1597.b M \c
0a9ea158 1598.i name ,
74b6e641 1599{\c
0a9ea158 1600.i field =\c
74b6e641 1601.i value \|}*
4da134f8 1602.)b
2fb78b49
EA
1603where
1604.i name
1605is the name of the mailer
0a9ea158
EA
1606(used internally only)
1607and the
1608.q field=name
1609pairs define attributes of the mailer.
1610Fields are:
1611.(b
1612.ta 1i
1613Path The pathname of the mailer
1614Flags Special flags for this mailer
1615Sender A rewriting set for sender addresses
1616Recipient A rewriting set for recipient addresses
1617Argv An argument vector to pass to this mailer
1618Eol The end-of-line string for this mailer
7a316267 1619Maxsize The maximum message length to this mailer
0a9ea158
EA
1620.)b
1621Only the first character of the field name is checked.
2fb78b49 1622.sh 3 "H \*- define header"
4da134f8 1623.pp
2fb78b49
EA
1624The format of the header lines that sendmail inserts into the message
1625are defined by the
1626.b H
1627line.
1628The syntax of this line is:
1629.(b F
1630.b H [\c
1631.b ? \c
1632.i mflags \c
1633.b ? ]\c
1634.i hname \c
1635.b :
1636.i htemplate
1637.)b
1638Continuation lines in this spec
1639are reflected directly into the outgoing message.
4da134f8 1640The
2fb78b49
EA
1641.i htemplate
1642is macro expanded before insertion into the message.
1643If the
1644.i mflags
1645(surrounded by question marks)
1646are specified,
1647at least one of the specified flags
1648must be stated in the mailer definition
1649for this header to be automatically output.
1650If one of these headers is in the input
1651it is reflected to the output
1652regardless of these flags.
4da134f8 1653.pp
2fb78b49
EA
1654Some headers have special semantics
1655that will be described below.
1656.sh 3 "O \*- set option"
4da134f8 1657.pp
2fb78b49
EA
1658There are a number of
1659.q random
1660options that
1661can be set from a configuration file.
1662Options are represented by single characters.
1663The syntax of this line is:
1664.(b F
1665.b O \c
1666.i o\|value
1667.)b
1668This sets option
1669.i o
1670to be
1671.i value .
1672Depending on the option,
1673.i value
1674may be a string, an integer,
1675a boolean
1676(with legal values
1677.q t ,
1678.q T ,
1679.q f ,
1680or
1681.q F ;
1682the default is TRUE),
1683or
1684a time interval.
1685.sh 3 "T \*- define trusted users"
4da134f8 1686.pp
2fb78b49
EA
1687Trusted users
1688are those users who are permitted
1689to override the sender address
1690using the
1691.b \-f
1692flag.
1693These typically are
1694.q root,
1695.q uucp,
1696and
1697.q network,
1698but on some users it may be convenient
1699to extend this list to include other users,
1700perhaps to support
1701a separate
1702UUCP
1703login for each host.
1704The syntax of this line is:
1705.(b F
1706.b T \c
1707.i user1
1708.i user2 ...
1709.)b
1710There may be more than one of these lines.
1711.sh 3 "P \*- precedence definitions"
4da134f8 1712.pp
2fb78b49
EA
1713Values for the
1714.q "Precedence:"
1715field may be defined using the
1716.b P
1717control line.
1718The syntax of this field is:
1719.(b
1720\fBP\fP\fIname\fP\fB=\fP\fInum\fP
1721.)b
1722When the
1723.i name
1724is found in a
1725.q Precedence:
1726field,
1727the message class is set to
1728.i num .
1729Higher numbers mean higher precedence.
1730Numbers less than zero
1731have the special property
1732that error messages will not be returned.
1733The default precedence is zero.
4da134f8 1734For example,
2fb78b49
EA
1735our list of precedences is:
1736.(b
1737Pfirst-class=0
1738Pspecial-delivery=100
74b6e641 1739Pjunk=\-100
2fb78b49
EA
1740.)b
1741.sh 2 "The Semantics"
4da134f8 1742.pp
2fb78b49
EA
1743This section describes the semantics of the configuration file.
1744.sh 3 "Special macros, conditionals"
4da134f8 1745.pp
2fb78b49
EA
1746Macros are interpolated
1747using the construct
1748.b $ \c
1749.i x ,
1750where
1751.i x
1752is the name of the macro to be interpolated.
1753In particular,
1754lower case letters are reserved to have
1755special semantics,
1756used to pass information in or out of sendmail,
1757and some special characters are reserved to
1758provide conditionals, etc.
4da134f8 1759.pp
367a5dcd
EA
1760Conditionals can be specified using the syntax:
1761.(b
1762$?x text1 $| text2 $.
1763.)b
1764This interpolates
1765.i text1
1766if the macro
1767.b $x
1768is set,
1769and
1770.i text2
1771otherwise.
1772The
1773.q else
1774(\c
1775.b $| )
1776clause may be omitted.
1777.pp
2fb78b49
EA
1778The following macros
1779.i must
1780be defined to transmit information into
1781.i sendmail:
1782.(b
1783.ta 4n
1b165f11 1784e The SMTP entry message
2fb78b49
EA
1785j The \*(lqofficial\*(rq domain name for this site
1786l The format of the UNIX from line
1787n The name of the daemon (for error messages)
1788o The set of "operators" in addresses
1789q default format of sender address
1790.)b
1791The
1b165f11
EA
1792.b $e
1793macro is printed out when SMTP starts up.
1794The first word must be the
1795.b $j
1796macro.
1797The
2fb78b49
EA
1798.b $j
1799macro
1800should be in RFC821 format.
1801The
1802.b $l
1803and
1804.b $n
1805macros can be considered constants
1806except under terribly unusual circumstances.
1807The
1808.b $o
1809macro consists of a list of characters
1810which will be considered tokens
1811and which will separate tokens
1812when doing parsing.
1813For example, if
367a5dcd 1814.q @
2fb78b49
EA
1815were in the
1816.b $o
1817macro, then the input
367a5dcd 1818.q a@b
2fb78b49 1819would be scanned as three tokens:
367a5dcd
EA
1820.q a,
1821.q @,
4da134f8 1822and
367a5dcd 1823.q b.
2fb78b49
EA
1824Finally, the
1825.b $q
1826macro specifies how an address should appear in a message
1827when it is defaulted.
1828For example, on our system these definitions are:
1829.(b
1b165f11 1830De$j Sendmail $v ready at $b
2fb78b49
EA
1831DnMAILER-DAEMON
1832DlFrom $g $d
1833Do.:%@!^=/
1834Dq$g$?x ($x)$.
1835Dj$H.$D
1836.)b
1837An acceptable alternative for the
1838.b $q
1839macro is
1840.q "$?x$x $.<$g>" .
1841These correspond to the following two formats:
1842.(b
1843eric@Berkeley (Eric Allman)
1844Eric Allman <eric@Berkeley>
1845.)b
4da134f8 1846.pp
2fb78b49
EA
1847Some macros are defined by
1848.i sendmail
1849for interpolation into argv's for mailers
1850or for other contexts.
1851These macros are:
4da134f8 1852.(b
18843c53
PL
1853a The origination date in RFC 822 format
1854b The current date in RFC 822 format
2fb78b49
EA
1855c The hop count
1856d The date in UNIX (ctime) format
1857f The sender (from) address
1858g The sender address relative to the recipient
1859h The recipient host
1860i The queue id
1861p Sendmail's pid
1862r Protocol used
1863s Sender's host name
1864t A numeric representation of the current time
1865u The recipient user
1866v The version number of sendmail
b01d261b 1867w The hostname of this site
2fb78b49 1868x The full name of the sender
2fb78b49 1869z The home directory of the recipient
4da134f8 1870.)b
4da134f8 1871.pp
2fb78b49
EA
1872There are three types of dates that can be used.
1873The
1874.b $a
4da134f8 1875and
2fb78b49 1876.b $b
18843c53 1877macros are in RFC 822 format;
2fb78b49
EA
1878.b $a
1879is the time as extracted from the
1880.q Date:
1881line of the message
1882(if there was one),
1883and
1884.b $b
1885is the current date and time
1886(used for postmarks).
1887If no
1888.q Date:
1889line is found in the incoming message,
1890.b $a
1891is set to the current time also.
1892The
1893.b $d
1894macro is equivalent to the
1895.b $a
1896macro in UNIX
1897(ctime)
1898format.
4da134f8 1899.pp
2fb78b49
EA
1900The
1901.b $f
1902macro is the id of the sender
1903as originally determined;
1904when mailing to a specific host
1905the
1906.b $g
1907macro is set to the address of the sender
1908.ul
1909relative to the recipient.
1910For example,
1911if I send to
1912.q bollard@matisse
1913from the machine
1914.q ucbarpa
1915the
1916.b $f
1917macro will be
1918.q eric
1919and the
1920.b $g
1921macro will be
1922.q eric@ucbarpa.
4da134f8 1923.pp
2fb78b49
EA
1924The
1925.b $x
1926macro is set to the full name of the sender.
1927This can be determined in several ways.
1928It can be passed as flag to
1929.i sendmail.
1930The second choice is the value of the
1931.q Full-name:
1932line in the header if it exists,
1933and the third choice is the comment field
1934of a
1935.q From:
1936line.
1937If all of these fail,
1938and if the message is being originated locally,
1939the full name is looked up in the
1940.i /etc/passwd
1941file.
4da134f8 1942.pp
2fb78b49
EA
1943When sending,
1944the
1945.b $h ,
1946.b $u ,
1947and
1948.b $z
1949macros get set to the host, user, and home directory
1950(if local)
1951of the recipient.
1952The first two are set from the
1953.b $@
1954and
1955.b $:
1956part of the rewriting rules, respectively.
1957.pp
1958The
1959.b $p
1960and
1961.b $t
1962macros are used to create unique strings
1963(e.g., for the
1964.q Message-Id:
1965field).
1966The
1967.b $i
1968macro is set to the queue id on this host;
1969if put into the timestamp line
1970it can be extremely useful for tracking messages.
1971The
2fb78b49
EA
1972.b $v
1973macro is set to be the version number of
1974.i sendmail ;
1975this is normally put in timestamps
1976and has been proven extremely useful for debugging.
1977The
b01d261b
EA
1978.b $w
1979macro is set to the name of this host
1980if it can be determined.
1981The
2fb78b49
EA
1982.b $c
1983field is set to the
1984.q "hop count,"
1985i.e., the number of times this message has been processed.
1986This can be determined
1987by the
1988.b \-h
1989flag on the command line
1990or by counting the timestamps in the message.
4da134f8 1991.pp
2fb78b49
EA
1992The
1993.b $r
1994and
1995.b $s
1996fields are set to the protocol used to communicate with sendmail
1997and the sending hostname;
1998these are not supported in the current version.
7a316267
EA
1999.sh 3 "Special classes"
2000.pp
2001The class
2002.b $=w
2003is set to be the set of all names
2004this host is known by.
18843c53 2005This can be used to match local hostnames.
2fb78b49
EA
2006.sh 3 "The left hand side"
2007.pp
2008The left hand side of rewriting rules contains a pattern.
2009Normal words are simply matched directly.
2010Metasyntax is introduced using a dollar sign.
2011The metasymbols are:
4da134f8 2012.(b
74b6e641 2013.ta \w'\fB$=\fP\fIx\fP 'u
2fb78b49
EA
2014\fB$*\fP Match zero or more tokens
2015\fB$+\fP Match one or more tokens
74b6e641 2016\fB$\-\fP Match exactly one token
2fb78b49 2017\fB$=\fP\fIx\fP Match any token in class \fIx\fP
6ca09d34 2018\fB$~\fP\fIx\fP Match any token not in class \fIx\fP
4da134f8 2019.)b
2fb78b49
EA
2020If any of these match,
2021they are assigned to the symbol
2022.b $ \c
2023.i n
2024for replacement on the right hand side,
4da134f8 2025where
2fb78b49
EA
2026.i n
2027is the index in the LHS.
2028For example,
2029if the LHS:
631e7688 2030.(b
74b6e641 2031$\-:$+
631e7688 2032.)b
2fb78b49 2033is applied to the input:
4da134f8 2034.(b
2fb78b49 2035UCBARPA:eric
4da134f8 2036.)b
2fb78b49
EA
2037the rule will match, and the values passed to the RHS will be:
2038.(b
2039.ta 4n
2040$1 UCBARPA
2041$2 eric
2042.)b
2043.sh 3 "The right hand side"
631e7688 2044.pp
9b1ebb21 2045When the left hand side of a rewriting rule matches,
2fb78b49
EA
2046the input is deleted and replaced by the right hand side.
2047Tokens are copied directly from the RHS
367a5dcd 2048unless they begin with a dollar sign.
2fb78b49
EA
2049Metasymbols are:
2050.(b
2051.ta \w'$#mailer 'u
2052\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
9b1ebb21 2053\fB$[\fP\fIname\fP\fB$]\fP Canonicalize \fIname\fP
2fb78b49
EA
2054\fB$>\fP\fIn\fP \*(lqCall\*(rq ruleset \fIn\fP
2055\fB$#\fP\fImailer\fP Resolve to \fImailer\fP
2056\fB$@\fP\fIhost\fP Specify \fIhost\fP
2057\fB$:\fP\fIuser\fP Specify \fIuser\fP
2058.)b
631e7688 2059.pp
2fb78b49
EA
2060The
2061.b $ \c
2062.i n
2063syntax substitutes the corresponding value from a
2064.b $+ ,
74b6e641 2065.b $\- ,
2fb78b49 2066.b $* ,
6ca09d34 2067.b $= ,
631e7688 2068or
6ca09d34 2069.b $~
2fb78b49
EA
2070match on the LHS.
2071It may be used anywhere.
2072.pp
9b1ebb21
EA
2073A host name enclosed between
2074.b $[
2075and
2076.b $]
28719ec2
JB
2077is looked up using the
2078.i gethostent \|(3)
2079routines and replaced by the canonical name.
9b1ebb21
EA
2080For example,
2081.q $[csam$]
18843c53 2082might become
367a5dcd
EA
2083.q lbl-csam.arpa
2084and
2085.q $[[128.32.130.2]$]
2086would become
2087.q vangogh.berkeley.edu.
9b1ebb21 2088.pp
631e7688 2089The
2fb78b49
EA
2090.b $> \c
2091.i n
2092syntax
2093causes the remainder of the line to be substituted as usual
2094and then passed as the argument to ruleset
2095.i n .
2096The final value of ruleset
2097.i n
2098then becomes
2099the substitution for this rule.
631e7688 2100.pp
2fb78b49
EA
2101The
2102.b $#
2103syntax should
2104.i only
2105be used in ruleset zero.
2106It causes evaluation of the ruleset to terminate immediately,
2107and signals to sendmail that the address has completely resolved.
2108The complete syntax is:
631e7688 2109.(b
2fb78b49 2110\fB$#\fP\fImailer\fP\fB$@\fP\fIhost\fP\fB$:\fP\fIuser\fP
631e7688 2111.)b
2fb78b49
EA
2112This specifies the
2113{mailer, host, user}
21143-tuple necessary to direct the mailer.
2115If the mailer is local
2116the host part may be omitted.
2117The
2118.i mailer
2119and
2120.i host
2121must be a single word,
2122but the
2123.i user
2124may be multi-part.
2125.pp
28719ec2 2126A RHS may also be preceded by a
2fb78b49
EA
2127.b $@
2128or a
2129.b $:
2130to control evaluation.
2131A
2132.b $@
2133prefix causes the ruleset to return with the remainder of the RHS
2134as the value.
2135A
2136.b $:
2137prefix causes the rule to terminate immediately,
2138but the ruleset to continue;
2139this can be used to avoid continued application of a rule.
2140The prefix is stripped before continuing.
2141.pp
2142The
2143.b $@
2144and
2145.b $:
28719ec2 2146prefixes may precede a
2fb78b49
EA
2147.b $>
2148spec;
2149for example:
631e7688 2150.(b
2fb78b49
EA
2151.ta 8n
2152R$+ $:$>7$1
631e7688 2153.)b
2fb78b49
EA
2154matches anything,
2155passes that to ruleset seven,
2156and continues;
631e7688 2157the
2fb78b49
EA
2158.b $:
2159is necessary to avoid an infinite loop.
9b1ebb21
EA
2160.pp
2161Substitution occurs in the order described,
2162that is,
2163parameters from the LHS are substituted,
2164hostnames are canonicalized,
2165.q subroutines
2166are called,
2167and finally
2168.b $# ,
2169.b $@ ,
2170and
2171.b $:
2172are processed.
2fb78b49 2173.sh 3 "Semantics of rewriting rule sets"
631e7688 2174.pp
2fb78b49
EA
2175There are five rewriting sets
2176that have specific semantics.
2177These are related as depicted by figure 2.
2178.(z
2179.hl
8ca4ce88 2180.ie n \{\
3702dbcc 2181.(c
2fb78b49
EA
2182 +---+
2183 -->| 0 |-->resolved address
2184 / +---+
2185 / +---+ +---+
2186 / ---->| 1 |-->| S |--
2187 +---+ / +---+ / +---+ +---+ \e +---+
2188addr-->| 3 |-->| D |-- --->| 4 |-->msg
2189 +---+ +---+ \e +---+ +---+ / +---+
2190 --->| 2 |-->| R |--
2191 +---+ +---+
2192.)c
2193
8ca4ce88
EA
2194.\}
2195.el .ie !"\*(.T"" \
2196\{\
2197.PS
2198boxwid = 0.3i
2199boxht = 0.3i
2200movewid = 0.3i
2201moveht = 0.3i
2202linewid = 0.3i
2203lineht = 0.3i
2204
2205 box invis "addr"; arrow
2206Box3: box "3"
2207A1: arrow
2208BoxD: box "D"; line; L1: Here
2209C: [
2210 C1: arrow; box "1"; arrow; box "S"; line; E1: Here
2211 move to C1 down 0.5; right
2212 C2: arrow; box "2"; arrow; box "R"; line; E2: Here
2213 ] with .w at L1 + (0.5, 0)
2214 move to C.e right 0.5
2215L4: arrow; box "4"; arrow; box invis "msg"
2216 line from L1 to C.C1
2217 line from L1 to C.C2
2218 line from C.E1 to L4
2219 line from C.E2 to L4
2220 move to BoxD.n up 0.6; right
2221Box0: arrow; box "0"
2222 arrow; box invis "resolved address" width 1.3
2223 line from 1/3 of the way between A1 and BoxD.w to Box0
2224.PE
2225.\}
2226.el .sp 2i
2fb78b49
EA
2227.ce
2228Figure 2 \*- Rewriting set semantics
2229.(c
2230D \*- sender domain addition
2231S \*- mailer-specific sender rewriting
2232R \*- mailer-specific recipient rewriting
2233.)c
2fb78b49
EA
2234.hl
2235.)z
631e7688 2236.pp
2fb78b49
EA
2237Ruleset three
2238should turn the address into
2239.q "canonical form."
2240This form should have the basic syntax:
631e7688 2241.(b
2fb78b49 2242local-part@host-domain-spec
631e7688 2243.)b
2fb78b49
EA
2244If no
2245.q @
2246sign is specified,
2247then the
2248host-domain-spec
2249.i may
2250be appended from the
2251sender address
2252(if the
2253.b C
2254flag is set in the mailer definition
2255corresponding to the
2256.i sending
2257mailer).
2258Ruleset three
2259is applied by sendmail
2260before doing anything with any address.
2261.pp
2262Ruleset zero
2263is applied after ruleset three
2264to addresses that are going to actually specify recipients.
2265It must resolve to a
2266.i "{mailer, host, user}"
2267triple.
2268The
2269.i mailer
2270must be defined in the mailer definitions
2271from the configuration file.
2272The
2273.i host
2274is defined into the
2275.b $h
2276macro
2277for use in the argv expansion of the specified mailer.
2278.pp
2279Rulesets one and two
2280are applied to all sender and recipient addresses respectively.
2281They are applied before any specification
2282in the mailer definition.
2283They must never resolve.
2284.pp
2285Ruleset four is applied to all addresses
2286in the message.
2287It is typically used
2288to translate internal to external form.
2289.sh 3 "Mailer flags etc."
2290.pp
7a316267
EA
2291There are a number of flags that may be associated with each mailer,
2292each identified by a letter of the alphabet.
2293Many of them are assigned semantics internally.
2fb78b49 2294These are detailed in Appendix C.
7a316267
EA
2295Any other flags may be used freely
2296to conditionally assign headers to messages
2297destined for particular mailers.
b66b7f9a
EA
2298.sh 3 "The \*(lqerror\*(rq mailer"
2299.pp
2300The mailer with the special name
2301.q error
2302can be used to generate a user error.
2303The (optional) host field is a numeric exit status to be returned,
2304and the user field is a message to be printed.
2305For example, the entry:
2306.(b
2307$#error$:Host unknown in this domain
2308.)b
2309on the RHS of a rule
2310will cause the specified error to be generated
2311if the LHS matches.
2312This mailer is only functional in ruleset zero.
2fb78b49
EA
2313.sh 2 "Building a Configuration File From Scratch"
2314.pp
2315Building a configuration table from scratch is an extremely difficult job.
2316Fortunately,
2317it is almost never necessary to do so;
2318nearly every situation that may come up
2319may be resolved by changing an existing table.
2320In any case,
2321it is critical that you understand what it is that you are trying to do
2322and come up with a philosophy for the configuration table.
2323This section is intended to explain what the real purpose
2324of a configuration table is
2325and to give you some ideas
2326for what your philosophy might be.
2327.sh 3 "What you are trying to do"
2328.pp
2329The configuration table has three major purposes.
2330The first and simplest
2331is to set up the environment for
2332.i sendmail .
2333This involves setting the options,
2334defining a few critical macros,
2335etc.
2336Since these are described in other places,
2337we will not go into more detail here.
631e7688 2338.pp
2fb78b49
EA
2339The second purpose is to rewrite addresses in the message.
2340This should typically be done in two phases.
2341The first phase maps addresses in any format
2342into a canonical form.
2343This should be done in ruleset three.
2344The second phase maps this canonical form
2345into the syntax appropriate for the receiving mailer.
2346.i Sendmail
2347does this in three subphases.
2348Rulesets one and two
2349are applied to all sender and recipient addresses respectively.
2350After this,
2351you may specify per-mailer rulesets
2352for both sender and recipient addresses;
2353this allows mailer-specific customization.
631e7688 2354Finally,
2fb78b49
EA
2355ruleset four is applied to do any default conversion
2356to external form.
631e7688 2357.pp
2fb78b49
EA
2358The third purpose
2359is to map addresses into the actual set of instructions
2360necessary to get the message delivered.
2361Ruleset zero must resolve to the internal form,
2362which is in turn used as a pointer to a mailer descriptor.
2363The mailer descriptor describes the interface requirements
2364of the mailer.
2365.sh 3 "Philosophy"
4da134f8 2366.pp
2fb78b49
EA
2367The particular philosophy you choose will depend heavily
2368on the size and structure of your organization.
2369I will present a few possible philosophies here.
4da134f8 2370.pp
2fb78b49
EA
2371One general point applies to all of these philosophies:
2372it is almost always a mistake
2373to try to do full name resolution.
4da134f8 2374For example,
2fb78b49
EA
2375if you are trying to get names of the form
2376.q user@host
2377to the Arpanet,
2378it does not pay to route them to
2379.q xyzvax!decvax!ucbvax!c70:user@host
2380since you then depend on several links not under your control.
2381The best approach to this problem
2382is to simply forward to
2383.q xyzvax!user@host
2384and let xyzvax
2385worry about it from there.
2386In summary,
2387just get the message closer to the destination,
2388rather than determining the full path.
2389.sh 4 "Large site, many hosts \*- minimum information"
4da134f8 2390.pp
2fb78b49 2391Berkeley is an example of a large site,
28719ec2
JB
2392i.e., more than two or three hosts
2393and multiple mail connections.
2fb78b49
EA
2394We have decided that the only reasonable philosophy
2395in our environment
2396is to designate one host as the guru for our site.
2397It must be able to resolve any piece of mail it receives.
2398The other sites should have the minimum amount of information
2399they can get away with.
2400In addition,
2401any information they do have
2402should be hints rather than solid information.
4da134f8 2403.pp
2fb78b49
EA
2404For example,
2405a typical site on our local ether network is
2406.q monet.
28719ec2 2407When monet receives mail for delivery,
318b7556
EA
2408it checks whether it knows
2409that the destination host is directly reachable;
28719ec2 2410if so, mail is sent to that host.
2fb78b49
EA
2411If it receives mail for any unknown host,
2412it just passes it directly to
2413.q ucbvax,
2414our master host.
2415Ucbvax may determine that the host name is illegal
2416and reject the message,
2417or may be able to do delivery.
28719ec2 2418However, it is important to note that when a new mail connection is added,
2fb78b49
EA
2419the only host that
2420.i must
2421have its tables updated
2422is ucbvax;
2423the others
2424.i may
28719ec2 2425be updated if convenient,
2fb78b49
EA
2426but this is not critical.
2427.pp
2428This picture is slightly muddied
2429due to network connections that are not actually located
2430on ucbvax.
2431For example,
28719ec2 2432some UUCP connections are currently on
2fb78b49 2433.q ucbarpa.
4da134f8 2434However,
2fb78b49
EA
2435monet
2436.i "does not"
2437know about this;
2438the information is hidden totally between ucbvax and ucbarpa.
28719ec2
JB
2439Mail going from monet to a UUCP host
2440is transferred via the ethernet
2fb78b49
EA
2441from monet to ucbvax,
2442then via the ethernet from ucbvax to ucbarpa,
28719ec2 2443and then is submitted to UUCP.
2fb78b49
EA
2444Although this involves some extra hops,
2445we feel this is an acceptable tradeoff.
4da134f8 2446.pp
2fb78b49
EA
2447An interesting point is that it would be possible
2448to update monet
28719ec2 2449to send appropriate UUCP mail directly to ucbarpa
2fb78b49 2450if the load got too high;
28719ec2 2451if monet failed to note a host as connected to ucbarpa
2fb78b49
EA
2452it would go via ucbvax as before,
2453and if monet incorrectly sent a message to ucbarpa
2454it would still be sent by ucbarpa
2455to ucbvax as before.
2456The only problem that can occur is loops,
318b7556
EA
2457for example,
2458if ucbarpa thought that ucbvax had the UUCP connection
2fb78b49
EA
2459and vice versa.
2460For this reason,
2461updates should
2462.i always
2463happen to the master host first.
4da134f8 2464.pp
2fb78b49
EA
2465This philosophy results as much from the need
2466to have a single source for the configuration files
2467(typically built using
74b6e641 2468.i m4 \|(1)
2fb78b49
EA
2469or some similar tool)
2470as any logical need.
2471Maintaining more than three separate tables by hand
2472is essentially an impossible job.
2473.sh 4 "Small site \*- complete information"
2474.pp
2475A small site
28719ec2 2476(two or three hosts and few external connections)
2fb78b49
EA
2477may find it more reasonable to have complete information
2478at each host.
2479This would require that each host
2480know exactly where each network connection is,
2481possibly including the names of each host on that network.
2482As long as the site remains small
2483and the the configuration remains relatively static,
2484the update problem will probably not be too great.
2485.sh 4 "Single host"
2486.pp
2487This is in some sense the trivial case.
2488The only major issue is trying to insure that you don't
2489have to know too much about your environment.
69a914e1 2490For example,
2fb78b49
EA
2491if you have a UUCP connection
2492you might find it useful to know about the names of hosts
2493connected directly to you,
2494but this is really not necessary
2495since this may be determined from the syntax.
2496.sh 3 "Relevant issues"
4da134f8 2497.pp
2fb78b49
EA
2498The canonical form you use
2499should almost certainly be as specified in
2500the Arpanet protocols
2501RFC819 and RFC822.
2502Copies of these RFC's are included on the
4da134f8 2503.i sendmail
2fb78b49
EA
2504tape
2505as
2506.i doc/rfc819.lpr
2507and
2508.i doc/rfc822.lpr .
2509.pp
2510RFC822
2511describes the format of the mail message itself.
2512.i Sendmail
2513follows this RFC closely,
2514to the extent that many of the standards described in this document
2515can not be changed without changing the code.
2516In particular,
2517the following characters have special interpretations:
4da134f8 2518.(b
2fb78b49 2519< > ( ) " \e
4da134f8 2520.)b
2fb78b49
EA
2521Any attempt to use these characters for other than their RFC822
2522purpose in addresses is probably doomed to disaster.
2523.pp
2524RFC819
2525describes the specifics of the domain-based addressing.
2526This is touched on in RFC822 as well.
2527Essentially each host is given a name
2528which is a right-to-left dot qualified pseudo-path
2529from a distinguished root.
2530The elements of the path need not be physical hosts;
2531the domain is logical rather than physical.
2532For example,
2533at Berkeley
28719ec2 2534one legal host might be
367a5dcd 2535.q a.CC.Berkeley.EDU ;
2fb78b49 2536reading from right to left,
367a5dcd 2537.q EDU
2fb78b49 2538is a top level domain
367a5dcd
EA
2539comprising educational institutions,
2540.q Berkeley
2541is a logical domain name,
2542.q CC
2fb78b49
EA
2543represents the Computer Center,
2544(in this case a strictly logical entity),
2545and
2546.q a
367a5dcd 2547is a host in the Computer Center.
4da134f8 2548.pp
2fb78b49
EA
2549Beware when reading RFC819
2550that there are a number of errors in it.
2551.sh 3 "How to proceed"
4da134f8 2552.pp
2fb78b49
EA
2553Once you have decided on a philosophy,
2554it is worth examining the available configuration tables
2555to decide if any of them are close enough
2556to steal major parts of.
2557Even under the worst of conditions,
2558there is a fair amount of boiler plate that can be collected safely.
4da134f8 2559.pp
2fb78b49
EA
2560The next step is to build ruleset three.
2561This will be the hardest part of the job.
2562Beware of doing too much to the address in this ruleset,
2563since anything you do will reflect through
2564to the message.
2565In particular,
2566stripping of local domains is best deferred,
2567since this can leave you with addresses with no domain spec at all.
2568Since
2569.i sendmail
2570likes to append the sending domain to addresses with no domain,
2571this can change the semantics of addresses.
2572Also try to avoid
2573fully qualifying domains in this ruleset.
2574Although technically legal,
2575this can lead to unpleasantly and unnecessarily long addresses
2576reflected into messages.
2577The Berkeley configuration files
2578define ruleset nine
2579to qualify domain names and strip local domains.
2580This is called from ruleset zero
2581to get all addresses into a cleaner form.
4da134f8 2582.pp
2fb78b49
EA
2583Once you have ruleset three finished,
2584the other rulesets should be relatively trivial.
2585If you need hints,
2586examine the supplied configuration tables.
2587.sh 3 "Testing the rewriting rules \*- the \-bt flag"
4da134f8 2588.pp
2fb78b49
EA
2589When you build a configuration table,
2590you can do a certain amount of testing
2591using the
2592.q "test mode"
2593of
2594.i sendmail .
2595For example,
2596you could invoke
4da134f8 2597.i sendmail
2fb78b49
EA
2598as:
2599.(b
2600sendmail \-bt \-Ctest.cf
2601.)b
2602which would read the configuration file
2603.q test.cf
2604and enter test mode.
2605In this mode,
2606you enter lines of the form:
2607.(b
2608rwset address
2609.)b
2610where
2611.i rwset
2612is the rewriting set you want to use
4da134f8 2613and
2fb78b49
EA
2614.i address
2615is an address to apply the set to.
2616Test mode shows you the steps it takes
2617as it proceeds,
2618finally showing you the address it ends up with.
2619You may use a comma separated list of rwsets
2620for sequential application of rules to an input;
2621ruleset three is always applied first.
2622For example:
2623.(b
26241,21,4 monet:bollard
2625.)b
2626first applies ruleset three to the input
2627.q monet:bollard.
2628Ruleset one is then applied to the output of ruleset three,
2629followed similarly by rulesets twenty-one and four.
4da134f8 2630.pp
2fb78b49
EA
2631If you need more detail,
2632you can also use the
2633.q \-d21
2634flag to turn on more debugging.
2635For example,
4da134f8 2636.(b
2fb78b49 2637sendmail \-bt \-d21.99
4da134f8 2638.)b
2fb78b49
EA
2639turns on an incredible amount of information;
2640a single word address
2641is probably going to print out several pages worth of information.
2642.sh 3 "Building mailer descriptions"
4da134f8 2643.pp
2fb78b49
EA
2644To add an outgoing mailer to your mail system,
2645you will have to define the characteristics of the mailer.
2646.pp
0a9ea158
EA
2647Each mailer must have an internal name.
2648This can be arbitrary,
2649except that the names
2650.q local
2651and
2652.q prog
2653must be defined.
2fb78b49 2654.pp
0a9ea158 2655The pathname of the mailer must be given in the P field.
2fb78b49
EA
2656If this mailer should be accessed via an IPC connection,
2657use the string
2658.q [IPC]
2659instead.
2660.pp
0a9ea158 2661The F field defines the mailer flags.
2fb78b49
EA
2662You should specify an
2663.q f
2664or
2665.q r
2666flag to pass the name of the sender as a
2667.b \-f
2668or
2669.b \-r
2670flag respectively.
2671These flags are only passed if they were passed to
2672.i sendmail,
2673so that mailers that give errors under some circumstances
2674can be placated.
2675If the mailer is not picky
2676you can just specify
2677.q "\-f $g"
2678in the argv template.
2679If the mailer must be called as
2680.b root
2681the
2682.q S
2683flag should be given;
2684this will not reset the userid
2685before calling the mailer\**.
2686.(f
2687\**\c
2688.i Sendmail
2689must be running setuid to root
2690for this to work.
2691.)f
2692If this mailer is local
2693(i.e., will perform final delivery
2694rather than another network hop)
2695the
2696.q l
2697flag should be given.
2698Quote characters
2699(backslashes and " marks)
2700can be stripped from addresses if the
2701.q s
2702flag is specified;
2703if this is not given
2704they are passed through.
2705If the mailer is capable of sending to more than one user
2706on the same host
2707in a single transaction
2708the
2709.q m
2710flag should be stated.
2711If this flag is on,
2712then the argv template containing
2713.b $u
2714will be repeated for each unique user
2715on a given host.
2716The
2717.q e
2718flag will mark the mailer as being
2719.q expensive,
2720which will cause
631e7688 2721.i sendmail
2fb78b49 2722to defer connection
74b6e641 2723until a queue run\**.
2fb78b49
EA
2724.(f
2725\**The
2726.q c
2727configuration option must be given
2728for this to be effective.
2729.)f
4da134f8 2730.pp
2fb78b49
EA
2731An unusual case is the
2732.q C
4da134f8 2733flag.
2fb78b49
EA
2734This flag applies to the mailer that the message is received from,
2735rather than the mailer being sent to;
2736if set,
2737the domain spec of the sender
2738(i.e., the
2739.q @host.domain
2740part)
2741is saved
2742and is appended to any addresses in the message
2743that do not already contain a domain spec.
2744For example,
2745a message of the form:
4da134f8 2746.(b
2fb78b49
EA
2747From: eric@ucbarpa
2748To: wnj@monet, mckusick
4da134f8 2749.)b
2fb78b49 2750will be modified to:
4da134f8 2751.(b
2fb78b49
EA
2752From: eric@ucbarpa
2753To: wnj@monet, mckusick@ucbarpa
4da134f8 2754.)b
2fb78b49
EA
2755.i "if and only if"
2756the
2757.q C
2758flag is defined in the mailer corresponding to
2759.q eric@ucbarpa.
4da134f8 2760.pp
2fb78b49
EA
2761Other flags are described
2762in Appendix C.
2763.pp
0a9ea158 2764The S and R fields in the mailer description
2fb78b49
EA
2765are per-mailer rewriting sets
2766to be applied to sender and recipient addresses
2767respectively.
2768These are applied after the sending domain is appended
2769and the general rewriting sets
2770(numbers one and two)
2771are applied,
2772but before the output rewrite
2773(ruleset four)
2774is applied.
2775A typical use is to append the current domain
2776to addresses that do not already have a domain.
2777For example,
2778a header of the form:
4da134f8 2779.(b
2fb78b49 2780From: eric
4da134f8 2781.)b
2fb78b49 2782might be changed to be:
4da134f8 2783.(b
2fb78b49 2784From: eric@ucbarpa
4da134f8 2785.)b
2fb78b49
EA
2786or
2787.(b
2788From: ucbvax!eric
2789.)b
2790depending on the domain it is being shipped into.
2791These sets can also be used
2792to do special purpose output rewriting
2793in cooperation with ruleset four.
4da134f8 2794.pp
0a9ea158
EA
2795The E field defines the string to use
2796as an end-of-line indication.
2797A string containing only newline is the default.
2798The usual backslash escapes
2799(\er, \en, \ef, \eb)
2800may be used.
2801.pp
2fb78b49 2802Finally,
0a9ea158 2803an argv template is given as the E field.
2fb78b49
EA
2804It may have embedded spaces.
2805If there is no argv with a
2806.b $u
2807macro in it,
2808.i sendmail
2809will speak SMTP
2810to the mailer.
2811If the pathname for this mailer is
2812.q [IPC],
2813the argv should be
4da134f8 2814.(b
2fb78b49 2815IPC $h [ \fIport\fP ]
4da134f8 2816.)b
2fb78b49
EA
2817where
2818.i port
2819is the optional port number
2820to connect to.
4da134f8 2821.pp
4da134f8 2822For example,
2fb78b49 2823the specifications:
4da134f8 2824.(b
7a316267
EA
2825.ta \w'Mlocal, 'u +\w'P=/bin/mail, 'u +\w'F=rlsm, 'u +\w'S=10, 'u +\w'R=20, 'u
2826Mlocal, P=/bin/mail, F=rlsm S=10, R=20, A=mail \-d $u
2827Mether, P=[IPC], F=meC, S=11, R=21, A=IPC $h, M=100000
4da134f8 2828.)b
2fb78b49
EA
2829specifies a mailer to do local delivery
2830and a mailer for ethernet delivery.
2831The first is called
2832.q local,
2833is located in the file
2834.q /bin/mail,
2835takes a picky
2836.b \-r
2837flag,
2838does local delivery,
2839quotes should be stripped from addresses,
2840and multiple users can be delivered at once;
2841ruleset ten
2842should be applied to sender addresses in the message
2843and ruleset twenty
2844should be applied to recipient addresses;
2845the argv to send to a message will be the word
2846.q mail,
2847the word
2848.q \-d,
2849and words containing the name of the receiving user.
2850If a
2851.b \-r
2852flag is inserted
2853it will be between the words
2854.q mail
2855and
2856.q \-d.
2857The second mailer is called
2858.q ether,
2859it should be connected to via an IPC connection,
2860it can handle multiple users at once,
2861connections should be deferred,
2862and any domain from the sender address
2863should be appended to any receiver name
2864without a domain;
2865sender addresses should be processed by ruleset eleven
2866and recipient addresses by ruleset twenty-one.
7a316267 2867There is a 100,000 byte limit on messages passed through this mailer.
4da134f8 2868.++ A
631e7688 2869.+c "COMMAND LINE FLAGS"
4da134f8 2870.ba 0
69a914e1 2871.nr ii 1i
4da134f8
EA
2872.pp
2873Arguments must be presented with flags before addresses.
2874The flags are:
4da134f8
EA
2875.ip "\-f\ \fIaddr\fP"
2876The sender's machine address is
2877.i addr .
2878This flag is ignored unless the real user
2879is listed as a
2880.q "trusted user"
2881or if
2882.i addr
2883contains an exclamation point
2884(because of certain restrictions in UUCP).
2885.ip "\-r\ \fIaddr\fP"
2886An obsolete form of
2887.b \-f .
2888.ip "\-h\ \fIcnt\fP"
2889Sets the
2890.q "hop count"
2891to
2892.i cnt .
2893This represents the number of times this message has been processed
2894by
2895.i sendmail
2896(to the extent that it is supported by the underlying networks).
2897.i Cnt
2898is incremented during processing,
2899and if it reaches
2900MAXHOP
2901(currently 30)
2902.i sendmail
2903throws away the message with an error.
2904.ip \-F\fIname\fP
2905Sets the full name of this user to
2906.i name .
2907.ip \-n
2908Don't do aliasing or forwarding.
2909.ip \-t
2910Read the header for
2911.q To: ,
2912.q Cc: ,
2913and
2914.q Bcc:
2915lines, and send to everyone listed in those lists.
2916The
2917.q Bcc:
2918line will be deleted before sending.
2919Any addresses in the argument vector will be deleted
2920from the send list.
6362a767
EA
2921.ip \-b\fIx\fP
2922Set operation mode to
2923.i x .
2924Operation modes are:
2925.(b
2926.ta 4n
2927m Deliver mail (default)
2928a Run in arpanet mode (see below)
2929s Speak SMTP on input side
2930d Run as a daemon
2931t Run in test mode
2932v Just verify addresses, don't collect or deliver
2933i Initialize the alias database
2934p Print the mail queue
2935z Freeze the configuration file
2936.)b
2937The special processing for the
2938ARPANET
2939includes reading the
4da134f8
EA
2940.q "From:"
2941line from the header to find the sender,
2942printing
2943ARPANET
2944style messages
2945(preceded by three digit reply codes for compatibility with
2946the FTP protocol
2947[Neigus73, Postel74, Postel77]),
2948and ending lines of error messages with <CRLF>.
4da134f8 2949.ip \-q\fItime\fP
69a914e1 2950Try to process the queued up mail.
4da134f8
EA
2951If the time is given,
2952a sendmail will run through the queue at the specified interval
2953to deliver queued mail;
2954otherwise, it only runs once.
2955.ip \-C\fIfile\fP
2956Use a different configuration file.
9b1ebb21
EA
2957.i Sendmail
2958runs as the invoking user (rather than root)
2959when this flag is specified.
4da134f8
EA
2960.ip \-d\fIlevel\fP
2961Set debugging level.
2962.ip \-o\fIx\|value\fP
2963Set option
2964.i x
2965to the specified
2966.i value .
2967These options are described in Appendix B.
2968.pp
2969There are a number of options that may be specified as
6362a767
EA
2970primitive flags
2971(provided for compatibility with
2972.i delivermail ).
2973These are the e, i, m, and v options.
4da134f8
EA
2974Also,
2975the f option
2976may be specified as the
2977.b \-s
2978flag.
631e7688 2979.+c "CONFIGURATION OPTIONS"
4da134f8
EA
2980.pp
2981The following options may be set using the
2982.b \-o
2983flag on the command line
2984or the
2985.b O
9b1ebb21
EA
2986line in the configuration file.
2987Many of them cannot be specified unless the invoking user is trusted.
74b6e641 2988.nr ii 1i
4da134f8
EA
2989.ip A\fIfile\fP
2990Use the named
2991.i file
2992as the alias file.
2993If no file is specified,
2994use
2995.i aliases
2996in the current directory.
9b1ebb21 2997.ip a\fIN\fP
631e7688 2998If set,
9b1ebb21
EA
2999wait up to
3000.i N
3001minutes for an
631e7688
EA
3002.q @:@
3003entry to exist in the alias database
3004before starting up.
9b1ebb21
EA
3005If it does not appear in
3006.i N
3007minutes,
3008rebuild the database
3009(if the
3010.b D
3011option is also set)
3012or issue a warning.
3013.ip B\fIc\fP
3014Set the blank substitution character to
3015.i c .
3016Unquoted spaces in addresses are replaced by this character.
4da134f8 3017.ip c
69a914e1 3018If an outgoing mailer is marked as being expensive,
4da134f8
EA
3019don't connect immediately.
3020This requires that queueing be compiled in,
69a914e1 3021since it will depend on a queue run process to
4da134f8 3022actually send the mail.
6362a767
EA
3023.ip d\fIx\fP
3024Deliver in mode
3025.i x .
3026Legal modes are:
3027.(b
3028.ta 4n
3029i Deliver interactively (synchronously)
3030b Deliver in background (asynchronously)
3031q Just queue the message (deliver during queue run)
3032.)b
b16e27c4
EA
3033.ip D
3034If set,
3035rebuild the alias database if necessary and possible.
3036If this option is not set,
3037.i sendmail
3038will never rebuild the alias database
3039unless explicitly requested
3040using
3041.b \-bi .
4da134f8
EA
3042.ip e\fIx\fP
3043Dispose of errors using mode
3044.i x .
3045The values for
3046.i x
3047are:
3048.(b
3049p Print error messages (default)
3050q No messages, just give exit status
3051m Mail back errors
3052w Write back errors (mail if user not logged in)
3053e Mail back errors and give zero exit stat always
3054.)b
3055.ip f
3056Save
3057Unix-style
3058.q From
3059lines at the front of headers.
3060Normally they are assumed redundant
3061and discarded.
3062.ip g\fIn\fP
3063Set the default group id
3064for mailers to run in
3065to
3066.i n .
3067.ip H\fIfile\fP
3068Specify the help file
3069for SMTP.
f3e184c1
EA
3070.ip I
3071Insist that the BIND name server be running
3072to resolve host names.
3073If this is not set and the name server is not running,
3074the
3075.i /etc/hosts
3076file will be considered complete.
3077In general, you do want to set this option
3078if your
3079.i /etc/hosts
3080file does not include all hosts known to you
3081or if you are using the MX (mail forwarding) feature of the BIND name server.
3082The name server will still be consulted
3083even if this option is not set, but
3084.i sendmail
3085will feel free to resort to reading
3086.i /etc/hosts
3087if the name server is not available.
3088Thus, you should
3089.i never
3090set this option if you do not run the name server.
4da134f8
EA
3091.ip i
3092Ignore dots in incoming messages.
3093.ip L\fIn\fP
3094Set the default log level to
3095.i n .
3096.ip M\fIx\|value\fP
3097Set the macro
3098.i x
3099to
3100.i value .
69a914e1 3101This is intended only for use from the command line.
4da134f8
EA
3102.ip m
3103Send to me too,
3104even if I am in an alias expansion.
53cac5c2
EA
3105.ip N\fInetname\fP
3106The name of the home network;
3107.q ARPA
3108by default.
3109The the argument of an SMTP
3110.q HELO
3111command is checked against
3112.q hostname.netname
3113where
3114.i hostname
3115is requested from the kernel for the current connection.
3116If they do not match,
3117.q Received:
3118lines are augmented by the name that is determined in this manner
3119so that messages can be traced accurately.
4da134f8 3120.ip o
69a914e1 3121Assume that the headers may be in old format,
4da134f8 3122i.e.,
69a914e1
EA
3123spaces delimit names.
3124This actually turns on
3125an adaptive algorithm:
4da134f8
EA
3126if any recipient address contains a comma, parenthesis,
3127or angle bracket,
3128it will be assumed that commas already exist.
69a914e1
EA
3129If this flag is not on,
3130only commas delimit names.
4da134f8
EA
3131Headers are always output with commas between the names.
3132.ip Q\fIdir\fP
3133Use the named
3134.i dir
3135as the queue directory.
8de17835
EA
3136.ip q\fIfactor\fP
3137Use
3138.i factor
3139as the multiplier in the map function
3140to decide when to just queue up jobs rather than run them.
3141This value is divided by the difference between the current load average
3142and the load average limit
3143(\c
3144.b x
3145flag)
3146to determine the maximum message priority
3147that will be sent.
3148Defaults to 10000.
4da134f8
EA
3149.ip r\fItime\fP
3150Timeout reads after
3151.i time
3152interval.
3153.ip S\fIfile\fP
3154Log statistics in the named
3155.i file .
3156.ip s
3157Be super-safe when running things,
3158i.e.,
3159always instantiate the queue file,
3160even if you are going to attempt immediate delivery.
3161.i Sendmail
3162always instantiates the queue file
3163before returning control the the client
3164under any circumstances.
3165.ip T\fItime\fP
3166Set the queue timeout to
3167.i time .
3168After this interval,
3169messages that have not been successfully sent
3170will be returned to the sender.
3171.ip t\fIS,D\fP
28719ec2 3172Set the local time zone name to
4da134f8
EA
3173.i S
3174for standard time and
3175.i D
3176for daylight time;
3177this is only used under version six.
3178.ip u\fIn\fP
3179Set the default userid for mailers to
3180.i n .
3181Mailers without the
0a9ea158 3182.i S
4da134f8
EA
3183flag in the mailer definition
3184will run as this user.
3185.ip v
3186Run in verbose mode.
9b1ebb21
EA
3187.ip x\fILA\fP
3188When the system load average exceeds
3189.i LA ,
3190just queue messages
3191(i.e., don't try to send them).
3192.ip X\fILA\fP
3193When the system load average exceeds
3194.i LA ,
3195refuse incoming SMTP connections.
1ef34914
EA
3196.ip y\fIfact\fP
3197The indicated
3198.i fact or
3199is added to the priority (thus
3200.i lowering
3201the priority of the job)
3202for each recipient,
3203i.e., this value penalizes jobs with large numbers of recipients.
3204.ip Y
8de17835
EA
3205If set,
3206deliver each job that is run from the queue in a separate process.
3207Use this option if you are short of memory,
3208since the default tends to consume considerable amounts of memory
3209while the queue is being processed.
1ef34914
EA
3210.ip z\fIfact\fP
3211The indicated
3212.i fact or
3213is multiplied by the message class
3214(determined by the Precedence: field in the user header
3215and the
3216.b P
3217lines in the configuration file)
3218and subtracted from the priority.
3219Thus, messages with a higher Priority: will be favored.
3220.ip Z\fIfact\fP
3221The
3222.i fact or
3223is added to the priority
3224every time a job is processed.
3225Thus,
3226each time a job is processed,
3227its priority will be decreased by the indicated value.
3228In most environments this should be positive,
3229since hosts that are down are all too often down for a long time.
631e7688
EA
3230.+c "MAILER FLAGS"
3231The following flags may be set in the mailer description.
74b6e641 3232.nr ii 4n
631e7688
EA
3233.ip f
3234The mailer wants a
3235.b \-f
3236.i from
3237flag,
3238but only if this is a network forward operation
3239(i.e.,
3240the mailer will give an error
3241if the executing user
3242does not have special permissions).
3243.ip r
3244Same as
3245.b f ,
3246but sends a
3247.b \-r
3248flag.
631e7688
EA
3249.ip S
3250Don't reset the userid
3251before calling the mailer.
3252This would be used in a secure environment
3253where
3254.i sendmail
3255ran as root.
3256This could be used to avoid forged addresses.
3257This flag is suppressed if given from an
3258.q unsafe
3259environment
3260(e.g, a user's mail.cf file).
3261.ip n
3262Do not insert a UNIX-style
3263.q From
3264line on the front of the message.
3265.ip l
3266This mailer is local
3267(i.e.,
3268final delivery will be performed).
3269.ip s
3270Strip quote characters off of the address
3271before calling the mailer.
3272.ip m
3273This mailer can send to multiple users
3274on the same host
3275in one transaction.
3276When a
3277.b $u
3278macro occurs in the
3279.i argv
3280part of the mailer definition,
3281that field will be repeated as necessary
3282for all qualifying users.
3283.ip F
3284This mailer wants a
3285.q From:
3286header line.
3287.ip D
3288This mailer wants a
3289.q Date:
3290header line.
3291.ip M
3292This mailer wants a
3293.q Message-Id:
3294header line.
3295.ip x
3296This mailer wants a
3297.q Full-Name:
3298header line.
2fb78b49
EA
3299.ip P
3300This mailer wants a
3301.q Return-Path:
3302line.
631e7688
EA
3303.ip u
3304Upper case should be preserved in user names
3305for this mailer.
3306.ip h
3307Upper case should be preserved in host names
3308for this mailer.
3309.ip A
3310This is an Arpanet-compatible mailer,
3311and all appropriate modes should be set.
3312.ip U
3313This mailer wants Unix-style
3314.q From
3315lines with the ugly UUCP-style
3316.q "remote from <host>"
3317on the end.
3318.ip e
3319This mailer is expensive to connect to,
3320so try to avoid connecting normally;
3321any necessary connection will occur during a queue run.
3322.ip X
fa8fc495
EA
3323This mailer want to use the hidden dot algorithm
3324as specified in RFC821;
3325basically,
3326any line beginning with a dot
3327will have an extra dot prepended
3328(to be stripped at the other end).
3329This insures that lines in the message containing a dot
3330will not terminate the message prematurely.
3331.ip L
3332Limit the line lengths as specified in RFC821.
fa8fc495
EA
3333.ip P
3334Use the return-path in the SMTP
3335.q "MAIL FROM:"
3336command
3337rather than just the return address;
3338although this is required in RFC821,
3339many hosts do not process return paths properly.
2fb78b49
EA
3340.ip I
3341This mailer will be speaking SMTP
3342to another
3343.i sendmail
3344\*-
3345as such it can use special protocol features.
3346This option is not required
3347(i.e.,
3348if this option is omitted the transmission will still operate successfully,
3349although perhaps not as efficiently as possible).
631e7688
EA
3350.ip C
3351If mail is
3352.i received
3353from a mailer with this flag set,
3354any addresses in the header that do not have an at sign
3355(\c
3356.q @ )
3357after being rewritten by ruleset three
3358will have the
3359.q @domain
3360clause from the sender
3361tacked on.
3362This allows mail with headers of the form:
3363.(b
3364From: usera@hosta
3365To: userb@hostb, userc
3366.)b
3367to be rewritten as:
3368.(b
3369From: usera@hosta
3370To: userb@hostb, userc@hosta
3371.)b
3372automatically.
9b1ebb21
EA
3373.ip E
3374Escape lines beginning with
3375.q From
3376in the message with a `>' sign.
4da134f8 3377.+c "OTHER CONFIGURATION"
69a914e1 3378.rm $0
b16e27c4 3379.nr ii 1i
4da134f8
EA
3380.pp
3381There are some configuration changes that can be made by
3382recompiling
3383.i sendmail .
18843c53 3384These are located in two places:
bff69eb1 3385.ip src/conf.h
b16e27c4
EA
3386Configuration parameters that may be tweaked by the installer
3387are included in conf.h.
bff69eb1 3388.ip src/conf.c
b16e27c4
EA
3389Some special routines and a few variables
3390may be defined in conf.c.
3391For the most part these are selected from the settings
3392in conf.h.
bff69eb1 3393.uh "Parameters in src/conf.h"
b16e27c4
EA
3394.pp
3395Parameters and compilation options
3396are defined in conf.h.
3397Most of these need not normally be tweaked;
3398common parameters are all in sendmail.cf.
3399However, the sizes of certain primitive vectors, etc.,
3400are included in this file.
3401The numbers following the parameters
3402are their default value.
74b6e641 3403.nr ii 1.2i
367a5dcd 3404.ip "MAXLINE [1024]"
b16e27c4
EA
3405The maximum line length of any input line.
3406If message lines exceed this length
3407they will still be processed correctly;
3408however, header lines,
3409configuration file lines,
3410alias lines,
3411etc.,
3412must fit within this limit.
367a5dcd 3413.ip "MAXNAME [256]"
b16e27c4
EA
3414The maximum length of any name,
3415such as a host or a user name.
3416.ip "MAXFIELD [2500]"
3417The maximum total length of any header field,
3418including continuation lines.
3419.ip "MAXPV [40]"
3420The maximum number of parameters to any mailer.
3421This limits the number of recipients that may be passed in one transaction.
367a5dcd 3422.ip "MAXHOP [17]"
b16e27c4
EA
3423When a message has been processed more than this number of times,
3424sendmail rejects the message
3425on the assumption that there has been an aliasing loop.
3426This can be determined from the
3427.b \-h
3428flag
69a914e1 3429or by counting the number of trace fields
b16e27c4
EA
3430(i.e,
3431.q Received:
3432lines)
3433in the message header.
3434.ip "MAXATOM [100]"
3435The maximum number of atoms
3436(tokens)
3437in a single address.
3438For example,
3439the address
3440.q "eric@Berkeley"
3441is three atoms.
3442.ip "MAXMAILERS [25]"
3443The maximum number of mailers that may be defined
3444in the configuration file.
3445.ip "MAXRWSETS [30]"
3446The maximum number of rewriting sets
3447that may be defined.
3448.ip "MAXPRIORITIES [25]"
3449The maximum number of values for the
3450.q Precedence:
3451field that may be defined
3452(using the
3453.b P
3454line in sendmail.cf).
3455.ip "MAXTRUST [30]"
3456The maximum number of trusted users that may be defined
3457(using the
3458.b T
3459line in sendmail.cf).
367a5dcd
EA
3460.ip "MAXUSERENVIRON [40]"
3461The maximum number of items in the user environment
3462that will be passed to subordinate mailers.
4f24419a
EA
3463.ip "QUEUESIZE [600]"
3464The maximum number of entries that will be processed
3465in a single queue run.
b16e27c4
EA
3466.lp
3467A number of other compilation options exist.
3468These specify whether or not specific code should be compiled in.
74b6e641 3469.nr ii 1i
4da134f8
EA
3470.ip DBM
3471If set,
3472the
3473.q DBM
3474package in UNIX is used
4f24419a
EA
3475(see
3476.i dbm(3X)
3477in [UNIX80]).
4da134f8
EA
3478If not set,
3479a much less efficient algorithm for processing aliases is used.
4f24419a
EA
3480.ip NDBM
3481If set,
3482the new version of the DBM library
3483that allows multiple databases will be used.
3484.q DBM
3485must also be set.
4da134f8
EA
3486.ip DEBUG
3487If set, debugging information is compiled in.
3488To actually get the debugging output,
3489the
3490.b \-d
3491flag must be used.
3492.ip LOG
3493If set,
3494the
3495.i syslog
3496routine in use at some sites is used.
3497This makes an informational log record
3498for each message processed,
3499and makes a higher priority log record
3500for internal system errors.
3501.ip QUEUE
3502This flag should be set to compile in the queueing code.
3503If this is not set,
3504mailers must accept the mail immediately
3505or it will be returned to the sender.
3506.ip SMTP
3507If set,
3508the code to handle user and server SMTP will be compiled in.
3509This is only necessary if your machine has some mailer
3510that speaks SMTP.
b16e27c4
EA
3511.ip DAEMON
3512If set,
3513code to run a daemon is compiled in.
4f24419a 3514This code is for 4.2 or 4.3BSD.
4da134f8
EA
3515.ip UGLYUUCP
3516If you have a UUCP host adjacent to you which is not running
3517a reasonable version of
3518.i rmail ,
3519you will have to set this flag to include the
3520.q "remote from sysname"
3521info on the from line.
3522Otherwise, UUCP gets confused about where the mail came from.
4da134f8
EA
3523.ip NOTUNIX
3524If you are using a non-UNIX mail format,
3525you can set this flag to turn off special processing
3526of UNIX-style
3527.q "From "
3528lines.
f3e184c1
EA
3529.ip NAMED_BIND
3530Compile in code to use the Berkeley Internet Name Domain (BIND) server
3531to resolve TCP/IP host names.
18843c53
PL
3532.ip SETPROCTITLE
3533If defined,
3534.i sendmail
3535will change its
3536.i argv
3537array to indicate its current status.
3538This can be used in conjunction with the
3539.i ps
3540command to find out just what it's up to.
3541.ip NO_WILDCARD_MX
3542Should be set if there are no wildcard MX nameserver records
3543in the local domain.
3544If set, this will enable the use of ANY query types, resulting
3545in better performance.
3546Unfortunately, wildcard MX records in the local domain will mess
3547this up, hence the need for this compilation option.
bff69eb1 3548.uh "Configuration in src/conf.c"
4da134f8
EA
3549.pp
3550Not all header semantics are defined in the configuration file.
3551Header lines that should only be included by certain mailers
3552(as well as other more obscure semantics)
3553must be specified in the
3554.i HdrInfo
3555table in
3556.i conf.c .
3557This table contains the header name
b16e27c4
EA
3558(which should be in all lower case)
3559and a set of header control flags (described below),
3560The flags are:
4da134f8 3561.ip H_ACHECK
b16e27c4
EA
3562Normally when the check is made to see if a header line is compatible
3563with a mailer,
3564.i sendmail
3565will not delete an existing line.
3566If this flag is set,
3567.i sendmail
3568will delete
3569even existing header lines.
4da134f8
EA
3570That is,
3571if this bit is set and the mailer does not have flag bits set
b16e27c4
EA
3572that intersect with the required mailer flags
3573in the header definition in
3574sendmail.cf,
4da134f8
EA
3575the header line is
3576.i always
3577deleted.
3578.ip H_EOH
3579If this header field is set,
3580treat it like a blank line,
3581i.e.,
3582it will signal the end of the header
3583and the beginning of the message text.
3584.ip H_FORCE
3585Add this header entry
3586even if one existed in the message before.
3587If a header entry does not have this bit set,
3588.i sendmail
3589will not add another header line if a header line
3590of this name already existed.
3591This would normally be used to stamp the message
3592by everyone who handled it.
3593.ip H_TRACE
3594If set,
3595this is a timestamp
3596(trace)
3597field.
3598If the number of trace fields in a message
3599exceeds a preset amount
3600the message is returned
3601on the assumption that it has an aliasing loop.
3602.ip H_RCPT
3603If set,
3604this field contains recipient addresses.
3605This is used by the
3606.b \-t
3607flag to determine who to send to
3608when it is collecting recipients from the message.
3609.ip H_FROM
3610This flag indicates that this field
3611specifies a sender.
3612The order of these fields in the
3613.i HdrInfo
3614table specifies
3615.i sendmail's
3616preference
3617for which field to return error messages to.
3618.nr ii 5n
3619.lp
3620Let's look at a sample
3621.i HdrInfo
3622specification:
3623.(b
be2fcca9 3624.ta 4n +\w'"return-receipt-to", 'u
4da134f8 3625struct hdrinfo HdrInfo[] =
367a5dcd 3626\&{
69a914e1 3627 /* originator fields, most to least significant */
be2fcca9
EA
3628 "resent-sender", H_FROM,
3629 "resent-from", H_FROM,
3630 "sender", H_FROM,
3631 "from", H_FROM,
3632 "full-name", H_ACHECK,
69a914e1 3633 /* destination fields */
be2fcca9
EA
3634 "to", H_RCPT,
3635 "resent-to", H_RCPT,
3636 "cc", H_RCPT,
69a914e1 3637 /* message identification and control */
be2fcca9
EA
3638 "message", H_EOH,
3639 "text", H_EOH,
69a914e1 3640 /* trace fields */
be2fcca9 3641 "received", H_TRACE|H_FORCE,
4da134f8 3642
be2fcca9 3643 NULL, 0,
4da134f8 3644};
4da134f8 3645.)b
be2fcca9 3646This structure indicates that the
4da134f8
EA
3647.q To: ,
3648.q Resent-To: ,
3649and
3650.q Cc:
be2fcca9 3651fields
4da134f8 3652all specify recipient addresses.
be2fcca9
EA
3653Any
3654.q Full-Name:
3655field will be deleted unless the required mailer flag
3656(indicated in the configuration file)
3657is specified.
4da134f8
EA
3658The
3659.q Message:
3660and
3661.q Text:
3662fields will terminate the header;
3663these are specified in new protocols
3664[NBS80]
3665or used by random dissenters around the network world.
3666The
3667.q Received:
3668field will always be added,
3669and can be used to trace messages.
4da134f8
EA
3670.pp
3671There are a number of important points here.
3672First,
3673header fields are not added automatically just because they are in the
3674.i HdrInfo
3675structure;
3676they must be specified in the configuration file
3677in order to be added to the message.
3678Any header fields mentioned in the configuration file but not
3679mentioned in the
3680.i HdrInfo
3681structure have default processing performed;
3682that is,
3683they are added unless they were in the message already.
3684Second,
3685the
3686.i HdrInfo
3687structure only specifies cliched processing;
3688certain headers are processed specially by ad hoc code
3689regardless of the status specified in
3690.i HdrInfo .
3691For example,
3692the
3693.q Sender:
3694and
3695.q From:
3696fields are always scanned on ARPANET mail
3697to determine the sender;
3698this is used to perform the
3699.q "return to sender"
3700function.
3701The
3702.q "From:"
3703and
3704.q "Full-Name:"
3705fields are used to determine the full name of the sender
3706if possible;
3707this is stored in the macro
3708.b $x
3709and used in a number of ways.
3710.pp
3711The file
3712.i conf.c
3713also contains the specification of ARPANET reply codes.
69a914e1 3714There are four classifications these fall into:
4da134f8 3715.(b
74b6e641 3716.sz -1
4da134f8
EA
3717.ta \w'char 'u +\w'Arpa_TUsrerr[] = 'u +\w'"888"; 'u
3718char Arpa_Info[] = "050"; /* arbitrary info */
3719char Arpa_TSyserr[] = "455"; /* some (transient) system error */
367a5dcd 3720char Arpa_PSyserr[] = "554"; /* some (permanent) system error */
4da134f8
EA
3721char Arpa_Usrerr[] = "554"; /* some (fatal) user error */
3722.sz
3723.)b
3724The class
3725.i Arpa_Info
3726is for any information that is not required by the protocol,
3727such as forwarding information.
3728.i Arpa_TSyserr
3729and
3730.i Arpa_PSyserr
3731is printed by the
3732.i syserr
3733routine.
3734TSyserr
3735is printed out for transient errors,
367a5dcd
EA
3736that is,
3737errors that are likely to go away without explicit action
3738on the part of a systems administrator.
3739PSyserr
3740is printed for permanent errors.
3741The distinction is made based on the value of
4da134f8
EA
3742.i errno .
3743Finally,
3744.i Arpa_Usrerr
3745is the result of a user error
3746and is generated by the
3747.i usrerr
3748routine;
3749these are generated when the user has specified something wrong,
3750and hence the error is permanent,
3751i.e.,
3752it will not work simply by resubmitting the request.
3753.pp
69a914e1 3754If it is necessary to restrict mail through a relay,
4da134f8
EA
3755the
3756.i checkcompat
3757routine can be modified.
3758This routine is called for every recipient address.
3759It can return
3760.b TRUE
3761to indicate that the address is acceptable
3762and mail processing will continue,
3763or it can return
3764.b FALSE
3765to reject the recipient.
3766If it returns false,
3767it is up to
3768.i checkcompat
3769to print an error message
3770(using
3771.i usrerr )
3772saying why the message is rejected.
3773For example,
3774.i checkcompat
3775could read:
3776.(b
3777.re
74b6e641 3778.sz -1
69a914e1 3779.ta 4n +4n +4n +4n +4n +4n +4n
4da134f8
EA
3780bool
3781checkcompat(to)
3782 register ADDRESS *to;
367a5dcd 3783\&{
69a914e1 3784 if (MsgSize > 50000 && to->q_mailer != LocalMailer)
4da134f8
EA
3785 {
3786 usrerr("Message too large for non-local delivery");
7a316267 3787 NoReturn = TRUE;
4da134f8
EA
3788 return (FALSE);
3789 }
3790 return (TRUE);
3791}
3792.sz
3793.)b
3794This would reject messages greater than 50000 bytes
3795unless they were local.
7a316267
EA
3796The
3797.i NoReturn
28719ec2 3798flag can be sent to suppress the return of the actual body
7a316267 3799of the message in the error return.
4da134f8
EA
3800The actual use of this routine is highly dependent on the
3801implementation,
3802and use should be limited.
367a5dcd
EA
3803.uh "Configuration in src/daemon.c"
3804.pp
3805The file
3806.i src/daemon.c
3807contains a number of routines that are dependent
3808on the local networking environment.
3809The version supplied is specific to 4.3 BSD.
3810.pp
3811The routine
3812.i maphostname
3813is called to convert strings within
3814.b $[
3815\&...\&
3816.b $]
3817symbols.
3818It can be modified if you wish to provide a more sophisticated service,
3819e.g.,
3820mapping UUCP host names to full paths.
69a914e1
EA
3821.+c "SUMMARY OF SUPPORT FILES"
3822.pp
3823This is a summary of the support files
3824that
3825.i sendmail
3826creates or generates.
3827.nr ii 1i
3828.ip "/usr/lib/sendmail"
3829The binary of
3830.i sendmail .
3831.ip /usr/bin/newaliases
3832A link to /usr/lib/sendmail;
3833causes the alias database to be rebuilt.
74b6e641
EA
3834Running this program is completely equivalent to giving
3835.i sendmail
3836the
3837.b \-bi
3838flag.
69a914e1
EA
3839.ip /usr/bin/mailq
3840Prints a listing of the mail queue.
74b6e641
EA
3841This program is equivalent to using the
3842.b \-bp
3843flag to
3844.i sendmail .
69a914e1
EA
3845.ip /usr/lib/sendmail.cf
3846The configuration file,
3847in textual form.
3848.ip /usr/lib/sendmail.fc
3849The configuration file
3850represented as a memory image.
3851.ip /usr/lib/sendmail.hf
3852The SMTP help file.
3853.ip /usr/lib/sendmail.st
3854A statistics file; need not be present.
3855.ip /usr/lib/aliases
3856The textual version of the alias file.
3857.ip /usr/lib/aliases.{pag,dir}
3858The alias file in
74b6e641 3859.i dbm \|(3)
69a914e1 3860format.
69a914e1
EA
3861.ip /usr/spool/mqueue
3862The directory in which the mail queue
3863and temporary files reside.
3864.ip /usr/spool/mqueue/qf*
3865Control (queue) files for messages.
3866.ip /usr/spool/mqueue/df*
3867Data files.
3868.ip /usr/spool/mqueue/lf*
3869Lock files
3870.ip /usr/spool/mqueue/tf*
3871Temporary versions of the qf files,
3872used during queue file rebuild.
3873.ip /usr/spool/mqueue/nf*
3874A file used when creating a unique id.
3875.ip /usr/spool/mqueue/xf*
3876A transcript of the current session.
28719ec2
JB
3877.\".ro
3878.\".ls 1
3879.\".tp
3880.\".sp 2i
3881.\".in 0
3882.\".ce 100
3883.\".sz 24
3884.\".b SENDMAIL
3885.\".sz 14
3886.\".sp
3887.\"INSTALLATION AND OPERATION GUIDE
3888.\".sp
3889.\".sz 10
3890.\"Eric Allman
3891.\"Britton-Lee, Inc.
3892.\".sp
3edcb7c8 3893.\"Version 5.13
28719ec2
JB
3894.\".ce 0
3895.pn 2
3896.bp
4da134f8 3897.ce
74b6e641 3898.sz 12
4da134f8 3899TABLE OF CONTENTS
74b6e641 3900.sz 10
28719ec2 3901.sp
3702dbcc
EA
3902.\" remove some things to avoid "out of temp file space" problem
3903.rm sh
3904.rm (x
3905.rm )x
3906.rm ip
3907.rm pp
3908.rm lp
3909.rm he
3910.rm fo
3911.rm eh
3912.rm oh
3913.rm ef
3914.rm of
4da134f8 3915.xp