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