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