read-over pass
[unix-history] / usr / src / usr.sbin / sendmail / doc / op / op.me
index f28ec60..4bc3351 100644 (file)
@@ -4,7 +4,7 @@
 .\"
 .\" %sccs.include.redist.roff%
 .\"
 .\"
 .\" %sccs.include.redist.roff%
 .\"
-.\"    @(#)op.me       5.24 (Berkeley) %G%
+.\"    @(#)op.me       6.16 (Berkeley) %G%
 .\"
 .\" eqn op.me | pic | troff -me
 .eh 'SMM:07-%''Sendmail Installation and Operation Guide'
 .\"
 .\" eqn op.me | pic | troff -me
 .eh 'SMM:07-%''Sendmail Installation and Operation Guide'
@@ -40,9 +40,9 @@ University of California, Berkeley
 Mammoth Project
 eric@CS.Berkeley.EDU
 .sp
 Mammoth Project
 eric@CS.Berkeley.EDU
 .sp
-Version 5.24
+Version 6.16
 .sp
 .sp
-For Sendmail Version 5.133
+For Sendmail Version 6.26
 .)l
 .sp 2
 .pp
 .)l
 .sp 2
 .pp
@@ -121,6 +121,7 @@ in this version of
 The appendixes give a brief
 but detailed explanation of a number of features
 not described in the rest of the paper.
 The appendixes give a brief
 but detailed explanation of a number of features
 not described in the rest of the paper.
+.bp 5
 .sh 1 "BASIC INSTALLATION"
 .pp
 .i
 .sh 1 "BASIC INSTALLATION"
 .pp
 .i
@@ -185,19 +186,15 @@ syntax.
 .sh 3 "Compilation flags"
 .pp
 .i Sendmail
 .sh 3 "Compilation flags"
 .pp
 .i Sendmail
-supports three different formats
+supports two different formats
 for the
 .i aliases
 database.
 These formats are:
 .nr ii 1i
 for the
 .i aliases
 database.
 These formats are:
 .nr ii 1i
-.ip DBM
-The old, tried and somewhat-true
-.i dbm
-library from V7.
-Try to avoid this.
 .ip NDBM
 .ip NDBM
-A newer version of the above.
+The ``new DBM'' format,
+available on nearly all systems around today.
 This was the preferred format prior to 4.4BSD.
 It allows such complex things as multiple databases
 and closing a currently open database.
 This was the preferred format prior to 4.4BSD.
 It allows such complex things as multiple databases
 and closing a currently open database.
@@ -215,6 +212,7 @@ old databases are read,
 but when a new database is created it will be in NEWDB format.
 As a nasty hack,
 if you have both NEWDB and one of the DB formats defined,
 but when a new database is created it will be in NEWDB format.
 As a nasty hack,
 if you have both NEWDB and one of the DB formats defined,
+and you also define YPCOMPAT,
 and if the file
 .i /var/yp/Makefile
 exists and is readable,
 and if the file
 .i /var/yp/Makefile
 exists and is readable,
@@ -228,7 +226,7 @@ reads the DBM version of the alias file.
 It's ugly as sin,
 but it works.
 .lp
 It's ugly as sin,
 but it works.
 .lp
-If none of these are defined,
+If neither of these are defined,
 .i sendmail
 reads the alias file into memory on every invocation.
 This can be slow and should be avoided.
 .i sendmail
 reads the alias file into memory on every invocation.
 This can be slow and should be avoided.
@@ -246,6 +244,14 @@ SYS5TZ
 and
 LOCKF
 respectively.
 and
 LOCKF
 respectively.
+.pp
+If you don't have the
+.i unsetenv
+routine in your system library, define the UNSETENV compilation flag.
+.pp
+You may also have to define the compilation variable LA_TYPE
+to describe how your load average is computed.
+This and other flags are detailed in section 6.1.
 .sh 3 "Compilation and installation"
 .pp
 After making the local system configuration described above,
 .sh 3 "Compilation and installation"
 .pp
 After making the local system configuration described above,
@@ -373,11 +379,7 @@ These are referenced using the
 .sm FEATURE
 .b m4
 macro.
 .sm FEATURE
 .b m4
 macro.
-Example features are
-no_wildcard_MX
-(which improves performance if you don't have a wildcard MX record
-matching your domain)
-and
+An example feature is
 use_cw_file
 (which tells sendmail to read an /etc/sendmail.cw file on startup
 to find the set of local names).
 use_cw_file
 (which tells sendmail to read an /etc/sendmail.cw file on startup
 to find the set of local names).
@@ -731,19 +733,25 @@ will print the contents of the mail queue;
 see below).
 This should be a link to /usr/\*(SD/sendmail.
 .sh 1 "NORMAL OPERATIONS"
 see below).
 This should be a link to /usr/\*(SD/sendmail.
 .sh 1 "NORMAL OPERATIONS"
-.sh 2 "Quick Configuration Startup"
+.sh 2 "``Quick'' Configuration Startup"
 .pp
 .pp
-A fast version of the configuration file
-may be set up by using the
+A precompiled (``frozen'') version of the configuration file
+can be created using the
 .b \-bz
 .b \-bz
-flag:
+flag.
+This is really only worthwhile doing
+if you are on a slow processor with a relatively fast I/O system
+(a VAX 11/750 is a good example).
+Since it creates other problems,
+I recommend against using the frozen configuration
+on most current architectures.
+.pp
+To create the freeze file, use
 .(b
 /usr/\*(SD/sendmail \-bz
 .)b
 .(b
 /usr/\*(SD/sendmail \-bz
 .)b
-This creates the file
-.i /etc/sendmail.fc
-(\c
-.q "frozen configuration" ).
+This creates the frozen configuration file
+.i /etc/sendmail.fc .
 This file is an image of
 .i sendmail 's
 data space after reading in the configuration file.
 This file is an image of
 .i sendmail 's
 data space after reading in the configuration file.
@@ -792,10 +800,12 @@ even the most mundane and uninteresting events
 are recorded for posterity.
 As a convention,
 log levels under ten
 are recorded for posterity.
 As a convention,
 log levels under ten
-are considered
+are considered generally
 .q useful;
 .q useful;
-log levels above ten
-are usually for debugging purposes.
+log levels above 64
+are reserved for debugging purposes.
+Levels from 11\-64 are reserved for verbose information
+that some sites might want.
 .pp
 A complete description of the log levels
 is given in section 4.6.
 .pp
 A complete description of the log levels
 is given in section 4.6.
@@ -1104,6 +1114,12 @@ this header will cause error messages to go to
 the listed addresses
 rather than to the sender.
 This is intended for mailing lists.
 the listed addresses
 rather than to the sender.
 This is intended for mailing lists.
+.pp
+The Errors-To: header was created in the bad old days
+when UUCP didn't understand the distinction between an envelope and a header;
+this was a hack to provide what should now be passed
+as the envelope sender address.
+It should go away.
 .sh 3 "Apparently-To:"
 .pp
 If a message comes in with no recipients listed in the message
 .sh 3 "Apparently-To:"
 .pp
 If a message comes in with no recipients listed in the message
@@ -1143,6 +1159,9 @@ mode
 it should be relatively short,
 since it defines the maximum amount of time that a message
 may sit in the queue.
 it should be relatively short,
 since it defines the maximum amount of time that a message
 may sit in the queue.
+.pp
+RFC 1123 section 5.3.1.1 says that this value should be at least 30 minutes
+(although that probably doesn't make sense if you use ``queue-only'' mode).
 .sh 2 "Daemon Mode"
 .pp
 If you allow incoming mail over an IPC connection,
 .sh 2 "Daemon Mode"
 .pp
 If you allow incoming mail over an IPC connection,
@@ -1244,7 +1263,7 @@ for this run only.
 .pp
 Some options have security implications.
 Sendmail allows you to set these,
 .pp
 Some options have security implications.
 Sendmail allows you to set these,
-but refuses to root as root thereafter.
+but refuses to run as root thereafter.
 .sh 1 "TUNING"
 .pp
 There are a number of configuration parameters
 .sh 1 "TUNING"
 .pp
 There are a number of configuration parameters
@@ -1254,12 +1273,12 @@ Most of these are set
 using an option in the configuration file.
 For example,
 the line
 using an option in the configuration file.
 For example,
 the line
-.q OT3d
+.q OT5d
 sets option
 .q T
 to the value
 sets option
 .q T
 to the value
-.q 3d
-(three days).
+.q 5d
+(five days).
 .pp
 Most of these options have appropriate defaults for most sites.
 However,
 .pp
 Most of these options have appropriate defaults for most sites.
 However,
@@ -1296,26 +1315,74 @@ flag
 specifies how often a sub-daemon will run the queue.
 This is typically set to between fifteen minutes
 and one hour.
 specifies how often a sub-daemon will run the queue.
 This is typically set to between fifteen minutes
 and one hour.
+RFC 1123 section 5.3.1.1 recommends that this be at least 30 minutes.
 .sh 3 "Read timeouts"
 .pp
 It is possible to time out when reading the standard input
 or when reading from a remote SMTP server.
 .sh 3 "Read timeouts"
 .pp
 It is possible to time out when reading the standard input
 or when reading from a remote SMTP server.
-Technically,
-this is not acceptable within the published protocols.
-However,
-it might be appropriate to set it to something large
-in certain environments
-(such as an hour).
-This will reduce the chance of large numbers of idle daemons
-piling up on your system.
-This timeout is set using the
+These timeouts are set using the
 .b r
 option in the configuration file.
 .b r
 option in the configuration file.
+The argument is a list of
+.i keyword=value
+pairs.
+The recognized keywords, their default values, and the minimum values
+allowed by RFC 1123 section 5.3.2 are:
+.nr ii 1i
+.ip initial
+The wait for the initial 220 greeting message
+[5m, 5m].
+.ip helo
+The wait for a reply from a HELO command
+[5m, unspecified].
+This may require a host name lookup, so
+five minutes is probably a reasonable minimum.
+.ip mail\(dg
+The wait for a reply from a MAIL command
+[10m, 5m].
+.ip rcpt\(dg
+The wait for a reply from a RCPT command
+[1h, 5m].
+This should be long
+because it could be pointing at a list
+that takes a long time to expand.
+.ip datainit\(dg
+The wait for a reply from a DATA command
+[5m, 2m].
+.ip datablock\(dg
+The wait for reading a data block
+(that is, the body of the message).
+[1h, 3m].
+This should be long because it also applies to programs
+piping input to
+.i sendmail
+which have no guarantee of promptness.
+.ip datafinal\(dg
+The wait for a reply from the dot terminating a message.
+[1h, 10m].
+.ip rset
+The wait for a reply from a RSET command
+[5m, unspecified].
+.ip quit
+The wait for a reply from a QUIT command
+[2m, unspecified].
+.ip misc
+The wait for a reply from miscellaneous (but short) commands
+such as NOOP (no-operation) and VERB (go into verbose mode).
+[2m, unspecified].
+.ip command\(dg
+In server SMTP,
+the time to wait for another command.
+[1h, 5m].
+.lp
+For compatibility with old configuration files,
+if no ``keyword='' is specified,
+all the timeouts marked with \(dg are set to the indicated value.
 .pp
 .pp
-RFC1123
-recommends that this option be set to five minutes.
+Many of the RFC 1123 minimum values
+may well be too short.
 .i Sendmail
 .i Sendmail
-was designed to the RFC822 protocols,
+was designed to the RFC 822 protocols,
 which did not specify read timeouts;
 hence,
 .i sendmail
 which did not specify read timeouts;
 hence,
 .i sendmail
@@ -1332,16 +1399,17 @@ with the name server;
 this involves network delays,
 and can in some cases can be considerable.
 .)f
 this involves network delays,
 and can in some cases can be considerable.
 .)f
-I recommend a two hour timeout \*-
+I recommend a one hour timeout \*-
 since this failure is rare,
 a long timeout is not onerous
 and may ultimately help reduce network load.
 .pp
 since this failure is rare,
 a long timeout is not onerous
 and may ultimately help reduce network load.
 .pp
-The timeout for a user SMTP process
-waiting for the initial
-.q HELO
-message
-is hard-wired to five minutes.
+For example, the line:
+.(b
+Orcommand=25m,datablock=3h
+.)b
+sets the server SMTP command timeout to 25 minutes
+and the input data block timeout to three hours.
 .sh 3 "Message timeouts"
 .pp
 After sitting in the queue for a few days,
 .sh 3 "Message timeouts"
 .pp
 After sitting in the queue for a few days,
@@ -1370,9 +1438,11 @@ Since this option is global,
 and since you can not
 .i "a priori"
 know how long another host outside your domain will be down,
 and since you can not
 .i "a priori"
 know how long another host outside your domain will be down,
-a three day timeout is recommended.
+a five day timeout is recommended.
 This allows a recipient to fix the problem even if it occurs
 This allows a recipient to fix the problem even if it occurs
-at the beginning of a weekend.
+at the beginning of a long weekend.
+RFC 1123 section 5.3.1.1 says that this parameter
+should be ``at least 4\-5 days''.
 .sh 2 "Forking During Queue Runs"
 .pp
 By setting the
 .sh 2 "Forking During Queue Runs"
 .pp
 By setting the
@@ -1405,9 +1475,7 @@ offset by the message class times the
 .q "work class factor"
 and the number of recipients times the
 .q "work recipient factor."
 .q "work class factor"
 and the number of recipients times the
 .q "work recipient factor."
-The priority plus the creation time of the message
-(in seconds since January 1, 1970)
-are used to order the queue.
+The priority is used to order the queue.
 Higher numbers for the priority mean that the message will be processed later
 when running the queue.
 .pp
 Higher numbers for the priority mean that the message will be processed later
 when running the queue.
 .pp
@@ -1431,12 +1499,12 @@ can be set in the configuration file using the
 and
 .b z
 options respectively.
 and
 .b z
 options respectively.
-They default to 1000 (for the recipient factor)
+They default to 30000 (for the recipient factor)
 and 1800
 (for the class factor).
 The initial priority is:
 .EQ
 and 1800
 (for the class factor).
 The initial priority is:
 .EQ
-pri = size - (class times z) + (nrcpt times y)
+pri = size - (class times bold z) + (nrcpt times bold y)
 .EN
 (Remember, higher values for this parameter actually mean
 that the job will be treated with lower priority.)
 .EN
 (Remember, higher values for this parameter actually mean
 that the job will be treated with lower priority.)
@@ -1452,6 +1520,9 @@ This is added to the priority,
 so it normally decreases the precedence of the job,
 on the grounds that jobs that have failed many times
 will tend to fail again in the future.
 so it normally decreases the precedence of the job,
 on the grounds that jobs that have failed many times
 will tend to fail again in the future.
+The
+.b Z
+option defaults to 90000.
 .sh 2 "Load Limiting"
 .pp
 .i Sendmail
 .sh 2 "Load Limiting"
 .pp
 .i Sendmail
@@ -1478,14 +1549,14 @@ plus one
 exceeds the priority of the message \(em
 that is, the message is queued iff:
 .EQ
 exceeds the priority of the message \(em
 that is, the message is queued iff:
 .EQ
-pri > QF over { LA - x + 1 }
+pri > { bold q } over { LA - bold x + 1 }
 .EN
 The
 .b q
 .EN
 The
 .b q
-option defaults to 10000,
-so each point of load average is worth 10000
+option defaults to 200000,
+so each point of load average is worth 200000
 priority points
 priority points
-(as described above, that is, bytes + seconds + offsets).
+(as described above).
 .pp
 For drastic cases,
 the
 .pp
 For drastic cases,
 the
@@ -1526,6 +1597,14 @@ Mode
 is probably a good compromise.
 However, this mode can cause large numbers of processes
 if you have a mailer that takes a long time to deliver a message.
 is probably a good compromise.
 However, this mode can cause large numbers of processes
 if you have a mailer that takes a long time to deliver a message.
+.pp
+If you run in mode
+.q q
+(queue only)
+.i sendmail
+will not expand aliases and follow .forward files
+upon initial receipt of the mail.
+This speeds up the response to RCPT commands.
 .sh 2 "Log Level"
 .pp
 The level of logging can be set for sendmail.
 .sh 2 "Log Level"
 .pp
 The level of logging can be set for sendmail.
@@ -1535,67 +1614,39 @@ The levels are as follows:
 .ip 0
 No logging.
 .ip 1
 .ip 0
 No logging.
 .ip 1
-Major problems only.
+Serious system failures and potential security problems.
 .ip 2
 .ip 2
-Message collections and failed deliveries.
+Lost communications (network problems) and protocol failures.
 .ip 3
 .ip 3
-Successful deliveries.
+Other serious failures.
 .ip 4
 .ip 4
-Messages being deferred
-(due to a host being down, etc.).
+Minor failures.
 .ip 5
 .ip 5
-Normal message queueups.
+Message collection statistics.
 .ip 6
 .ip 6
-Unusual but benign incidents,
-e.g.,
-trying to process a locked queue file.
+Creation of error messages,
+VRFY and EXPN commands.
+.ip 7
+Delivery failures (host or user unknown, etc.).
+.ip 8
+Successful deliveries.
 .ip 9
 .ip 9
-Log internal queue id to external message id mappings.
-This can be useful for tracing a message
-as it travels between several hosts.
-Also logs any VRFY or EXPN requests.
-.ip 11
+Messages being deferred
+(due to a host being down, etc.).
+.ip 10
+Database expansion (alias, forward, and userdb lookups).
+.ip 15
+Automatic alias database rebuilds.
+.ip 20
 Logs attempts to run locked queue files.
 These are not errors,
 but can be useful to note if your queue appears to be clogged.
 Logs attempts to run locked queue files.
 These are not errors,
 but can be useful to note if your queue appears to be clogged.
-.ip 12
-Several messages that are basically only of interest
-when debugging.
-.ip 16
-Verbose information regarding the queue.
-.sh 2 "Wildcard MX Records"
-.pp
-Normally, when
-.i sendmail
-is looking up host names from the name server,
-it uses the querytype of
-.q CNAME .
-The
-.b w
-option will ask the name server to use a querytype of
-.q ANY .
-This finds CNAME, A, and MX records,
-and causes the local name server to cache all records it finds,
-thus improving performance.
-.pp
-However, if your site has wildcard MX records, this can cause problems.
-For example, suppose your site has a record directing
-.q "*.HiTech.COM"
-to
-.q "gateway.HiTech.COM" .
-When the resolver looks for (e.g.)
-.q "mammoth.Berkeley.EDU" ,
-it starts by appending the local domain name (in this case,
-.q "HiTech.COM" ),
-thus looking for
-.q "mammoth.Berkeley.EDU.HiTech.COM"
-\*- which of course matches
-.q "*.HiTech.COM" .
-.pp
-If you do not have wildcard MX records in your domain,
-you can set the
-.b w
-option to get better performance.
+.ip 30
+Lost locks (only if using lockf instead of flock).
+.lp
+Additionally,
+values above 64 are reserved for extremely verbose debuggging output.
+No normal site would ever set these.
 .sh 2 "File Modes"
 .pp
 There are a number of files
 .sh 2 "File Modes"
 .pp
 There are a number of files
@@ -1648,7 +1699,10 @@ is represented by the two files
 .i aliases.dir
 and
 .i aliases.pag
 .i aliases.dir
 and
 .i aliases.pag
-(both in /etc).
+(both in /etc)
+(or
+.i aliases.db
+if you are running with the new Berkeley database primitives).
 The mode on these files should match the mode
 on /etc/aliases.
 If
 The mode on these files should match the mode
 on /etc/aliases.
 If
@@ -1769,7 +1823,7 @@ Note the use of the initial ``True'' \*-
 this is for compatibility with previous versions of sendmail,
 but is not otherwise necessary.
 .pp
 this is for compatibility with previous versions of sendmail,
 but is not otherwise necessary.
 .pp
-Version 1 configurations
+Version level 1 configurations
 turn DNSRCH and DEFNAMES off when doing delivery lookups,
 but leave them on everywhere else.
 Release 6 of
 turn DNSRCH and DEFNAMES off when doing delivery lookups,
 but leave them on everywhere else.
 Release 6 of
@@ -1791,6 +1845,11 @@ This allows names such as
 ``utc.CS''
 to match the site in Czechoslovakia
 rather than the site in your local Computer Science department.
 ``utc.CS''
 to match the site in Czechoslovakia
 rather than the site in your local Computer Science department.
+It also prefers A and CNAME records over MX records \*-
+that is, if it finds an MX record it makes note of it,
+but keeps looking.
+This way, if you have a wildcard MX record matching your domain,
+it will not assume that all names match.
 .sh 2 "Moving the Per-User Forward Files"
 .pp
 Some sites mount each user's home directory
 .sh 2 "Moving the Per-User Forward Files"
 .pp
 Some sites mount each user's home directory
@@ -1822,6 +1881,45 @@ If you create a directory such as /var/forward,
 it should be mode 1777
 (that is, the sticky bit should be set).
 Users should create the files mode 644.
 it should be mode 1777
 (that is, the sticky bit should be set).
 Users should create the files mode 644.
+.sh 2 "Free Space"
+.pp
+On systems that have the
+.i statfs (2)
+system call,
+you can specify a minimum number of free blocks on the queue filesystem
+using the
+.b b
+option.
+If there are fewer than the indicated number of blocks free
+on the filesystem on which the queue is mounted
+the SMTP server will reject mail
+with the
+452 error code.
+This invites the SMTP client to try again later.
+.pp
+Beware of setting this option too high;
+it can cause rejection of email
+when that mail would be processed without difficulty.
+.sh 2 "Privacy Flags"
+.pp
+The
+.b p
+option allows you to set certain
+``privacy''
+flags.
+Actually, many of them don't give you any extra privacy,
+rather just insisting that client SMTP servers
+use the HELO command
+before using certain commands.
+.pp
+The option takes a series of flag names;
+the final privacy is the inclusive or of those flags.
+For example:
+.(b
+Ob needmailhelo, noexpn
+.)b
+insists that the HELO command be used before a MAIL command is accepted
+and disables the EXPN command.
 .sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
 .pp
 This section describes the configuration file
 .sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
 .pp
 This section describes the configuration file
@@ -1844,7 +1942,7 @@ configuration-file compiler.
 An overview of the configuration file
 is given first,
 followed by details of the semantics.
 An overview of the configuration file
 is given first,
 followed by details of the semantics.
-.sh 2 "The Syntax"
+.sh 2 "Configuration File Lines"
 .pp
 The configuration file is organized as a series of lines,
 each of which begins with a single character
 .pp
 The configuration file is organized as a series of lines,
 each of which begins with a single character
@@ -1907,7 +2005,200 @@ the input is rewritten to the
 The
 .i comments
 are ignored.
 The
 .i comments
 are ignored.
-.sh 3 "D \*- define macro"
+.sh 4 "The left hand side"
+.pp
+The left hand side of rewriting rules contains a pattern.
+Normal words are simply matched directly.
+Metasyntax is introduced using a dollar sign.
+The metasymbols are:
+.(b
+.ta \w'\fB$=\fP\fIx\fP  'u
+\fB$*\fP       Match zero or more tokens
+\fB$+\fP       Match one or more tokens
+\fB$\-\fP      Match exactly one token
+\fB$=\fP\fIx\fP        Match any token in class \fIx\fP
+\fB$~\fP\fIx\fP        Match any token not in class \fIx\fP
+.)b
+If any of these match,
+they are assigned to the symbol
+.b $ \c
+.i n
+for replacement on the right hand side,
+where
+.i n
+is the index in the LHS.
+For example,
+if the LHS:
+.(b
+$\-:$+
+.)b
+is applied to the input:
+.(b
+UCBARPA:eric
+.)b
+the rule will match, and the values passed to the RHS will be:
+.(b
+.ta 4n
+$1     UCBARPA
+$2     eric
+.)b
+.sh 4 "The right hand side"
+.pp
+When the left hand side of a rewriting rule matches,
+the input is deleted and replaced by the right hand side.
+Tokens are copied directly from the RHS
+unless they begin with a dollar sign.
+Metasymbols are:
+.(b
+.ta \w'$#mailer\0\0\0'u
+\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
+\fB$[\fP\fIname\fP\fB$]\fP     Canonicalize \fIname\fP
+\fB$(\fP\fImap key\fP \fB$@\fP\fIarguments\fP \fB$:\fP\fIdefault\fP \fB$)\fP
+       Generalized keyed mapping function
+\fB$>\fP\fIn\fP        \*(lqCall\*(rq ruleset \fIn\fP
+\fB$#\fP\fImailer\fP   Resolve to \fImailer\fP
+\fB$@\fP\fIhost\fP     Specify \fIhost\fP
+\fB$:\fP\fIuser\fP     Specify \fIuser\fP
+.)b
+.pp
+The
+.b $ \c
+.i n
+syntax substitutes the corresponding value from a
+.b $+ ,
+.b $\- ,
+.b $* ,
+.b $= ,
+or
+.b $~
+match on the LHS.
+It may be used anywhere.
+.pp
+A host name enclosed between
+.b $[
+and
+.b $]
+is looked up using the
+.i gethostent \|(3)
+routines and replaced by the canonical name\**.
+.(f
+\**This is actually
+completely equivalent
+to $(host \fIhostname\fP$).
+In particular, a
+.b $:
+default can be used.
+.)f
+For example,
+.q $[csam$]
+might become
+.q lbl-csam.arpa
+and
+.q $[[128.32.130.2]$]
+would become
+.q vangogh.CS.Berkeley.EDU.
+.i Sendmail
+recognizes it's numeric IP address
+without calling the name server
+and replaces it with it's canonical name.
+.pp
+The
+.b $(
+\&...
+.b $)
+syntax is a more general form of lookup;
+it uses a named map instead of an implicit map.
+If no lookup is found, the indicted
+.i default
+is inserted;
+if no default is specified and no lookup matches,
+the value is left unchanged.
+.pp
+The
+.b $> \c
+.i n
+syntax
+causes the remainder of the line to be substituted as usual
+and then passed as the argument to ruleset
+.i n .
+The final value of ruleset
+.i n
+then becomes
+the substitution for this rule.
+.pp
+The
+.b $#
+syntax should
+.i only
+be used in ruleset zero.
+It causes evaluation of the ruleset to terminate immediately,
+and signals to sendmail that the address has completely resolved.
+The complete syntax is:
+.(b
+\fB$#\fP\fImailer\fP \fB$@\fP\fIhost\fP \fB$:\fP\fIuser\fP
+.)b
+This specifies the
+{mailer, host, user}
+3-tuple necessary to direct the mailer.
+If the mailer is local
+the host part may be omitted.
+The
+.i mailer
+and
+.i host
+must be a single word,
+but the
+.i user
+may be multi-part.
+.pp
+A RHS may also be preceded by a
+.b $@
+or a
+.b $:
+to control evaluation.
+A
+.b $@
+prefix causes the ruleset to return with the remainder of the RHS
+as the value.
+A
+.b $:
+prefix causes the rule to terminate immediately,
+but the ruleset to continue;
+this can be used to avoid continued application of a rule.
+The prefix is stripped before continuing.
+.pp
+The
+.b $@
+and
+.b $:
+prefixes may precede a
+.b $>
+spec;
+for example:
+.(b
+.ta 8n
+R$+    $: $>7 $1
+.)b
+matches anything,
+passes that to ruleset seven,
+and continues;
+the
+.b $:
+is necessary to avoid an infinite loop.
+.pp
+Substitution occurs in the order described,
+that is,
+parameters from the LHS are substituted,
+hostnames are canonicalized,
+.q subroutines
+are called,
+and finally
+.b $# ,
+.b $@ ,
+and
+.b $:
+are processed.
+..sh 3 "D \*- define macro"
 .pp
 Macros are named with a single character.
 These may be selected from the entire ASCII set,
 .pp
 Macros are named with a single character.
 These may be selected from the entire ASCII set,
@@ -1928,652 +2219,231 @@ is the name of the macro
 and
 .i val
 is the value it should have.
 and
 .i val
 is the value it should have.
-Macros can be interpolated in most places using the escape sequence
+.pp
+Macros are interpolated
+using the construct
 .b $ \c
 .b $ \c
-.i x .
-.sh 3 "C and F \*- define classes"
+.i x ,
+where
+.i x
+is the name of the macro to be interpolated.
+In particular,
+lower case letters are reserved to have
+special semantics,
+used to pass information in or out of sendmail,
+and some special characters are reserved to
+provide conditionals, etc.
 .pp
 .pp
-Classes of words may be defined
-to match on the left hand side of rewriting rules,
-where a
-.q word
-is a sequence of characters that do not contain characters
-in the $o macro.
-For example
-a class of all local names for this site
-might be created
-so that attempts to send to oneself
-can be eliminated.
-These can either be defined directly in the configuration file
-or read in from another file.
-Classes may be given names
-from the set of upper case letters.
-Lower case letters and special characters
-are reserved for system use.
-.pp
-The syntax is:
-.(b F
-.b C \c
-.i c\|word1
-.i word2...
-.br
-.b F \c
-.i c\|file
-.)b
-The first form defines the class
-.i c
-to match any of the named words.
-It is permissible to split them among multiple lines;
-for example, the two forms:
+Conditionals can be specified using the syntax:
 .(b
 .(b
-CHmonet ucbmonet
+$?x text1 $| text2 $.
 .)b
 .)b
+This interpolates
+.i text1
+if the macro
+.b $x
+is set,
 and
 and
-.(b
-CHmonet
-CHucbmonet
-.)b
-are equivalent.
-The second form
-reads the elements of the class
-.i c
-from the named
-.i file .
-.sh 3 "M \*- define mailer"
+.i text2
+otherwise.
+The
+.q else
+(\c
+.b $| )
+clause may be omitted.
 .pp
 .pp
-Programs and interfaces to mailers
-are defined in this line.
-The format is:
-.(b F
-.b M \c
-.i name ,
-{\c
-.i field =\c
-.i value \|}*
-.)b
-where
-.i name
-is the name of the mailer
-(used internally only)
-and the
-.q field=name
-pairs define attributes of the mailer.
-Fields are:
+The following macros
+.i must
+be defined to transmit information into
+.i sendmail:
 .(b
 .(b
-.ta 1i
-Path   The pathname of the mailer
-Flags  Special flags for this mailer
-Sender A rewriting set for sender addresses
-Recipient      A rewriting set for recipient addresses
-Argv   An argument vector to pass to this mailer
-Eol    The end-of-line string for this mailer
-Maxsize        The maximum message length to this mailer
-Linelimit      The maximum line length in the message body
-.)b
-Only the first character of the field name is checked.
-.sh 3 "H \*- define header"
-.pp
-The format of the header lines that sendmail inserts into the message
-are defined by the
-.b H
-line.
-The syntax of this line is:
-.(b F
-.b H [\c
-.b ? \c
-.i mflags \c
-.b ? ]\c
-.i hname \c
-.b :
-.i htemplate
+.ta 4n
+e      The SMTP entry message
+j      The \*(lqofficial\*(rq domain name for this site
+l      The format of the UNIX from line
+n      The name of the daemon (for error messages)
+o      The set of "operators" in addresses
+q      default format of sender address
 .)b
 .)b
-Continuation lines in this spec
-are reflected directly into the outgoing message.
 The
 The
-.i htemplate
-is macro expanded before insertion into the message.
-If the
-.i mflags
-(surrounded by question marks)
-are specified,
-at least one of the specified flags
-must be stated in the mailer definition
-for this header to be automatically output.
-If one of these headers is in the input
-it is reflected to the output
-regardless of these flags.
-.pp
-Some headers have special semantics
-that will be described below.
-.sh 3 "O \*- set option"
-.pp
-There are a number of
-.q random
-options that
-can be set from a configuration file.
-Options are represented by single characters.
-The syntax of this line is:
-.(b F
-.b O \c
-.i o\|value
-.)b
-This sets option
-.i o
-to be
-.i value .
-Depending on the option,
-.i value
-may be a string, an integer,
-a boolean
-(with legal values
-.q t ,
-.q T ,
-.q f ,
-or
-.q F ;
-the default is TRUE),
-or
-a time interval.
-.sh 3 "T \*- define trusted users"
-.pp
-Trusted users
-are those users who are permitted
-to override the sender address
-using the
-.b \-f
-flag.
-These typically are
-.q root,
-.q uucp,
+.b $e
+macro is printed out when SMTP starts up.
+The first word must be the
+.b $j
+macro.
+The
+.b $j
+macro
+should be in RFC821 format.
+The
+.b $l
 and
 and
-.q network,
-but on some users it may be convenient
-to extend this list to include other users,
-perhaps to support
-a separate
-UUCP
-login for each host.
-The syntax of this line is:
-.(b F
-.b T \c
-.i user1
-.i user2 ...
-.)b
-There may be more than one of these lines.
-.sh 3 "P \*- precedence definitions"
-.pp
-Values for the
-.q "Precedence:"
-field may be defined using the
-.b P
-control line.
-The syntax of this field is:
+.b $n
+macros can be considered constants
+except under terribly unusual circumstances.
+The
+.b $o
+macro consists of a list of characters
+which will be considered tokens
+and which will separate tokens
+when doing parsing.
+For example, if
+.q @
+were in the
+.b $o
+macro, then the input
+.q a@b
+would be scanned as three tokens:
+.q a,
+.q @,
+and
+.q b.
+Finally, the
+.b $q
+macro specifies how an address should appear in a message
+when it is defaulted.
+For example, on our system these definitions are:
 .(b
 .(b
-\fBP\fP\fIname\fP\fB=\fP\fInum\fP
+De$j Sendmail $v/$Z ready at $b
+DnMAILER-DAEMON
+DlFrom $?<$<$|$g$.  $d
+Do.:%@!^/[]
+Dq$?x$x <$g>$|$g$.
+Dj$w
 .)b
 .)b
-When the
-.i name
-is found in a
-.q Precedence:
-field,
-the message class is set to
-.i num .
-Higher numbers mean higher precedence.
-Numbers less than zero
-have the special property
-that error messages will not be returned.
-The default precedence is zero.
-For example,
-our list of precedences is:
+An acceptable alternative for the
+.b $q
+macro is
+.q "$g$?x ($x)$." .
+These correspond to the following two formats:
 .(b
 .(b
-Pfirst-class=0
-Pspecial-delivery=100
-Pjunk=\-100
+Eric Allman <eric@CS.Berkeley.EDU>
+eric@CS.Berkeley.EDU (Eric Allman)
 .)b
 .)b
-.sh 3 "V \*- configuration version level"
-.pp
-To provide compatibility with old configuration files,
-the
-.b V
-line has been added to define some very basic semantics
-of the configuration file.
-These are not intended to be long term supports;
-rather, they describe compatibility features
-which will probably be removed in future releases.
+.i Sendmail
+properly quotes names that have special characters
+if the first form is used.
 .pp
 .pp
-.q Old
-configuration files are defined as level one.
-Level two files make the following changes:
-.np
-Host name canonification ($[ ... $])
-appends a dot if the name is recognized;
-this gives the config file a way of finding out if anything matched.
-(Actually, this just initializes the
-.q host
-map with the
-.q \-a.
-flag \*- you can reset it to anything you prefer
-by declaring the map explicitly.)
-.np
-Default host name extension is consistent throughout processing;
-level one configurations turned off domain extension
-(that is, adding the local domain name)
-during certain points in processing.
-Level two configurations are expected to include a trailing dot
-to indicate that the name is already canonical.
-.np
-Local names that are not aliases
-are passed through a new distinguished ruleset five;
-this can be used to append a local relay.
-This behaviour can be prevented by resolving the local name
-with an initial `@'.
-That is, something that resolves to a local mailer and a user name of
-.q vikki
-will be passed through ruleset five,
-but a user name of
-.q @vikki
-will have the `@' stripped,
-will not be passed through ruleset five,
-but will otherwise be treated the same as the prior example.
-The expectation is that this might be used to implement a policy
-where mail sent to
-.q vikki
-was handled by a central hub,
-but mail sent to
-.q vikki@localhost
-was delivered directly.
-.pp
-Level three files
-allow # initiated comments on all lines.
-Exceptions are backslash escaped # marks
-and the $# syntax.
-.sh 3 "K \*- key file declaration"
-.pp
-Special maps can be defined using the line:
+Some macros are defined by
+.i sendmail
+for interpolation into argv's for mailers
+or for other contexts.
+These macros are:
 .(b
 .(b
-Kmapname mapclass arguments
+a      The origination date in RFC 822 format
+b      The current date in RFC 822 format
+c      The hop count
+d      The date in UNIX (ctime) format
+f      The sender (from) address
+g      The sender address relative to the recipient
+h      The recipient host
+i      The queue id
+k      The UUCP node name (from the uname system call)
+m      The domain part of the \fIgethostname\fP return value
+p      Sendmail's pid
+r      Protocol used to receive the message
+s      Sender's host name
+t      A numeric representation of the current time
+u      The recipient user
+v      The version number of sendmail
+w      The hostname of this site
+x      The full name of the sender
+z      The home directory of the recipient
+<      The return-path (sender in envelope) relative to recipient
 .)b
 .)b
+.pp
+There are three types of dates that can be used.
 The
 The
-.i mapname
-is the handle by which this map is referenced in the rewriting rules.
-The
-.i mapclass
-is the name of a type of map;
-these are compiled in to sendmail.
+.b $a
+and
+.b $b
+macros are in RFC 822 format;
+.b $a
+is the time as extracted from the
+.q Date:
+line of the message
+(if there was one),
+and
+.b $b
+is the current date and time
+(used for postmarks).
+If no
+.q Date:
+line is found in the incoming message,
+.b $a
+is set to the current time also.
 The
 The
-.i arguments
-are interpreted depending on the class;
-typically,
-there would be a single argument naming the file containing the map.
+.b $d
+macro is equivalent to the
+.b $b
+macro in UNIX
+(ctime)
+format.
 .pp
 .pp
-Maps are referenced using the syntax:
-.(b
-$( \fImap\fP \fIkey\fP $@ \fIarguments\fP $: \fIdefault\fP $)
-.)b
-where either or both of the
-.i arguments
-or
-.i default
-portion may be omitted.
 The
 The
-.i arguments
-may appear more than once.
-The indicated
-.i key
-and
-.i arguments
-are passed to the appropriate mapping function.
-If it returns a value, it replaces the input.
-If it does not return a value and the
-.i default
-is specified, the
-.i default
-replaces the input.
-Otherwise, the input is unchanged.
+.b $f
+macro is the id of the sender
+as originally determined;
+when mailing to a specific host
+the
+.b $g
+macro is set to the address of the sender
+.ul
+relative to the recipient.
+For example,
+if I send to
+.q bollard@matisse.CS.Berkeley.EDU
+from the machine
+.q vangogh.CS.Berkeley.EDU
+the
+.b $f
+macro will be
+.q eric
+and the
+.b $g
+macro will be
+.q eric@vangogh.CS.Berkeley.EDU.
 .pp
 .pp
-During replacement of either a map value or default
-the string
-.q %\fIn\fP
-(where
-.i n
-is a digit)
-is replaced by the corresponding
-.i argument .
-Argument zero
-is always the original pattern.
-For example, the rule
-.(b
-R$- ! $+       $: $(uucp $1 $@ $2 $: %1 @ %0 . UUCP $)
-.)b
-Looks up the UUCP name in a (user defined) UUCP map;
-if not found it turns it into
-.q ``\&.UUCP'' form.  The database might contain records like:
-.(b
-decvax %1@%0.DEC.COM
-research       %1@%0.ATT.COM
-.)b
+The
+.b $<
+macro is identical to the
+.b $g
+macro except that it uses the envelope sender
+instead of the From: address in the body of the message.
 .pp
 .pp
-The built in map with both name and class
-.q host
-is the host name canonicalization lookup.
-Thus,
-the syntax:
-.(b
-$(host \fIhostname\fP$)
-.)b
-is equivalent to:
-.(b
-$[\fIhostname\fP$]
-.)b
+The
+.b $x
+macro is set to the full name of the sender.
+This can be determined in several ways.
+It can be passed as flag to
+.i sendmail.
+The second choice is the value of the
+.q Full-name:
+line in the header if it exists,
+and the third choice is the comment field
+of a
+.q From:
+line.
+If all of these fail,
+and if the message is being originated locally,
+the full name is looked up in the
+.i /etc/passwd
+file.
 .pp
 .pp
-There are four predefined database lookup classes:
-.q dbm ,
-.q btree ,
-.q hash ,
+When sending,
+the
+.b $h ,
+.b $u ,
 and
 and
-.q nis .
-The first requires that sendmail be compiled with the
-.b ndbm
-library;
-the second two require the
-.b db
-library,
-and the third requires that sendmail be compiled with NIS support.
-All four accept as arguments the some optional flags
-and a filename (or a mapname for NIS).
-Known flags are:
-.ip "\-o"
-Indicates that this map is optional \*- that is,
-if it cannot be opened,
-no error is produced,
-and sendmail will behave as if the map existed but was empty.
-.ip "\-N"
-Normally sendmail does not include the trailing null byte
-on a string as part of the key.
-If this flag is indicated,
-it will be included.
-This is for compatibility with some methods of building the maps.
-.ip "\-a\fIx\fP"
-Append the character
-.i x
-on successful matches.
-For example, the default
-.i host
-map appends a dot on successful matches.
-.ip "\-d\fIdomain\fP"
-Use the indicated
-.i domain
-instead of the default domain.
-Used only for NIS maps.
-.ip "\-f"
-Fold upper to lower case before looking up the key.
-.ip "\-m"
-Match only (without replacing the value).
-If you only care about the existence of a key and not the value
-(as you might when searching the NIS map
-.q hosts.byname
-for example),
-this flag prevents the map from substituting the value.
-However,
-The \-a argument is still appended on a match,
-and the default is still taken if the match fails.
-.pp
-The
-.i dbm
-map appends the strings
-.q \&.pag
-and
-.q \&.dir
-to the given filename;
-the two
-.i db -based
-maps do not.
-.pp
-The program
-.i makemap (8)
-can be used to build any of the three database-oriented maps.
-It takes the following flags:
-.ip \-f
-Fold upper to lower case in the map.
-.ip \-N
-Include null bytes in keys.
-.ip \-o
-Append to an existing (old) file.
-.ip \-r
-Allow replacement of existing keys;
-normally, re-inserting an existing key is an error.
-.ip \-v
-Print what is happening.
-.pp
-New classes can be added in the routine
-.b setupmaps
-in file
-.b conf.c .
-.sh 2 "The Semantics"
-.pp
-This section describes the semantics of the configuration file.
-.sh 3 "Special macros, conditionals"
-.pp
-Macros are interpolated
-using the construct
-.b $ \c
-.i x ,
-where
-.i x
-is the name of the macro to be interpolated.
-In particular,
-lower case letters are reserved to have
-special semantics,
-used to pass information in or out of sendmail,
-and some special characters are reserved to
-provide conditionals, etc.
-.pp
-Conditionals can be specified using the syntax:
-.(b
-$?x text1 $| text2 $.
-.)b
-This interpolates
-.i text1
-if the macro
-.b $x
-is set,
-and
-.i text2
-otherwise.
-The
-.q else
-(\c
-.b $| )
-clause may be omitted.
-.pp
-The following macros
-.i must
-be defined to transmit information into
-.i sendmail:
-.(b
-.ta 4n
-e      The SMTP entry message
-j      The \*(lqofficial\*(rq domain name for this site
-l      The format of the UNIX from line
-n      The name of the daemon (for error messages)
-o      The set of "operators" in addresses
-q      default format of sender address
-.)b
-The
-.b $e
-macro is printed out when SMTP starts up.
-The first word must be the
-.b $j
-macro.
-The
-.b $j
-macro
-should be in RFC821 format.
-The
-.b $l
-and
-.b $n
-macros can be considered constants
-except under terribly unusual circumstances.
-The
-.b $o
-macro consists of a list of characters
-which will be considered tokens
-and which will separate tokens
-when doing parsing.
-For example, if
-.q @
-were in the
-.b $o
-macro, then the input
-.q a@b
-would be scanned as three tokens:
-.q a,
-.q @,
-and
-.q b.
-Finally, the
-.b $q
-macro specifies how an address should appear in a message
-when it is defaulted.
-For example, on our system these definitions are:
-.(b
-De$j Sendmail $v ready at $b
-DnMAILER-DAEMON
-DlFrom $<  $d
-Do.:%@!^/
-Dq$g$?x ($x)$.
-Dj$H.$D
-.)b
-An acceptable alternative for the
-.b $q
-macro is
-.q "$?x$x $.<$g>" .
-These correspond to the following two formats:
-.(b
-eric@CS.Berkeley.EDU (Eric Allman)
-Eric Allman <eric@CS.Berkeley.EDU>
-.)b
-.pp
-Some macros are defined by
-.i sendmail
-for interpolation into argv's for mailers
-or for other contexts.
-These macros are:
-.(b
-a      The origination date in RFC 822 format
-b      The current date in RFC 822 format
-c      The hop count
-d      The date in UNIX (ctime) format
-f      The sender (from) address
-g      The sender address relative to the recipient
-h      The recipient host
-i      The queue id
-m      The domain part of the \fIgethostname\fP return value
-p      Sendmail's pid
-r      Protocol used to receive the message
-s      Sender's host name
-t      A numeric representation of the current time
-u      The recipient user
-v      The version number of sendmail
-w      The hostname of this site
-x      The full name of the sender
-z      The home directory of the recipient
-<      The return-path (sender in envelope) relative to recipient
-.)b
-.pp
-There are three types of dates that can be used.
-The
-.b $a
-and
-.b $b
-macros are in RFC 822 format;
-.b $a
-is the time as extracted from the
-.q Date:
-line of the message
-(if there was one),
-and
-.b $b
-is the current date and time
-(used for postmarks).
-If no
-.q Date:
-line is found in the incoming message,
-.b $a
-is set to the current time also.
-The
-.b $d
-macro is equivalent to the
-.b $a
-macro in UNIX
-(ctime)
-format.
-.pp
-The
-.b $f
-macro is the id of the sender
-as originally determined;
-when mailing to a specific host
-the
-.b $g
-macro is set to the address of the sender
-.ul
-relative to the recipient.
-For example,
-if I send to
-.q bollard@matisse
-from the machine
-.q ucbarpa
-the
-.b $f
-macro will be
-.q eric
-and the
-.b $g
-macro will be
-.q eric@ucbarpa.
-.pp
-The
-.b $<
-macro is identical to the
-.b $g
-macro except that it uses the envelope sender
-instead of the From: address in the body of the message.
-.pp
-The
-.b $x
-macro is set to the full name of the sender.
-This can be determined in several ways.
-It can be passed as flag to
-.i sendmail.
-The second choice is the value of the
-.q Full-name:
-line in the header if it exists,
-and the third choice is the comment field
-of a
-.q From:
-line.
-If all of these fail,
-and if the message is being originated locally,
-the full name is looked up in the
-.i /etc/passwd
-file.
-.pp
-When sending,
-the
-.b $h ,
-.b $u ,
-and
-.b $z
-macros get set to the host, user, and home directory
-(if local)
-of the recipient.
-The first two are set from the
-.b $@
-and
-.b $:
-part of the rewriting rules, respectively.
+.b $z
+macros get set to the host, user, and home directory
+(if local)
+of the recipient.
+The first two are set from the
+.b $@
+and
+.b $:
+part of the rewriting rules, respectively.
 .pp
 The
 .b $p
 .pp
 The
 .b $p
@@ -2615,195 +2485,7 @@ and
 .b $s
 fields are set to the protocol used to communicate with sendmail
 and the sending hostname.
 .b $s
 fields are set to the protocol used to communicate with sendmail
 and the sending hostname.
-.sh 3 "Special classes"
-.pp
-The class
-.b $=w
-is set to be the set of all names
-this host is known by.
-This can be used to match local hostnames.
-.sh 3 "The left hand side"
-.pp
-The left hand side of rewriting rules contains a pattern.
-Normal words are simply matched directly.
-Metasyntax is introduced using a dollar sign.
-The metasymbols are:
-.(b
-.ta \w'\fB$=\fP\fIx\fP  'u
-\fB$*\fP       Match zero or more tokens
-\fB$+\fP       Match one or more tokens
-\fB$\-\fP      Match exactly one token
-\fB$=\fP\fIx\fP        Match any token in class \fIx\fP
-\fB$~\fP\fIx\fP        Match any token not in class \fIx\fP
-.)b
-If any of these match,
-they are assigned to the symbol
-.b $ \c
-.i n
-for replacement on the right hand side,
-where
-.i n
-is the index in the LHS.
-For example,
-if the LHS:
-.(b
-$\-:$+
-.)b
-is applied to the input:
-.(b
-UCBARPA:eric
-.)b
-the rule will match, and the values passed to the RHS will be:
-.(b
-.ta 4n
-$1     UCBARPA
-$2     eric
-.)b
-.sh 3 "The right hand side"
-.pp
-When the left hand side of a rewriting rule matches,
-the input is deleted and replaced by the right hand side.
-Tokens are copied directly from the RHS
-unless they begin with a dollar sign.
-Metasymbols are:
-.(b
-.ta \w'$#mailer\0\0\0'u
-\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
-\fB$[\fP\fIname\fP\fB$]\fP     Canonicalize \fIname\fP
-\fB$(\fP\fImap key\fP \fB$@\fP\fIarguments\fP \fB$:\fP\fIdefault\fP \fB$)\fP
-       Generalized keyed mapping function
-\fB$>\fP\fIn\fP        \*(lqCall\*(rq ruleset \fIn\fP
-\fB$#\fP\fImailer\fP   Resolve to \fImailer\fP
-\fB$@\fP\fIhost\fP     Specify \fIhost\fP
-\fB$:\fP\fIuser\fP     Specify \fIuser\fP
-.)b
-.pp
-The
-.b $ \c
-.i n
-syntax substitutes the corresponding value from a
-.b $+ ,
-.b $\- ,
-.b $* ,
-.b $= ,
-or
-.b $~
-match on the LHS.
-It may be used anywhere.
-.pp
-A host name enclosed between
-.b $[
-and
-.b $]
-is looked up using the
-.i gethostent \|(3)
-routines and replaced by the canonical name.
-For example,
-.q $[csam$]
-might become
-.q lbl-csam.arpa
-and
-.q $[[128.32.130.2]$]
-would become
-.q vangogh.berkeley.edu.
-.pp
-The
-.b $(
-\&...
-.b $)
-syntax is a more general form of lookup;
-it uses a named map instead of an implicit map.
-If no lookup is found, the indicted
-.i default
-is inserted;
-if no default is specified and no lookup matches,
-the value is left unchanged.
-.pp
-The
-.b $> \c
-.i n
-syntax
-causes the remainder of the line to be substituted as usual
-and then passed as the argument to ruleset
-.i n .
-The final value of ruleset
-.i n
-then becomes
-the substitution for this rule.
-.pp
-The
-.b $#
-syntax should
-.i only
-be used in ruleset zero.
-It causes evaluation of the ruleset to terminate immediately,
-and signals to sendmail that the address has completely resolved.
-The complete syntax is:
-.(b
-\fB$#\fP\fImailer\fP\fB$@\fP\fIhost\fP\fB$:\fP\fIuser\fP
-.)b
-This specifies the
-{mailer, host, user}
-3-tuple necessary to direct the mailer.
-If the mailer is local
-the host part may be omitted.
-The
-.i mailer
-and
-.i host
-must be a single word,
-but the
-.i user
-may be multi-part.
-.pp
-A RHS may also be preceded by a
-.b $@
-or a
-.b $:
-to control evaluation.
-A
-.b $@
-prefix causes the ruleset to return with the remainder of the RHS
-as the value.
-A
-.b $:
-prefix causes the rule to terminate immediately,
-but the ruleset to continue;
-this can be used to avoid continued application of a rule.
-The prefix is stripped before continuing.
-.pp
-The
-.b $@
-and
-.b $:
-prefixes may precede a
-.b $>
-spec;
-for example:
-.(b
-.ta 8n
-R$+    $:$>7$1
-.)b
-matches anything,
-passes that to ruleset seven,
-and continues;
-the
-.b $:
-is necessary to avoid an infinite loop.
-.pp
-Substitution occurs in the order described,
-that is,
-parameters from the LHS are substituted,
-hostnames are canonicalized,
-.q subroutines
-are called,
-and finally
-.b $# ,
-.b $@ ,
-and
-.b $:
-are processed.
-.sh 3 "Semantics of rewriting rule sets"
+.sh 4 "Semantics of rewriting rule sets"
 .pp
 There are five rewriting sets
 that have specific semantics.
 .pp
 There are five rewriting sets
 that have specific semantics.
@@ -2919,431 +2601,163 @@ Ruleset four is applied to all addresses
 in the message.
 It is typically used
 to translate internal to external form.
 in the message.
 It is typically used
 to translate internal to external form.
-.sh 3 "Mailer flags etc."
+.sh 3 "C and F \*- define classes"
 .pp
 .pp
-There are a number of flags that may be associated with each mailer,
-each identified by a letter of the alphabet.
-Many of them are assigned semantics internally.
-These are detailed in Appendix C.
-Any other flags may be used freely
-to conditionally assign headers to messages
-destined for particular mailers.
-.sh 3 "The \*(lqerror\*(rq mailer"
+Classes of words may be defined
+to match on the left hand side of rewriting rules,
+where a
+.q word
+is a sequence of characters that do not contain characters
+in the $o macro.
+For example
+a class of all local names for this site
+might be created
+so that attempts to send to oneself
+can be eliminated.
+These can either be defined directly in the configuration file
+or read in from another file.
+Classes may be given names
+from the set of upper case letters.
+Lower case letters and special characters
+are reserved for system use.
 .pp
 .pp
-The mailer with the special name
-.q error
-can be used to generate a user error.
-The (optional) host field is a numeric exit status to be returned,
-and the user field is a message to be printed.
-For example, the entry:
+The syntax is:
+.(b F
+.b C \c
+.i c\|word1
+.i word2...
+.br
+.b F \c
+.i c\|file
+.)b
+The first form defines the class
+.i c
+to match any of the named words.
+It is permissible to split them among multiple lines;
+for example, the two forms:
 .(b
 .(b
-$#error$:Host unknown in this domain
+CHmonet ucbmonet
 .)b
 .)b
-on the RHS of a rule
-will cause the specified error to be generated
-if the LHS matches.
-This mailer is only functional in ruleset zero.
-.sh 2 "Options"
+and
+.(b
+CHmonet
+CHucbmonet
+.)b
+are equivalent.
+The second form
+reads the elements of the class
+.i c
+from the named
+.i file .
 .pp
 .pp
-The following options may be set using the
-.b \-o
-flag on the command line
-or the
-.b O
-line in the configuration file.
-If specified on the command line,
-most will cause
-.i sendmail
-to relinquish its setuid permissions.
-The options that will not cause this are
-d, e, E, i, L, m, o, r, s, v, C, and 8.
-Also, M (define macro) when defining the r or s macros
-is also considered
-.q safe .
-.nr ii 1i
-.ip a\fIN\fP
-If set,
-wait up to
-.i N
-minutes for an
-.q @:@
-entry to exist in the alias database
-before starting up.
-If it does not appear in
-.i N
-minutes,
-rebuild the database
-(if the
-.b D
-option is also set)
-or issue a warning.
-.ip A\fIfile\fP
-Use the named
-.i file
-as the alias file.
-If no file is specified,
-use
-.i aliases
-in the current directory.
-.ip B\fIc\fP
-Set the blank substitution character to
-.i c .
-Unquoted spaces in addresses are replaced by this character.
+The class
+.b $=w
+is set to be the set of all names
+this host is known by.
+This can be used to match local hostnames.
+.pp
+The class
+.b $=k
+is set to be the same as
+.b $k ,
+that is, the UUCP node name.
+.sh 3 "M \*- define mailer"
+.pp
+Programs and interfaces to mailers
+are defined in this line.
+The format is:
+.(b F
+.b M \c
+.i name ,
+{\c
+.i field =\c
+.i value \|}*
+.)b
+where
+.i name
+is the name of the mailer
+(used internally only)
+and the
+.q field=name
+pairs define attributes of the mailer.
+Fields are:
+.(b
+.ta 1i
+Path   The pathname of the mailer
+Flags  Special flags for this mailer
+Sender A rewriting set for sender addresses
+Recipient      A rewriting set for recipient addresses
+Argv   An argument vector to pass to this mailer
+Eol    The end-of-line string for this mailer
+Maxsize        The maximum message length to this mailer
+Linelimit      The maximum line length in the message body
+.)b
+Only the first character of the field name is checked.
+.pp
+The following flags may be set in the mailer description.
+Any other flags may be used freely
+to conditionally assign headers to messages
+destined for particular mailers.
+.nr ii 4n
 .ip c
 .ip c
-If an outgoing mailer is marked as being expensive,
-don't connect immediately.
-This requires that queueing be compiled in,
-since it will depend on a queue run process to
-actually send the mail.
-.ip C\fIN\fP
-Checkpoints the queue every
-.i N
-(default 10)
-addresses sent.
-If your system crashes during delivery to a large list,
-this prevents retransmission to any but the last
-.I N
-recipients.
-.ip d\fIx\fP
-Deliver in mode
-.i x .
-Legal modes are:
+Do not include comments in addresses.
+This should only be used if you have to work around
+a remote mailer that gets confused by comments.
+.ip C
+If mail is
+.i received
+from a mailer with this flag set,
+any addresses in the header that do not have an at sign
+(\c
+.q @ )
+after being rewritten by ruleset three
+will have the
+.q @domain
+clause from the sender
+tacked on.
+This allows mail with headers of the form:
 .(b
 .(b
-.ta 4n
-i      Deliver interactively (synchronously)
-b      Deliver in background (asynchronously)
-q      Just queue the message (deliver during queue run)
+From: usera@hosta
+To: userb@hostb, userc
 .)b
 .)b
-.ip D
-If set,
-rebuild the alias database if necessary and possible.
-If this option is not set,
-.i sendmail
-will never rebuild the alias database
-unless explicitly requested
-using
-.b \-bi .
-.ip e\fIx\fP
-Dispose of errors using mode
-.i x .
-The values for
-.i x
-are:
+to be rewritten as:
 .(b
 .(b
-p      Print error messages (default)
-q      No messages, just give exit status
-m      Mail back errors
-w      Write back errors (mail if user not logged in)
-e      Mail back errors and give zero exit stat always
+From: usera@hosta
+To: userb@hostb, userc@hosta
 .)b
 .)b
-.ip E\fIfile/message\fP
-Prepend error messages with the indicated message.
-If it begins with a slash,
-it is assumed to be the pathname of a file
-containing a message (this is the recommended setting).
-Otherwise, it is a literal message.
-The error file might contain the name, email address, and/or phone number
-of a local postmaster who could provide assistance
-in to end users.
-If the option is missing or null,
-or if it names a file which does not exist or which is not readable,
-no message is printed.
-.ip f
-Save
-Unix-style
+automatically.
+.ip D
+This mailer wants a
+.q Date:
+header line.
+.ip e
+This mailer is expensive to connect to,
+so try to avoid connecting normally;
+any necessary connection will occur during a queue run.
+.ip E
+Escape lines beginning with
 .q From
 .q From
-lines at the front of headers.
-Normally they are assumed redundant
-and discarded.
-.ip F\fImode\fP
-The file mode for queue files.
-.ip g\fIn\fP
-Set the default group id
-for mailers to run in
-to
-.i n .
-.ip h\fIN\fP
-The maximum hop count.
-Messages that have been processed more than
-.i N
-times are assumed to be in a loop and are rejected.
-.ip H\fIfile\fP
-Specify the help file
-for SMTP.
-.ip i
-Ignore dots in incoming messages.
+in the message with a `>' sign.
+.ip f
+The mailer wants a
+.b \-f
+.i from
+flag,
+but only if this is a network forward operation
+(i.e.,
+the mailer will give an error
+if the executing user
+does not have special permissions).
+.ip F
+This mailer wants a
+.q From:
+header line.
+.ip h
+Upper case should be preserved in host names
+for this mailer.
 .ip I
 .ip I
-Insist that the BIND name server be running
-to resolve host names.
-If this is not set and the name server is not running,
-the
-.i /etc/hosts
-file will be considered complete.
-In general, you do want to set this option
-if your
-.i /etc/hosts
-file does not include all hosts known to you
-or if you are using the MX (mail forwarding) feature of the BIND name server.
-The name server will still be consulted
-even if this option is not set, but
-.i sendmail
-will feel free to resort to reading
-.i /etc/hosts
-if the name server is not available.
-Thus, you should
-.i never
-set this option if you do not run the name server.
-.ip J\fIpath\fP
-Set the path for searching for users' .forward files.
-The default is
-.q $z/.forward .
-Some sites that use the automounter may prefer to change this to
-.q /var/forward/$u
-to search a file with the same name as the user in a system directory.
-It can also be set to a sequence of paths separated by colons;
-.i sendmail
-stops at the first file it can successfully and safely open.
-For example,
-.q /var/forward/$u:$z/.forward
-will search first in /var/forward/\c
-.i username
-and then in
-.i ~username /.forward
-(but only if the first file does not exist).
-.ip k\fIN\fP
-The maximum number of open connections that will be cached at a time.
-The default is one.
-This delays closing the the current connection until
-either this invocation of sendmail needs to connect to another host
-or it terminates.
-Setting it to zero defaults to the old behavior,
-that is, connections are closed immediately.
-.ip K\fItimeout\fP
-The maximum amount of time a cached connection will be permitted to idle
-without activity.
-If this time is exceeded,
-the connection is immediately closed.
-This value should be small (on the order of ten minutes).
-Before
-.b sendmail
-uses a cached connection,
-it always sends a NOOP (no operation) command
-to check the connection;
-if this fails, it reopens the connection.
-This keeps your end from failing if the other end times out.
-The point of this option is to be a good network neighbor
-and avoid using up excessive resources
-on the other end.
-The default is five minutes.
-.ip L\fIn\fP
-Set the default log level to
-.i n .
-.ip m
-Send to me too,
-even if I am in an alias expansion.
-.ip M\fIx\|value\fP
-Set the macro
-.i x
-to
-.i value .
-This is intended only for use from the command line.
-.ip o
-Assume that the headers may be in old format,
-i.e.,
-spaces delimit names.
-This actually turns on
-an adaptive algorithm:
-if any recipient address contains a comma, parenthesis,
-or angle bracket,
-it will be assumed that commas already exist.
-If this flag is not on,
-only commas delimit names.
-Headers are always output with commas between the names.
-.ip P\fIpostmaster\fP
-If set,
-copies of error messages will be sent to the named
-.i postmaster .
-Since most errors are user problems,
-this is probably not a good idea on large sites,
-and arguably contains all sorts of privacy violations,
-but it seems to be popular with certain operating systems vendors.
-.ip q\fIfactor\fP
-Use
-.i factor
-as the multiplier in the map function
-to decide when to just queue up jobs rather than run them.
-This value is divided by the difference between the current load average
-and the load average limit
-(\c
-.b x
-flag)
-to determine the maximum message priority
-that will be sent.
-Defaults to 10000.
-.ip Q\fIdir\fP
-Use the named
-.i dir
-as the queue directory.
-.ip r\fItime\fP
-Timeout reads after
-.i time
-interval.
-.ip s
-Be super-safe when running things,
-i.e.,
-always instantiate the queue file,
-even if you are going to attempt immediate delivery.
-.i Sendmail
-always instantiates the queue file
-before returning control the the client
-under any circumstances.
-.ip S\fIfile\fP
-Log statistics in the named
-.i file .
-.ip t\fIS,D\fP
-Set the local time zone name to
-.i S
-for standard time and
-.i D
-for daylight time;
-this is only used under version six.
-.ip T\fItime\fP
-Set the queue timeout to
-.i time .
-After this interval,
-messages that have not been successfully sent
-will be returned to the sender.
-.ip u\fIn\fP
-Set the default userid for mailers to
-.i n .
-Mailers without the
-.i S
-flag in the mailer definition
-will run as this user.
-.ip U\fIudbspec\fP
-The user database specification.
-.ip v
-Run in verbose mode.
-.ip w
-Asserts that this domain does not have wildcard MX records
-in the name server database.
-These wildcards can
-.q capture
-names that are directed outward
-and forward them back to your own site.
-If there are no wildcards matching your domain,
-this option will reduce name server load
-and improve performance.
-.ip x\fILA\fP
-When the system load average exceeds
-.i LA ,
-just queue messages
-(i.e., don't try to send them).
-.ip X\fILA\fP
-When the system load average exceeds
-.i LA ,
-refuse incoming SMTP connections.
-.ip y\fIfact\fP
-The indicated
-.i fact or
-is added to the priority (thus
-.i lowering
-the priority of the job)
-for each recipient,
-i.e., this value penalizes jobs with large numbers of recipients.
-.ip Y
-If set,
-deliver each job that is run from the queue in a separate process.
-Use this option if you are short of memory,
-since the default tends to consume considerable amounts of memory
-while the queue is being processed.
-.ip z\fIfact\fP
-The indicated
-.i fact or
-is multiplied by the message class
-(determined by the Precedence: field in the user header
-and the
-.b P
-lines in the configuration file)
-and subtracted from the priority.
-Thus, messages with a higher Priority: will be favored.
-.ip Z\fIfact\fP
-The
-.i fact or
-is added to the priority
-every time a job is processed.
-Thus,
-each time a job is processed,
-its priority will be decreased by the indicated value.
-In most environments this should be positive,
-since hosts that are down are all too often down for a long time.
-.ip 8
-Preserve eight bits of data in the body on input.
-Normally the input is stripped to seven bits as per RFC822.
-See also the
-.b L
-mailer flag.
-.sh 2 "Mailer Flags"
-The following flags may be set in the mailer description.
-.nr ii 4n
-.ip A
-This is an Arpanet-compatible mailer,
-and all appropriate modes should be set.
-.ip C
-If mail is
-.i received
-from a mailer with this flag set,
-any addresses in the header that do not have an at sign
-(\c
-.q @ )
-after being rewritten by ruleset three
-will have the
-.q @domain
-clause from the sender
-tacked on.
-This allows mail with headers of the form:
-.(b
-From: usera@hosta
-To: userb@hostb, userc
-.)b
-to be rewritten as:
-.(b
-From: usera@hosta
-To: userb@hostb, userc@hosta
-.)b
-automatically.
-.ip D
-This mailer wants a
-.q Date:
-header line.
-.ip e
-This mailer is expensive to connect to,
-so try to avoid connecting normally;
-any necessary connection will occur during a queue run.
-.ip E
-Escape lines beginning with
-.q From
-in the message with a `>' sign.
-.ip f
-The mailer wants a
-.b \-f
-.i from
-flag,
-but only if this is a network forward operation
-(i.e.,
-the mailer will give an error
-if the executing user
-does not have special permissions).
-.ip F
-This mailer wants a
-.q From:
-header line.
-.ip h
-Upper case should be preserved in host names
-for this mailer.
-.ip I
-This mailer will be speaking SMTP
-to another
+This mailer will be speaking SMTP
+to another
 .i sendmail
 \*-
 as such it can use special protocol features.
 .i sendmail
 \*-
 as such it can use special protocol features.
@@ -3385,12 +2799,13 @@ Do not insert a UNIX-style
 .q From
 line on the front of the message.
 .ip p
 .q From
 line on the front of the message.
 .ip p
-Use the return-path in the SMTP
+Use the route-addr style reverse-path in the SMTP
 .q "MAIL FROM:"
 command
 rather than just the return address;
 .q "MAIL FROM:"
 command
 rather than just the return address;
-although this is required in RFC821,
-many hosts do not process return paths properly.
+although this is required in RFC821 section 3.1,
+many hosts do not process reverse-paths properly.
+Reverse-paths are officially discouraged by RFC 1123.
 .ip P
 This mailer wants a
 .q Return-Path:
 .ip P
 This mailer wants a
 .q Return-Path:
@@ -3449,6 +2864,830 @@ sufficient to get full eight bit data passed through
 the
 .b 8
 option must also be set.
 the
 .b 8
 option must also be set.
+.pp
+The mailer with the special name
+.q error
+can be used to generate a user error.
+The (optional) host field is an exit status to be returned,
+and the user field is a message to be printed.
+The exit status may be numeric or one of the values
+USAGE, NOUSER, NOHOST, UNAVAILABLE, SOFTWARE, TEMPFAIL, PROTOCOL, or CONFIG
+to return the corresponding EX_ exit code.
+For example, the entry:
+.(b
+$#error $@ NOHOST $: Host unknown in this domain
+.)b
+on the RHS of a rule
+will cause the specified error to be generated
+and the
+.q "Host unknown"
+exit status to be returned
+if the LHS matches.
+This mailer is only functional in ruleset zero.
+.pp
+The mailer named
+.q local
+.i must
+be defined in every configuration file.
+This is used to deliver local mail,
+and is treated specially in several ways.
+Additionally, three other mailers named
+.q prog ,
+.q *file* ,
+and
+.q *include*
+may be defined to tune the delivery of messages to programs,
+files,
+and :include: lists respectively.
+They default to:
+.(b
+Mprog, P=/bin/sh, F=lsD, A=sh \-c $u
+M*file*, F=lsDEu, A=NULL
+M*include*, F=su, A=NULL
+.)b
+.pp
+The Sender and Recipient rewriting sets
+may either be a simple integer
+or may be two integers separated by a slash;
+if so, the first rewriting set is applied to envelope
+addresses
+and the second is applied to headers.
+.sh 3 "H \*- define header"
+.pp
+The format of the header lines that sendmail inserts into the message
+are defined by the
+.b H
+line.
+The syntax of this line is:
+.(b F
+.b H [\c
+.b ? \c
+.i mflags \c
+.b ? ]\c
+.i hname \c
+.b :
+.i htemplate
+.)b
+Continuation lines in this spec
+are reflected directly into the outgoing message.
+The
+.i htemplate
+is macro expanded before insertion into the message.
+If the
+.i mflags
+(surrounded by question marks)
+are specified,
+at least one of the specified flags
+must be stated in the mailer definition
+for this header to be automatically output.
+If one of these headers is in the input
+it is reflected to the output
+regardless of these flags.
+.pp
+Some headers have special semantics
+that will be described below.
+.sh 3 "O \*- set option"
+.pp
+There are a number of
+.q random
+options that
+can be set from a configuration file.
+Options are represented by single characters.
+The syntax of this line is:
+.(b F
+.b O \c
+.i o\|value
+.)b
+This sets option
+.i o
+to be
+.i value .
+Depending on the option,
+.i value
+may be a string, an integer,
+a boolean
+(with legal values
+.q t ,
+.q T ,
+.q f ,
+or
+.q F ;
+the default is TRUE),
+or
+a time interval.
+.pp
+The options supported are:
+.nr ii 1i
+.ip a\fIN\fP
+If set,
+wait up to
+.i N
+minutes for an
+.q @:@
+entry to exist in the alias database
+before starting up.
+If it does not appear in
+.i N
+minutes,
+rebuild the database
+(if the
+.b D
+option is also set)
+or issue a warning.
+.ip A\fIfile\fP
+Use the named
+.i file
+as the alias file.
+If no file is specified,
+use
+.i aliases
+in the current directory.
+.ip b\fIN\fP
+Insist on at least
+.i N
+blocks free on the filesystem that holds the queue files
+before accepting email via SMTP.
+If there is insufficient space
+.i sendmail
+gives a 452 response
+to the MAIL command.
+This invites the sender to try again later.
+.ip B\fIc\fP
+Set the blank substitution character to
+.i c .
+Unquoted spaces in addresses are replaced by this character.
+Defaults to space (i.e., no change is made).
+.ip c
+If an outgoing mailer is marked as being expensive,
+don't connect immediately.
+This requires that queueing be compiled in,
+since it will depend on a queue run process to
+actually send the mail.
+.ip C\fIN\fP
+Checkpoints the queue every
+.i N
+(default 10)
+addresses sent.
+If your system crashes during delivery to a large list,
+this prevents retransmission to any but the last
+.I N
+recipients.
+.ip d\fIx\fP
+Deliver in mode
+.i x .
+Legal modes are:
+.(b
+.ta 4n
+i      Deliver interactively (synchronously)
+b      Deliver in background (asynchronously)
+q      Just queue the message (deliver during queue run)
+.)b
+Defaults to ``b''.
+.ip D
+If set,
+rebuild the alias database if necessary and possible.
+If this option is not set,
+.i sendmail
+will never rebuild the alias database
+unless explicitly requested
+using
+.b \-bi .
+.ip e\fIx\fP
+Dispose of errors using mode
+.i x .
+The values for
+.i x
+are:
+.(b
+p      Print error messages (default)
+q      No messages, just give exit status
+m      Mail back errors
+w      Write back errors (mail if user not logged in)
+e      Mail back errors and give zero exit stat always
+.)b
+.ip E\fIfile/message\fP
+Prepend error messages with the indicated message.
+If it begins with a slash,
+it is assumed to be the pathname of a file
+containing a message (this is the recommended setting).
+Otherwise, it is a literal message.
+The error file might contain the name, email address, and/or phone number
+of a local postmaster who could provide assistance
+in to end users.
+If the option is missing or null,
+or if it names a file which does not exist or which is not readable,
+no message is printed.
+.ip f
+Save
+Unix-style
+.q From
+lines at the front of headers.
+Normally they are assumed redundant
+and discarded.
+.ip F\fImode\fP
+The file mode for queue files.
+.ip g\fIn\fP
+Set the default group id
+for mailers to run in
+to
+.i n .
+Defaults to 1.
+.ip G
+Allow fuzzy matching on the GECOS field.
+If this flag is set,
+and the usual user name lookups fail
+(that is, there is no alias with this name and a
+.i getpwnam
+fails),
+sequentially search the password file
+for a matching entry in the GECOS field.
+This also requires that MATCHGECOS
+be turned on during compilation.
+This option is not recommended.
+.ip h\fIN\fP
+The maximum hop count.
+Messages that have been processed more than
+.i N
+times are assumed to be in a loop and are rejected.
+Defaults to 25.
+.ip H\fIfile\fP
+Specify the help file
+for SMTP.
+.ip i
+Ignore dots in incoming messages.
+This is always disabled (that is, dots are always accepted)
+when reading SMTP mail.
+.ip I
+Insist that the BIND name server be running
+to resolve host names.
+If this is not set and the name server is not running,
+the
+.i /etc/hosts
+file will be considered complete.
+In general, you do want to set this option
+if your
+.i /etc/hosts
+file does not include all hosts known to you
+or if you are using the MX (mail forwarding) feature of the BIND name server.
+The name server will still be consulted
+even if this option is not set, but
+.i sendmail
+will feel free to resort to reading
+.i /etc/hosts
+if the name server is not available.
+Thus, you should
+.i never
+set this option if you do not run the name server.
+.ip J\fIpath\fP
+Set the path for searching for users' .forward files.
+The default is
+.q $z/.forward .
+Some sites that use the automounter may prefer to change this to
+.q /var/forward/$u
+to search a file with the same name as the user in a system directory.
+It can also be set to a sequence of paths separated by colons;
+.i sendmail
+stops at the first file it can successfully and safely open.
+For example,
+.q /var/forward/$u:$z/.forward
+will search first in /var/forward/\c
+.i username
+and then in
+.i ~username /.forward
+(but only if the first file does not exist).
+.ip k\fIN\fP
+The maximum number of open connections that will be cached at a time.
+The default is one.
+This delays closing the the current connection until
+either this invocation of sendmail needs to connect to another host
+or it terminates.
+Setting it to zero defaults to the old behavior,
+that is, connections are closed immediately.
+.ip K\fItimeout\fP
+The maximum amount of time a cached connection will be permitted to idle
+without activity.
+If this time is exceeded,
+the connection is immediately closed.
+This value should be small (on the order of ten minutes).
+Before
+.b sendmail
+uses a cached connection,
+it always sends a NOOP (no operation) command
+to check the connection;
+if this fails, it reopens the connection.
+This keeps your end from failing if the other end times out.
+The point of this option is to be a good network neighbor
+and avoid using up excessive resources
+on the other end.
+The default is five minutes.
+.ip L\fIn\fP
+Set the default log level to
+.i n .
+Defaults to 9.
+.ip m
+Send to me too,
+even if I am in an alias expansion.
+.ip M\fIx\|value\fP
+Set the macro
+.i x
+to
+.i value .
+This is intended only for use from the command line.
+.ip o
+Assume that the headers may be in old format,
+i.e.,
+spaces delimit names.
+This actually turns on
+an adaptive algorithm:
+if any recipient address contains a comma, parenthesis,
+or angle bracket,
+it will be assumed that commas already exist.
+If this flag is not on,
+only commas delimit names.
+Headers are always output with commas between the names.
+.ip p\fI\|opt,opt,...\fP
+Set the privacy
+.i opt ions.
+``Privacy'' is really a misnomer;
+many of these are just a way of insisting on stricter adherence
+to the SMTP protocol.
+The
+.i opt ions
+can be selected from:
+.(b
+.ta \w'needvrfyhelo'u+3n
+public Allow open access
+needmailhelo   Insist on HELO command before MAIL
+needexpnhelo   Insist on HELO command before EXPN
+noexpn Disallow EXPN entirely
+needvrfyhelo   Insist on HELO command before VRFY
+novrfy Disallow VRFY entirely
+goaway Disallow essentially all status queries
+.)b
+.ip P\fIpostmaster\fP
+If set,
+copies of error messages will be sent to the named
+.i postmaster .
+Since most errors are user problems,
+this is probably not a good idea on large sites,
+and arguably contains all sorts of privacy violations,
+but it seems to be popular with certain operating systems vendors.
+.ip q\fIfactor\fP
+Use
+.i factor
+as the multiplier in the map function
+to decide when to just queue up jobs rather than run them.
+This value is divided by the difference between the current load average
+and the load average limit
+(\c
+.b x
+flag)
+to determine the maximum message priority
+that will be sent.
+Defaults to 600000.
+.ip Q\fIdir\fP
+Use the named
+.i dir
+as the queue directory.
+.ip r\|\fItimeouts\fP
+Timeout reads after
+.i time
+interval.
+The
+.i timeouts
+argument is a list of
+.i keyword=value
+pairs.
+The recognized timeouts and their default values, and their
+minimum values specified in RFC 1123 section 5.3.2 are:
+.(b
+.ta \w'datafinal'u+3n
+initial        wait for initial greeting message [5m, 5m]
+helo   reply to HELO command [5m, none]
+mail   reply to MAIL command [10m, 5m]
+rcpt   reply to RCPT command [1h, 5m]
+datainit       reply to DATA command [5m, 2m]
+datablock      data block read [1h, 3m]
+datafinal      reply to final ``.'' in data [1h, 10m]
+rset   reply to RSET command [5m, none]
+quit   reply to QUIT command [2m, none]
+misc   reply to NOOP and VERB commands [2m, none]
+command        command read [1h, 5m]
+.)b
+All but
+.q command
+apply to client SMTP.
+For back compatibility,
+a timeout with no ``keyword='' part
+will set all of the longer values.
+.ip s
+Be super-safe when running things,
+i.e.,
+always instantiate the queue file,
+even if you are going to attempt immediate delivery.
+.i Sendmail
+always instantiates the queue file
+before returning control the the client
+under any circumstances.
+.ip S\fIfile\fP
+Log statistics in the named
+.i file .
+.ip t\fIS,D\fP
+Set the local time zone name to
+.i S
+for standard time and
+.i D
+for daylight time;
+this is only used under version six.
+.ip T\fItime\fP
+Set the queue timeout to
+.i time .
+After this interval,
+messages that have not been successfully sent
+will be returned to the sender.
+Defaults to three days.
+.ip u\fIn\fP
+Set the default userid for mailers to
+.i n .
+Mailers without the
+.i S
+flag in the mailer definition
+will run as this user.
+Defaults to 1.
+.ip U\fIudbspec\fP
+The user database specification.
+.ip v
+Run in verbose mode.
+.ip x\fILA\fP
+When the system load average exceeds
+.i LA ,
+just queue messages
+(i.e., don't try to send them).
+Defaults to 8.
+.ip X\fILA\fP
+When the system load average exceeds
+.i LA ,
+refuse incoming SMTP connections.
+Defaults to 12.
+.ip y\fIfact\fP
+The indicated
+.i fact or
+is added to the priority (thus
+.i lowering
+the priority of the job)
+for each recipient,
+i.e., this value penalizes jobs with large numbers of recipients.
+Defaults to 30000.
+.ip Y
+If set,
+deliver each job that is run from the queue in a separate process.
+Use this option if you are short of memory,
+since the default tends to consume considerable amounts of memory
+while the queue is being processed.
+.ip z\fIfact\fP
+The indicated
+.i fact or
+is multiplied by the message class
+(determined by the Precedence: field in the user header
+and the
+.b P
+lines in the configuration file)
+and subtracted from the priority.
+Thus, messages with a higher Priority: will be favored.
+Defaults to 1800.
+.ip Z\fIfact\fP
+The
+.i fact or
+is added to the priority
+every time a job is processed.
+Thus,
+each time a job is processed,
+its priority will be decreased by the indicated value.
+In most environments this should be positive,
+since hosts that are down are all too often down for a long time.
+Defaults to 90000.
+.ip 8
+Preserve eight bits of data in the body on input.
+Normally the input is stripped to seven bits as per RFC822.
+See also the
+.b L
+mailer flag.
+.lp
+All options can be specified on the command line using the
+\-o flag,
+but most will cause
+.i sendmail
+to relinquish its setuid permissions.
+The options that will not cause this are
+b, d, e, E, i, L, m, o, p, r, s, v, C, and 8.
+Also, M (define macro) when defining the r or s macros
+is also considered
+.q safe .
+.sh 3 "T \*- define trusted users"
+.pp
+Trusted users
+are those users who are permitted
+to override the sender address
+using the
+.b \-f
+flag.
+These typically are
+.q root,
+.q uucp,
+and
+.q network,
+but on some users it may be convenient
+to extend this list to include other users,
+perhaps to support
+a separate
+UUCP
+login for each host.
+The syntax of this line is:
+.(b F
+.b T \c
+.i user1
+.i user2 ...
+.)b
+There may be more than one of these lines.
+.sh 3 "P \*- precedence definitions"
+.pp
+Values for the
+.q "Precedence:"
+field may be defined using the
+.b P
+control line.
+The syntax of this field is:
+.(b
+\fBP\fP\fIname\fP\fB=\fP\fInum\fP
+.)b
+When the
+.i name
+is found in a
+.q Precedence:
+field,
+the message class is set to
+.i num .
+Higher numbers mean higher precedence.
+Numbers less than zero
+have the special property
+that if an error occurs during processing
+the body of the message will not be returned;
+this is expected to be used for
+.q "bulk"
+mail such as through mailing lists.
+The default precedence is zero.
+For example,
+our list of precedences is:
+.(b
+Pfirst-class=0
+Pspecial-delivery=100
+Plist=\-30
+Pbulk=\-60
+Pjunk=\-100
+.)b
+People writing mailing list exploders
+are encouraged to use
+.q "Precedence: list" .
+Older versions of
+.i sendmail
+(which discarded all error returns for negative precedences)
+didn't recognize this name, giving it a default precedence of zero.
+This allows list maintainers to see error returns
+on both old and new versions of
+.i sendmail .
+.sh 3 "V \*- configuration version level"
+.pp
+To provide compatibility with old configuration files,
+the
+.b V
+line has been added to define some very basic semantics
+of the configuration file.
+These are not intended to be long term supports;
+rather, they describe compatibility features
+which will probably be removed in future releases.
+.pp
+.q Old
+configuration files are defined as version level one.
+Version level two files make the following changes:
+.np
+Host name canonification ($[ ... $])
+appends a dot if the name is recognized;
+this gives the config file a way of finding out if anything matched.
+(Actually, this just initializes the
+.q host
+map with the
+.q \-a.
+flag \*- you can reset it to anything you prefer
+by declaring the map explicitly.)
+.np
+Default host name extension is consistent throughout processing;
+version level one configurations turned off domain extension
+(that is, adding the local domain name)
+during certain points in processing.
+Version level two configurations are expected to include a trailing dot
+to indicate that the name is already canonical.
+.np
+Local names that are not aliases
+are passed through a new distinguished ruleset five;
+this can be used to append a local relay.
+This behaviour can be prevented by resolving the local name
+with an initial `@'.
+That is, something that resolves to a local mailer and a user name of
+.q vikki
+will be passed through ruleset five,
+but a user name of
+.q @vikki
+will have the `@' stripped,
+will not be passed through ruleset five,
+but will otherwise be treated the same as the prior example.
+The expectation is that this might be used to implement a policy
+where mail sent to
+.q vikki
+was handled by a central hub,
+but mail sent to
+.q vikki@localhost
+was delivered directly.
+.pp
+Version level three files
+allow # initiated comments on all lines.
+Exceptions are backslash escaped # marks
+and the $# syntax.
+.pp
+Version level four configuration files
+send error messages with a return path of
+.q <>
+as permitted by RFC 821 section 3.6
+and required by RFC 1123 section 5.3.3.
+This is not the default
+because this breaks older configuration files.
+Note that the macro
+.b $n
+is still used to specify the envelope From: header value.
+.sh 3 "K \*- key file declaration"
+.pp
+Special maps can be defined using the line:
+.(b
+Kmapname mapclass arguments
+.)b
+The
+.i mapname
+is the handle by which this map is referenced in the rewriting rules.
+The
+.i mapclass
+is the name of a type of map;
+these are compiled in to sendmail.
+The
+.i arguments
+are interpreted depending on the class;
+typically,
+there would be a single argument naming the file containing the map.
+.pp
+Maps are referenced using the syntax:
+.(b
+$( \fImap\fP \fIkey\fP $@ \fIarguments\fP $: \fIdefault\fP $)
+.)b
+where either or both of the
+.i arguments
+or
+.i default
+portion may be omitted.
+The
+.i arguments
+may appear more than once.
+The indicated
+.i key
+and
+.i arguments
+are passed to the appropriate mapping function.
+If it returns a value, it replaces the input.
+If it does not return a value and the
+.i default
+is specified, the
+.i default
+replaces the input.
+Otherwise, the input is unchanged.
+.pp
+During replacement of either a map value or default
+the string
+.q %\fIn\fP
+(where
+.i n
+is a digit)
+is replaced by the corresponding
+.i argument .
+Argument zero
+is always the database key.
+For example, the rule
+.(b
+.ta 1.5i
+R$- ! $+       $: $(uucp $1 $@ $2 $: %1 @ %0 . UUCP $)
+.)b
+Looks up the UUCP name in a (user defined) UUCP map;
+if not found it turns it into
+.q \&.UUCP
+form.
+The database might contain records like:
+.(b
+decvax %1@%0.DEC.COM
+research       %1@%0.ATT.COM
+.)b
+.pp
+The built in map with both name and class
+.q host
+is the host name canonicalization lookup.
+Thus,
+the syntax:
+.(b
+$(host \fIhostname\fP$)
+.)b
+is equivalent to:
+.(b
+$[\fIhostname\fP$]
+.)b
+.pp
+There are four predefined database lookup classes:
+.q dbm ,
+.q btree ,
+.q hash ,
+and
+.q nis .
+The first requires that sendmail be compiled with the
+.b ndbm
+library;
+the second two require the
+.b db
+library,
+and the third requires that sendmail be compiled with NIS support.
+All four accept as arguments the some optional flags
+and a filename (or a mapname for NIS).
+Known flags are:
+.ip "\-o"
+Indicates that this map is optional \*- that is,
+if it cannot be opened,
+no error is produced,
+and sendmail will behave as if the map existed but was empty.
+.ip "\-N"
+Normally sendmail does not include the trailing null byte
+on a string as part of the key.
+If this flag is indicated,
+it will be included.
+This is for compatibility with some methods of building the maps.
+.ip "\-a\fIx\fP"
+Append the character
+.i x
+on successful matches.
+For example, the default
+.i host
+map appends a dot on successful matches.
+.ip "\-d\fIdomain\fP"
+Use the indicated
+.i domain
+instead of the default domain.
+Used only for NIS maps.
+.ip "\-f"
+Fold upper to lower case before looking up the key.
+.ip "\-m"
+Match only (without replacing the value).
+If you only care about the existence of a key and not the value
+(as you might when searching the NIS map
+.q hosts.byname
+for example),
+this flag prevents the map from substituting the value.
+However,
+The \-a argument is still appended on a match,
+and the default is still taken if the match fails.
+.pp
+The
+.i dbm
+map appends the strings
+.q \&.pag
+and
+.q \&.dir
+to the given filename;
+the two
+.i db -based
+maps do not.
+.pp
+The program
+.i makemap (8)
+can be used to build any of the three database-oriented maps.
+It takes the following flags:
+.ip \-f
+Fold upper to lower case in the map.
+.ip \-N
+Include null bytes in keys.
+.ip \-o
+Append to an existing (old) file.
+.ip \-r
+Allow replacement of existing keys;
+normally, re-inserting an existing key is an error.
+.ip \-v
+Print what is happening.
+.pp
+New classes can be added in the routine
+.b setupmaps
+in file
+.b conf.c .
 .sh 2 "Building a Configuration File From Scratch"
 .pp
 Building a configuration table from scratch is an extremely difficult job.
 .sh 2 "Building a Configuration File From Scratch"
 .pp
 Building a configuration table from scratch is an extremely difficult job.
@@ -3463,6 +3702,13 @@ This section is intended to explain what the real purpose
 of a configuration table is
 and to give you some ideas
 for what your philosophy might be.
 of a configuration table is
 and to give you some ideas
 for what your philosophy might be.
+.pp
+.b "Do not even consider"
+writing your own configuration file
+without carefully studying
+RFC 821, 822, and 1123.
+You should also read RFC 976
+if you are doing UUCP exchange.
 .sh 3 "What you are trying to do"
 .pp
 The configuration table has three major purposes.
 .sh 3 "What you are trying to do"
 .pp
 The configuration table has three major purposes.
@@ -3506,20 +3752,25 @@ of the mailer.
 The particular philosophy you choose will depend heavily
 on the size and structure of your organization.
 I will present a few possible philosophies here.
 The particular philosophy you choose will depend heavily
 on the size and structure of your organization.
 I will present a few possible philosophies here.
+There are as many philosophies as there are config designers;
+feel free to develop your own.
 .pp
 One general point applies to all of these philosophies:
 it is almost always a mistake
 to try to do full name resolution.
 For example,
 .pp
 One general point applies to all of these philosophies:
 it is almost always a mistake
 to try to do full name resolution.
 For example,
-if you are trying to get names of the form
+if you are on a UUCP-only site
+and you are trying to get names of the form
 .q user@host
 .q user@host
-to the Arpanet,
+to the Internet,
 it does not pay to route them to
 it does not pay to route them to
-.q xyzvax!decvax!ucbvax!c70:user@host
+.q xyzvax!decvax!ucbvax!c70!user@host
 since you then depend on several links not under your control.
 The best approach to this problem
 since you then depend on several links not under your control.
 The best approach to this problem
-is to simply forward to
-.q xyzvax!user@host
+is to simply forward the message for
+.q user@host
+to
+.q xyzvax
 and let xyzvax
 worry about it from there.
 In summary,
 and let xyzvax
 worry about it from there.
 In summary,
@@ -3542,14 +3793,16 @@ should be hints rather than solid information.
 .pp
 For example,
 a typical site on our local ether network is
 .pp
 For example,
 a typical site on our local ether network is
-.q monet.
+.q monet
+(actually
+.q monet.CS.Berkeley.EDU ).
 When monet receives mail for delivery,
 it checks whether it knows
 that the destination host is directly reachable;
 if so, mail is sent to that host.
 If it receives mail for any unknown host,
 it just passes it directly to
 When monet receives mail for delivery,
 it checks whether it knows
 that the destination host is directly reachable;
 if so, mail is sent to that host.
 If it receives mail for any unknown host,
 it just passes it directly to
-.q ucbvax,
+.q ucbvax.CS.Berkeley.EDU ,
 our master host.
 Ucbvax may determine that the host name is illegal
 and reject the message,
 our master host.
 Ucbvax may determine that the host name is illegal
 and reject the message,
@@ -3632,11 +3885,50 @@ you might find it useful to know about the names of hosts
 connected directly to you,
 but this is really not necessary
 since this may be determined from the syntax.
 connected directly to you,
 but this is really not necessary
 since this may be determined from the syntax.
+.sh 4 "A completely different philosophy"
+.pp
+This is adapted from Bruce Lilly.
+Any errors in interpretation are mine.
+.pp
+Do minimal changes in ruleset 3:
+fix some common but unambiguous errors (e.g. trailing dot on domains) and
+hide bang paths foo!bar into bar@foo.UUCP.
+The resulting "canonical" form is any valid RFC822/RFC1123/RFC976 address.
+.pp
+Ruleset 0 does the bulk of the work.
+It removes the trailing "@.UUCP" that hides bang paths,
+strips anything not needed to resolve,
+e.g. the phrase from phrase <route-addr> and from named groups,
+rejects unparseable addresses using $#error,
+and finally
+resolves to a mailer/host/user triple.
+Ruleset 0 is rather lengthy
+as it has to handle 3 basic address forms:
+RFC976 bang paths,
+RFC1123 %-hacks
+(including vanilla RFC822 local-part@domain),
+and RFC822 source routes.
+It's also complicated by having to handle named lists.
+.pp
+The header rewriting rulesets 1 and 2
+remove the trailing "@.UUCP" that hides bang paths.
+Ruleset 2 also strips the $# mailer $@ host (for test mode).
+.pp
+Ruleset 4 does absolutely nothing.
+.pp
+The per-mailer rewriting rulesets conform the envelope and
+header addresses to the requirements of the specific
+mailer.
+.pp
+Lots of rulesets-as-subroutines are used.
+.pp
+As a result, header addresses are subject to minimal munging
+(per RFC1123), and the general plan is per RFC822 sect. 3.4.10.
 .sh 3 "Relevant issues"
 .pp
 The canonical form you use
 should almost certainly be as specified in
 .sh 3 "Relevant issues"
 .pp
 The canonical form you use
 should almost certainly be as specified in
-the Arpanet protocols
+the Internet protocols
 RFC819 and RFC822.
 Copies of these RFC's are included on the
 .i sendmail
 RFC819 and RFC822.
 Copies of these RFC's are included on the
 .i sendmail
@@ -3756,11 +4048,10 @@ Test mode shows you the steps it takes
 as it proceeds,
 finally showing you the address it ends up with.
 You may use a comma separated list of rwsets
 as it proceeds,
 finally showing you the address it ends up with.
 You may use a comma separated list of rwsets
-for sequential application of rules to an input;
-ruleset three is always applied first.
+for sequential application of rules to an input.
 For example:
 .(b
 For example:
 .(b
-1,21,4 monet:bollard
+3,1,21,4 monet:bollard
 .)b
 first applies ruleset three to the input
 .q monet:bollard.
 .)b
 first applies ruleset three to the input
 .q monet:bollard.
@@ -3778,6 +4069,19 @@ sendmail \-bt \-d21.99
 turns on an incredible amount of information;
 a single word address
 is probably going to print out several pages worth of information.
 turns on an incredible amount of information;
 a single word address
 is probably going to print out several pages worth of information.
+.pp
+You should be warned that internally,
+.b sendmail
+applies ruleset 3 to all addresses.
+In this version of sendmail, you will have to do that manually.
+For example, older versions allowed you to use
+.(b
+0 bruce@broadcast.sony.com
+.)b
+This version requires that you use:
+.(b
+3,0 bruce@broadcast.sony.com
+.)b
 .sh 3 "Building mailer descriptions"
 .pp
 To add an outgoing mailer to your mail system,
 .sh 3 "Building mailer descriptions"
 .pp
 To add an outgoing mailer to your mail system,
@@ -3883,19 +4187,19 @@ that do not already contain a domain spec.
 For example,
 a message of the form:
 .(b
 For example,
 a message of the form:
 .(b
-From: eric@ucbarpa
-To: wnj@monet, mckusick
+From: eric@vangogh.CS.Berkeley.EDU
+To: wnj@monet.CS.Berkeley.EDU, mckusick
 .)b
 will be modified to:
 .(b
 .)b
 will be modified to:
 .(b
-From: eric@ucbarpa
-To: wnj@monet, mckusick@ucbarpa
+From: eric@vangogh.CS.Berkeley.EDU
+To: wnj@monet.CS.Berkeley.EDU, mckusick@vangogh.CS.Berkeley.EDU
 .)b
 .i "if and only if"
 the
 .q C
 flag is defined in the mailer corresponding to
 .)b
 .i "if and only if"
 the
 .q C
 flag is defined in the mailer corresponding to
-.q eric@ucbarpa.
+.q eric@vangogh.CS.Berkeley.EDU.
 .pp
 Other flags are described
 in Appendix C.
 .pp
 Other flags are described
 in Appendix C.
@@ -3920,7 +4224,7 @@ From: eric
 .)b
 might be changed to be:
 .(b
 .)b
 might be changed to be:
 .(b
-From: eric@ucbarpa
+From: eric@vangogh.CS.Berkeley.EDU
 .)b
 or
 .(b
 .)b
 or
 .(b
@@ -4127,46 +4431,116 @@ This section describes what changes can be made
 and what has to be modified to make them.
 .sh 2 "Parameters in src/Makefile"
 .pp
 and what has to be modified to make them.
 .sh 2 "Parameters in src/Makefile"
 .pp
-These parameters are not intended to describe site policy;
-these should be defined in src/conf.h.
-.ip DBM
-If set,
-the
-.q DBM
-package in UNIX is used
-(see
-.i dbm(3X)
-in the UNIX Programmer's Manual).
-If not set,
-a much less efficient algorithm for processing aliases is used.
+These parameters are intended to describe the compilation environment,
+not site policy,
+and should normally be defined in src/Makefile.
 .ip NDBM
 If set,
 the new version of the DBM library
 that allows multiple databases will be used.
 .ip NDBM
 If set,
 the new version of the DBM library
 that allows multiple databases will be used.
-.q DBM
-must also be set.
+If neither NDBM nor NEWDB are set,
+a much less efficient method of alias lookup is used.
 .ip NEWDB
 If set, use the new database package from Berkeley (from 4.4BSD).
 This package is substantially faster than DBM or NDBM.
 .ip NEWDB
 If set, use the new database package from Berkeley (from 4.4BSD).
 This package is substantially faster than DBM or NDBM.
-If NEWDB and DBM are both set,
-sendmail will read old DBM files,
+If NEWDB and NDBM are both set,
+sendmail will read DBM files,
 but will create and use NEWDB files.
 but will create and use NEWDB files.
+.ip YPCOMPAT
+If set together with
+.i both
+NEWDB and NDBM,
+.i sendmail
+will create both DBM and NEWDB files if and only if
+the file /var/yp/Makefile
+exists and is readable.
+This is intended for compatibility with Sun Microsystems'
+.i mkalias
+program used on YP masters.
+.ip SYSTEM5
+Set all of the compilation parameters appropriate for System V.
 .ip LOCKF
 Use System V
 .b lockf
 instead of Berkeley
 .b flock .
 .ip LOCKF
 Use System V
 .b lockf
 instead of Berkeley
 .b flock .
-Due to brain damage in
+Due to the highly unusual semantics of locks
+across forks in
 .b lockf ,
 this should never be used unless absolutely necessary.
 .b lockf ,
 this should never be used unless absolutely necessary.
+Set by default if
+SYSTEM5 is set.
 .ip SYS5TZ
 Use System V
 time zone semantics.
 .ip SYS5TZ
 Use System V
 time zone semantics.
-.ip SYSTEM5
-Set all of the compilation parameters appropriate for System V.
+.ip HASINITGROUPS
+Set this if your system has the
+.i initgroups()
+call
+(if you have multiple group support).
+This is the default if SYSTEM5 is
+.i not
+defined or if you are on HPUX.
+.ip HASUNAME
+Set this if you have the
+.i uname (2)
+system call (or corresponding library routine).
+Set by default if
+SYSTEM5
+is set.
+.ip HASSTATFS
+Set this if you have the
+.i statfs (2)
+system call.
+This will allow you to give a temporary failure
+message to incoming SMTP email
+when you are low on disk space.
+It is set by default on 4.4 BSD and OSF/1 systems.
 .ip LA_TYPE
 The load average type.
 Details are described below.
 .ip LA_TYPE
 The load average type.
 Details are described below.
+.lp
+The are four built-in ways of computing the load average.
+.i Sendmail
+tries to auto-configure them based on imperfect guesses;
+you can select one using the
+.i cc
+option
+.b \-DLA_TYPE= \c
+.i type ,
+where
+.i type
+is:
+.ip LA_INT
+The kernel stores the load average in the kernel as an array of long integers.
+The actual values are scaled by a factor FSCALE
+(default 256).
+.ip LA_FLOAT
+The kernel stores the load average in the kernel as an array of
+double precision floats.
+.ip LA_SUBR
+Call the
+.i getloadavg
+routine to get the load average as an array of doubles.
+.ip LA_ZERO
+Always return zero as the load average.
+This is the fallback case.
+.lp
+If type
+.sm LA_INT
+or
+.sm LA_FLOAT
+is specified,
+you may also need to specify
+.sm _PATH_UNIX
+(the path to your system binary)
+and
+.sm LA_AVENRUN
+(the name of the variable containing the load average in the kernel;
+usually
+.q _avenrun
+or
+.q avenrun ).
 .sh 2 "Parameters in src/conf.h"
 .pp
 Parameters and compilation options
 .sh 2 "Parameters in src/conf.h"
 .pp
 Parameters and compilation options
@@ -4232,6 +4606,10 @@ The maximum number of entries that will be processed
 in a single queue run.
 .ip "MAXMXHOSTS [20]"
 The maximum number of MX records we will accept for any single host.
 in a single queue run.
 .ip "MAXMXHOSTS [20]"
 The maximum number of MX records we will accept for any single host.
+.ip "MAXIPADDR [16]"
+The maximum number of numeric IP addresses we will accept
+for this host.
+This does not limit the number the number of addresses for other hosts.
 .lp
 A number of other compilation options exist.
 These specify whether or not specific code should be compiled in.
 .lp
 A number of other compilation options exist.
 These specify whether or not specific code should be compiled in.
@@ -4311,6 +4689,9 @@ It also uses the NEWDB package.
 This may change in future releases.
 .sh 2 "Configuration in src/conf.c"
 .pp
 This may change in future releases.
 .sh 2 "Configuration in src/conf.c"
 .pp
+The following changes can be made in conf.c.
+.sh 3 "Built-in Header Semantics"
+.pp
 Not all header semantics are defined in the configuration file.
 Header lines that should only be included by certain mailers
 (as well as other more obscure semantics)
 Not all header semantics are defined in the configuration file.
 Header lines that should only be included by certain mailers
 (as well as other more obscure semantics)
@@ -4456,7 +4837,13 @@ the
 and
 .q From:
 fields are always scanned on ARPANET mail
 and
 .q From:
 fields are always scanned on ARPANET mail
-to determine the sender;
+to determine the sender\**;
+.(f
+\**Actually, this is no longer true in SMTP;
+this information is contained in the envelope.
+The older ARPANET protocols did not completely distinguish
+envelope from header.
+.)f
 this is used to perform the
 .q "return to sender"
 function.
 this is used to perform the
 .q "return to sender"
 function.
@@ -4469,10 +4856,15 @@ if possible;
 this is stored in the macro
 .b $x
 and used in a number of ways.
 this is stored in the macro
 .b $x
 and used in a number of ways.
+.sh 3 "SMTP Reply Codes"
 .pp
 The file
 .i conf.c
 .pp
 The file
 .i conf.c
-also contains the specification of ARPANET reply codes.
+also contains the specification of Internet reply codes\**.
+.(f
+\**Called Arpanet in the source code
+for historic reasons.
+.)f
 There are four classifications these fall into:
 .(b
 .sz -1
 There are four classifications these fall into:
 .(b
 .sz -1
@@ -4512,26 +4904,30 @@ these are generated when the user has specified something wrong,
 and hence the error is permanent,
 i.e.,
 it will not work simply by resubmitting the request.
 and hence the error is permanent,
 i.e.,
 it will not work simply by resubmitting the request.
+.sh 3 "Restricting Use of Email"
 .pp
 If it is necessary to restrict mail through a relay,
 the
 .i checkcompat
 routine can be modified.
 This routine is called for every recipient address.
 .pp
 If it is necessary to restrict mail through a relay,
 the
 .i checkcompat
 routine can be modified.
 This routine is called for every recipient address.
-It can return
-.b TRUE
-to indicate that the address is acceptable
-and mail processing will continue,
-or it can return
-.b FALSE
-to reject the recipient.
-If it returns false,
-it is up to
+It returns an exit status
+indicating the status of the message.
+The status
+.sm EX_OK
+accepts the address,
+.sm EX_TEMPFAIL
+queues the message for a later try,
+and other values
+(commonly
+.sm EX_UNAVAILABLE )
+reject the message.
+It is up to
 .i checkcompat
 to print an error message
 (using
 .i usrerr )
 .i checkcompat
 to print an error message
 (using
 .i usrerr )
-saying why the message is rejected.
+if the message is rejected.
 For example,
 .i checkcompat
 could read:
 For example,
 .i checkcompat
 could read:
@@ -4539,17 +4935,27 @@ could read:
 .re
 .sz -1
 .ta 4n +4n +4n +4n +4n +4n +4n
 .re
 .sz -1
 .ta 4n +4n +4n +4n +4n +4n +4n
-bool
-checkcompat(to)
+int
+checkcompat(to, e)
        register ADDRESS *to;
        register ADDRESS *to;
+       register ENVELOPE *e;
 \&{
 \&{
-       if (MsgSize > 50000 && to->q_mailer != LocalMailer)
+       register STAB *s;
+
+       s = stab("private", ST_MAILER, ST_FIND);
+       if (s != NULL && e\->e_from.q_mailer != LocalMailer &&
+           to->q_mailer == s->s_mailer)
+       {
+               usrerr("No private net mail allowed through this machine");
+               return (EX_UNAVAILABLE);
+       }
+       if (MsgSize > 50000 && to\->q_mailer != LocalMailer)
        {
                usrerr("Message too large for non-local delivery");
                NoReturn = TRUE;
        {
                usrerr("Message too large for non-local delivery");
                NoReturn = TRUE;
-               return (FALSE);
+               return (EX_UNAVAILABLE);
        }
        }
-       return (TRUE);
+       return (EX_OK);
 }
 .sz
 .)b
 }
 .sz
 .)b
@@ -4562,50 +4968,15 @@ of the message in the error return.
 The actual use of this routine is highly dependent on the
 implementation,
 and use should be limited.
 The actual use of this routine is highly dependent on the
 implementation,
 and use should be limited.
+.sh 3 "Load Average Computation"
 .pp
 The routine
 .i getla
 should return an approximation of the current system load average
 as an integer.
 .pp
 The routine
 .i getla
 should return an approximation of the current system load average
 as an integer.
-There are four versions included on compilation flags.
-You can force one version in the Makefile using the
-.i cc
-option
-.b \-DLA_TYPE= \c
-.i type ,
-where
-.i type
-is:
-.ip LA_INT
-The kernel stores the load average in the kernel as an array of long integers.
-The actual values are scaled by a factor FSCALE
-(default 256).
-.ip LA_FLOAT
-The kernel stores the load average in the kernel as an array of
-double precision floats.
-.ip LA_SUBR
-Call the
-.i getloadavg
-routine to get the load average as an array of doubles.
-.ip LA_ZERO
-Always return zero as the load average.
-This is the fallback case.
-.lp
-If type
-.sm LA_INT
-or
-.sm LA_FLOAT
-is specified,
-you may also need to specify
-.sm _PATH_UNIX
-(the path to your system binary)
-and
-.sm LA_AVENRUN
-(the name of the variable containing the load average in the kernel;
-usually
-.q _avenrun
-or
-.q avenrun ).
+There are four versions included on compilation flags
+as described above.
+.sh 3 "New Database Map Classes"
 .pp
 New key maps can be added by creating a class initialization function
 and a lookup function.
 .pp
 New key maps can be added by creating a class initialization function
 and a lookup function.
@@ -4649,6 +5020,104 @@ The
 .i av
 is a list of arguments passed in from the rewrite line.
 The lookup function should return a pointer to the new value.
 .i av
 is a list of arguments passed in from the rewrite line.
 The lookup function should return a pointer to the new value.
+.sh 3 "Queueing Function"
+.pp
+The routine
+.i shouldqueue
+is called to decide if a message should be queued
+or processed immediately.
+Typically this compares the message priority to the current load average.
+The default definition is:
+.(b
+bool
+shouldqueue(pri, ctime)
+       long pri;
+       time_t ctime;
+{
+       if (CurrentLA < QueueLA)
+               return (FALSE);
+       if (CurrentLA >= RefuseLA)
+               return (TRUE);
+       return (pri > (QueueFactor / (CurrentLA \- QueueLA + 1)));
+}
+.)b
+If the current load average
+(global variable
+.i CurrentLA ,
+which is set before this function is called)
+is less than the low threshold load average
+(option
+.b x ,
+variable
+.i QueueLA ),
+.i shouldqueue
+returns
+.sm FALSE
+immediately
+(that is, it should
+.i not
+queue).
+If the current load average exceeds the high threshold load average
+(option
+.b X ,
+variable
+.i RefuseLA ),
+.i shouldqueue
+returns
+.sm TRUE
+immediately.
+Otherwise, it computes the function based on the message priority,
+the queue factor
+(option
+.b q ,
+global variable
+.i QueueFactor ),
+and the current and threshold load averages.
+.pp
+An implementation wishing to take the actual age of the message into account
+can also use the
+.i ctime
+parameter,
+which is the time that the message was first submitted to
+.i sendmail .
+Note that the
+.i pri
+parameter is already weighted
+by the number of times the message has been tried
+(although this tends to lower the priority of the message with time);
+the expectation is that the
+.i ctime
+would be used as an
+.q "escape clause"
+to ensure that messages are eventually processed.
+.sh 3 "Refusing Incoming SMTP Connections"
+.pp
+The function
+.i refuseconnections
+returns
+.sm TRUE
+if incoming SMTP connections should be refused.
+The current implementation is based exclusively on the current load average
+and the refuse load average option
+(option
+.b X ,
+global variable
+.i RefuseLA ):
+.(b
+bool
+refuseconnections()
+{
+       return (CurrentLA >= RefuseLA);
+}
+.)b
+A more clever implementation
+could look at more system resources.
+.sh 3 "Load Average Computation"
+.pp
+The routine
+.i getla
+returns the current load average (as a rounded integer).
+The distribution includes several possible implementations.
 .sh 2 "Configuration in src/daemon.c"
 .pp
 The file
 .sh 2 "Configuration in src/daemon.c"
 .pp
 The file
@@ -4679,6 +5148,12 @@ those connections are cached for possible future use.
 The advent of MX records made this effective for mailing lists;
 in addition,
 substantial performance improvements can be expected for queue processing.
 The advent of MX records made this effective for mailing lists;
 in addition,
 substantial performance improvements can be expected for queue processing.
+.sh 2 "MX Piggybacking"
+.pp
+If two hosts with different names in a single message
+happen to have the same set of MX hosts,
+they can be sent in the same transaction.
+Release 6 notices this and tries to batch the messages.
 .sh 2 "Eight-Bit Clean"
 .pp
 Previous versions of
 .sh 2 "Eight-Bit Clean"
 .pp
 Previous versions of
@@ -4715,6 +5190,8 @@ Generalized keyed files is an idea taken directly from
 .b sendmail
 (albeit with a completely different implementation).
 They can be useful on large sites.
 .b sendmail
 (albeit with a completely different implementation).
 They can be useful on large sites.
+.pp
+R6 also understands YP.
 .sh 2 "Parsing Bug Fixes"
 .pp
 A number of small bugs having to do with things like
 .sh 2 "Parsing Bug Fixes"
 .pp
 A number of small bugs having to do with things like
@@ -4727,6 +5204,16 @@ these have both been made visible;
 the
 .b $<
 macro gives access to the envelope sender information.
 the
 .b $<
 macro gives access to the envelope sender information.
+.sh 2 "Separate Envelope/Header Processing"
+.pp
+The
+.b S enderRWSet
+and
+.b R ecipientRWset
+arguments for mailers
+can be specified as
+.i envelope/header
+to give different rewritings for envelope versus header addresses.
 .sh 2 "Dynamic Header Allocation"
 .pp
 The fixed size limit on header lines has been eliminated.
 .sh 2 "Dynamic Header Allocation"
 .pp
 The fixed size limit on header lines has been eliminated.
@@ -4740,12 +5227,16 @@ Several new options have been added,
 many to support new features,
 others to allow tuning that was previously available
 only by recompiling.
 many to support new features,
 others to allow tuning that was previously available
 only by recompiling.
-They are described in detail in Appendix B.
+They are described in detail in Section 5.1.5.
 Briefly,
 Briefly,
+.ip b
+Insist on a minimum number of disk blocks.
 .ip C
 Set checkpoint interval.
 .ip E
 Default error message.
 .ip C
 Set checkpoint interval.
 .ip E
 Default error message.
+.ip G
+Enable GECOS matching.
 .ip h
 Maximum hop count.
 .ip J
 .ip h
 Maximum hop count.
 .ip J
@@ -4754,12 +5245,29 @@ Forward file path.
 Connection cache size
 .ip K
 Connection cache lifetime.
 Connection cache size
 .ip K
 Connection cache lifetime.
+.ip p
+Privacy options.
 .ip U
 User database spec.
 .ip U
 User database spec.
-.ip w
-Domain has no wildcard MX.
 .ip 8
 Run eight bit clean.
 .ip 8
 Run eight bit clean.
+.sh 2 "Extended Options"
+.pp
+The
+.b r
+(read timeout)
+and
+.b I
+(use BIND)
+options have been extended to pass in more information.
+.sh 2 "New Mailer Flag"
+.pp
+The
+.b c
+mailer flag will strip all comments
+from addresses;
+this should only be used as a last resort
+when dealing with cranky mailers.
 .sh 2 "Bigger Defaults"
 .pp
 Release 6 allows up to 100 rulesets instead of 30.
 .sh 2 "Bigger Defaults"
 .pp
 Release 6 allows up to 100 rulesets instead of 30.
@@ -4771,6 +5279,65 @@ The total number of MX records that can be used has been raised to 20.
 .pp
 The number of queued messages that can be handled at one time
 has been raised from 600 to 1000.
 .pp
 The number of queued messages that can be handled at one time
 has been raised from 600 to 1000.
+.sh 2 "Different Default Tuning Parameters"
+.pp
+Release 6 has changed the default parameters
+for tuning queue costs
+to make the number of recipients more important
+than the size of the message (for small messages).
+This is reasonable if you are connected with reasonably fast links.
+.sh 2 "Auto-Quoting in Addresses"
+.pp
+Previously, the
+.q "Full Name <email address>"
+syntax would generate incorrect protocol output
+if
+.q "Full Name"
+had special characters such as dot.
+This version puts quotes around such names.
+.sh 2 "Symbolic Names On Error Mailer"
+.pp
+Several names have been built in to the $@ portion of the $#error
+mailer.
+.sh 2 "SMTP VRFY Doesn't Expand"
+.pp
+Previous versions of
+.i sendmail
+treated VRFY and EXPN the same.
+In this version,
+VRFY doesn't expand aliases or follow .forward files.
+.pp
+As an optimization, if you run with your default delivery mode being
+queue-only,
+the RCPT command will also not chase aliases and .forward files.
+It will chase them when it processes the queue.
+.sh 2 "Portability and Security Enhancements"
+.pp
+A number of internal changes have been made to enhance portability.
+.pp
+Several fixes have been made to increase the paranoia factor.
+.sh 1 "ACKNOWLEDGEMENTS"
+.pp
+I've worked on
+.i sendmail
+for many years,
+and many employers have been remarkably patient
+about letting me work on a large project
+that was not part of my official job.
+This includes time on the INGRES Project at Berkeley,
+at Britton Lee,
+and again on the Mammoth Project at Berkeley.
+.pp
+Much of the second wave of improvements
+should be credited to Bryan Costales of ICSI.
+As he passed me drafts of his book on
+.i sendmail
+I was inspired to start working on things again.
+Bryan was also available to bounce ideas off of.
+.pp
+Many, many people contributed chunks of code and ideas to
+.i sendmail .
+It has proven to be a group network effort.
 .++ A
 .+c "COMMAND LINE FLAGS"
 .ba 0
 .++ A
 .+c "COMMAND LINE FLAGS"
 .ba 0
@@ -5093,6 +5660,14 @@ represented as a memory image.
 The SMTP help file.
 .ip /etc/sendmail.st
 A statistics file; need not be present.
 The SMTP help file.
 .ip /etc/sendmail.st
 A statistics file; need not be present.
+.ip /etc/sendmail.pid
+Created in daemon mode;
+it contains the process id of the current SMTP daemon.
+If you use this in scripts;
+use ``head \-1'' to get just the first line;
+later versions of
+.i sendmail
+may add information to subsequent lines.
 .ip /etc/aliases
 The textual version of the alias file.
 .ip /etc/aliases.{pag,dir}
 .ip /etc/aliases
 The textual version of the alias file.
 .ip /etc/aliases.{pag,dir}
@@ -5127,7 +5702,7 @@ A transcript of the current session.
 .\"Eric Allman
 .\"Britton-Lee, Inc.
 .\".sp
 .\"Eric Allman
 .\"Britton-Lee, Inc.
 .\".sp
-.\"Version 5.24
+.\"Version 6.16
 .\".ce 0
 .pn 2
 .bp
 .\".ce 0
 .pn 2
 .bp