new doc makefiles
[unix-history] / usr / src / usr.sbin / sendmail / doc / intro / intro.me
CommitLineData
906fdf05 1.\"
906fdf05 2.\" Copyright (c) 1983 Eric P. Allman
2c57334f
KB
3.\" Copyright (c) 1988 The Regents of the University of California.
4.\" All rights reserved.
906fdf05 5.\"
2c57334f
KB
6.\" Redistribution and use in source and binary forms are permitted
7.\" provided that the above copyright notice and this paragraph are
8.\" duplicated in all such forms and that any documentation,
9.\" advertising materials, and other materials related to such
10.\" distribution and use acknowledge that the software was developed
11.\" by the University of California, Berkeley. The name of the
12.\" University may not be used to endorse or promote products derived
13.\" from this software without specific prior written permission.
14.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
906fdf05 17.\"
d754edf0 18.\" @(#)intro.me 6.4 (Berkeley) %G%
906fdf05 19.\"
13c6ffb1 20.\" pic -Pxx intro.me | ditroff -me -Pxx
bc431e5e
KD
21.eh 'SMM:16-%''SENDMAIL \*- An Internetwork Mail Router'
22.oh 'SENDMAIL \*- An Internetwork Mail Router''SMM:16-%'
7f667328 23.nr si 3n
74b6e641 24.if n .ls 2
64dbe651
EA
25.+c
26.(l C
d5bda243 27.sz 14
fbbba053 28SENDMAIL \*- An Internetwork Mail Router
64dbe651
EA
29.sz
30.sp
fe65cf0c 31Eric Allman\(dg
d5bda243 32.sp 0.5
64dbe651 33.i
d754edf0
EA
34University of California, Berkeley
35Mammoth Project
64dbe651 36.)l
fbbba053
EA
37.sp
38.(l F
39.ce
40ABSTRACT
1c9783dc 41.sp \n(psu
fbbba053
EA
42Routing mail through a heterogenous internet presents many new
43problems. Among the worst of these is that of address mapping.
37a260a5
EA
44Historically, this has been handled on an
45.i "ad hoc"
46basis. However,
fbbba053 47this approach has become unmanageable as internets grow.
1c9783dc 48.sp \n(psu
fbbba053
EA
49Sendmail acts a unified "post office" to which all mail can be
50submitted. Address interpretation is controlled by a production
51system, which can parse both domain-based addressing and old-style
37a260a5
EA
52.i "ad hoc"
53addresses.
1c9783dc 54The production system is powerful
fbbba053
EA
55enough to rewrite addresses in the message header to conform to the
56standards of a number of common target networks, including old
57(NCP/RFC733) Arpanet, new (TCP/RFC822) Arpanet, UUCP, and Phonenet.
1c9783dc 58Sendmail also implements an SMTP server, message
fbbba053 59queueing, and aliasing.
fbbba053 60.)l
d5bda243 61.sp 2
64dbe651 62.(f
1c9783dc
EA
63\(dgA considerable part of this work
64was done while under the employ
65of the INGRES Project
d754edf0
EA
66at the University of California at Berkeley
67and at Britton Lee.
fe65cf0c 68.)f
64dbe651
EA
69.pp
70.i Sendmail
d5bda243
EA
71implements a general internetwork mail routing facility,
72featuring aliasing and forwarding,
64dbe651
EA
73automatic routing to network gateways,
74and flexible configuration.
75.pp
fbbba053
EA
76In a simple network,
77each node has an address,
78and resources can be identified
7fa298c9
EA
79with a host-resource pair;
80in particular,
fbbba053 81the mail system can refer to users
7fa298c9 82using a host-username pair.
fbbba053
EA
83Host names and numbers have to be administered by a central authority,
84but usernames can be assigned locally to each host.
85.pp
86In an internet,
1c9783dc
EA
87multiple networks with different characterstics
88and managements
dccb3105 89must communicate.
fbbba053
EA
90In particular,
91the syntax and semantics of resource identification change.
92Certain special cases can be handled trivially
37a260a5
EA
93by
94.i "ad hoc"
95techniques,
fbbba053
EA
96such as
97providing network names that appear local to hosts
7fa298c9 98on other networks,
01e97e73 99as with the Ethernet at Xerox PARC.
fbbba053
EA
100However, the general case is extremely complex.
101For example,
102some networks require point-to-point routing,
7fa298c9
EA
103which simplifies the database update problem
104since only adjacent hosts must be entered
105into the system tables,
fbbba053
EA
106while others use end-to-end addressing.
107Some networks use a left-associative syntax
108and others use a right-associative syntax,
1c9783dc 109causing ambiguity in mixed addresses.
7fa298c9 110.pp
1c9783dc 111Internet standards seek to eliminate these problems.
fbbba053 112Initially, these proposed expanding the address pairs
7fa298c9 113to address triples,
fbbba053
EA
114consisting of
115{network, host, resource}
116triples.
1c9783dc 117Network numbers must be universally agreed upon,
fbbba053 118and hosts can be assigned locally
7fa298c9 119on each network.
37a260a5 120The user-level presentation was quickly expanded
fbbba053
EA
121to address domains,
122comprised of a local resource identification
123and a hierarchical domain specification
124with a common static root.
125The domain technique
126separates the issue of physical versus logical addressing.
127For example,
128an address of the form
129.q "eric@a.cc.berkeley.arpa"
130describes only the logical
1c9783dc 131organization of the address space.
7fa298c9
EA
132.pp
133.i Sendmail
134is intended to help bridge the gap
37a260a5
EA
135between the totally
136.i "ad hoc"
137world
7fa298c9
EA
138of networks that know nothing of each other
139and the clean, tightly-coupled world
140of unique network numbers.
fbbba053
EA
141It can accept old arbitrary address syntaxes,
142resolving ambiguities using heuristics
143specified by the system administrator,
144as well as domain-based addressing.
7fa298c9
EA
145It helps guide the conversion of message formats
146between disparate networks.
147In short,
148.i sendmail
fbbba053
EA
149is designed to assist a graceful transition
150to consistent internetwork addressing schemes.
7fa298c9
EA
151.sp
152.pp
64dbe651
EA
153Section 1 discusses the design goals for
154.i sendmail .
155Section 2 gives an overview of the basic functions of the system.
156In section 3,
157details of usage are discussed.
fbbba053 158Section 4 compares
64dbe651
EA
159.i sendmail
160to other internet mail routers,
161and an evaluation of
162.i sendmail
fbbba053 163is given in section 5,
64dbe651
EA
164including future plans.
165.sh 1 "DESIGN GOALS"
166.pp
64dbe651 167Design goals for
fbbba053
EA
168.i sendmail
169include:
64dbe651 170.np
37a260a5 171Compatibility with the existing mail programs,
64dbe651 172including Bell version 6 mail,
d5bda243 173Bell version 7 mail
01e97e73 174[UNIX83],
d5bda243
EA
175Berkeley
176.i Mail
0e2142c8 177[Shoens79],
48cec4c6 178BerkNet mail
ce4c8997 179[Schmidt79],
48cec4c6 180and hopefully UUCP mail
7f667328 181[Nowitz78a, Nowitz78b].
48cec4c6 182ARPANET mail
7f667328 183[Crocker77a, Postel77]
b7e67727 184was also required.
64dbe651 185.np
b7e67727
EA
186Reliability, in the sense of guaranteeing
187that every message is correctly delivered
188or at least brought to the attention of a human
189for correct disposal;
190no message should ever be completely lost.
37a260a5 191This goal was considered essential
64dbe651 192because of the emphasis on mail in our environment.
37a260a5 193It has turned out to be one of the hardest goals to satisfy,
64dbe651
EA
194especially in the face of the many anomalous message formats
195produced by various ARPANET sites.
196For example,
37a260a5
EA
197certain sites generate improperly formated addresses,
198occasionally
199causing error-message loops.
b7e67727 200Some hosts use blanks in names,
37a260a5 201causing problems with
b7e67727 202UNIX mail programs that assume that an address
64dbe651 203is one word.
fbbba053
EA
204The semantics of some fields
205are interpreted slightly differently
206by different sites.
64dbe651 207In summary,
37a260a5 208the obscure features of the ARPANET mail protocol
d5bda243
EA
209really
210.i are
211used and
64dbe651
EA
212are difficult to support,
213but must be supported.
d5bda243
EA
214.np
215Existing software to do actual delivery
216should be used whenever possible.
37a260a5 217This goal derives as much from political and practical considerations
d5bda243 218as technical.
64dbe651 219.np
1c9783dc
EA
220Easy expansion to
221fairly complex environments,
64dbe651 222including multiple
48cec4c6 223connections to a single network type
d5bda243 224(such as with multiple UUCP or Ether nets
1c9783dc 225[Metcalfe76]).
37a260a5
EA
226This goal requires consideration of the contents of an address
227as well as its syntax
228in order to determine which gateway to use.
b7e67727 229For example,
fbbba053
EA
230the ARPANET is bringing up the
231TCP protocol to replace the old NCP protocol.
b7e67727
EA
232No host at Berkeley runs both TCP and NCP,
233so it is necessary to look at the ARPANET host name
234to determine whether to route mail to an NCP gateway
235or a TCP gateway.
64dbe651
EA
236.np
237Configuration should not be compiled into the code.
37a260a5
EA
238A single compiled program should be able to run as is at any site
239(barring such basic changes as the CPU type or the operating system).
48cec4c6 240We have found this seemingly unimportant goal
64dbe651 241to be critical in real life.
48cec4c6
EA
242Besides the simple problems that occur when any program gets recompiled
243in a different environment,
244many sites like to
245.q fiddle
246with anything that they will be recompiling anyway.
64dbe651 247.np
fbbba053 248.i Sendmail
64dbe651 249must be able to let various groups maintain their own mailing lists,
b7e67727 250and let individuals specify their own forwarding,
37a260a5 251without modifying the system alias file.
64dbe651 252.np
37a260a5
EA
253Each user should be able to specify which mailer to execute
254to process mail being delivered for him.
255This feature allows users who are using specialized mailers
256that use a different format to build their environment
48cec4c6 257without changing the system,
37a260a5 258and facilitates specialized functions
48cec4c6
EA
259(such as returning an
260.q "I am on vacation"
261message).
64dbe651
EA
262.np
263Network traffic should be minimized
264by batching addresses to a single host where possible,
37a260a5 265without assistance from the user.
fbbba053 266.pp
37a260a5 267These goals motivated the architecture illustrated in figure 1.
fbbba053
EA
268.(z
269.hl
270.ie t \
13c6ffb1
EA
271\{\
272.ie !"\*(.T"" \
273\{\
274.PS
275boxht = 0.5i
276boxwid = 1.0i
277
278 down
279S: [
280 right
281 S1: box "sender1"
282 move
283 box "sender2"
284 move
285 S3: box "sender3"
286 ]
287 arrow
288SM: box "sendmail" wid 2i ht boxht
289 arrow
290M: [
291 right
292 M1: box "mailer1"
293 move
294 box "mailer2"
295 move
296 M3: box "mailer3"
297 ]
298
299 arrow from S.S1.s to 1/2 between SM.nw and SM.n
300 arrow from S.S3.s to 1/2 between SM.n and SM.ne
301
302 arrow from 1/2 between SM.sw and SM.s to M.M1.n
303 arrow from 1/2 between SM.s and SM.se to M.M3.n
304.PE
305.\}
306.el \
fbbba053 307. sp 18
13c6ffb1 308.\}
fbbba053
EA
309.el \{\
310.(c
311+---------+ +---------+ +---------+
312| sender1 | | sender2 | | sender3 |
313+---------+ +---------+ +---------+
314 | | |
315 +----------+ + +----------+
316 | | |
317 v v v
318 +-------------+
319 | sendmail |
320 +-------------+
321 | | |
322 +----------+ + +----------+
323 | | |
324 v v v
325+---------+ +---------+ +---------+
326| mailer1 | | mailer2 | | mailer3 |
327+---------+ +---------+ +---------+
328.)c
329.\}
330
331.ce
332Figure 1 \*- Sendmail System Structure.
333.hl
334.)z
335The user interacts with a mail generating and sending program.
336When the mail is created,
337the generator calls
338.i sendmail ,
339which routes the message to the correct mailer(s).
340Since some of the senders may be network servers
341and some of the mailers may be network clients,
342.i sendmail
343may be used as an internet mail gateway.
64dbe651
EA
344.sh 1 "OVERVIEW"
345.sh 2 "System Organization"
346.pp
347.i Sendmail
348neither interfaces with the user
349nor does actual mail delivery.
350Rather,
351it collects a message
48cec4c6 352generated by a user interface program (UIP)
7f667328 353such as Berkeley
d5bda243 354.i Mail ,
7f667328
EA
355MS
356[Crocker77b],
357or MH
0e2142c8 358[Borden79],
d5bda243 359edits the message as required by the destination network,
64dbe651 360and calls appropriate mailers
b7e67727
EA
361to do mail delivery or queueing for network transmission\**.
362.(f
363\**except when mailing to a file,
364when
365.i sendmail
366does the delivery directly.
367.)f
64dbe651
EA
368This discipline allows the insertion of new mailers
369at minimum cost.
d5bda243
EA
370In this sense
371.i sendmail
372resembles the Message Processing Module (MPM)
7f667328 373of [Postel79b].
fbbba053
EA
374.sh 2 "Interfaces to the Outside World"
375.pp
376There are three ways
377.i sendmail
378can communicate with the outside world,
379both in receiving and in sending mail.
380These are using the conventional UNIX
381argument vector/return status,
382speaking SMTP over a pair of UNIX pipes,
383and speaking SMTP over an interprocess(or) channel.
384.sh 3 "Argument vector/exit status"
385.pp
386This technique is the standard UNIX method
387for communicating with the process.
37a260a5
EA
388A list of recipients is sent in the argument vector,
389and the message body is sent on the standard input.
fbbba053 390Anything that the mailer prints
37a260a5 391is simply collected and sent back to the sender
fbbba053
EA
392if there were any problems.
393The exit status from the mailer is collected
394after the message is sent,
395and a diagnostic is printed if appropriate.
396.sh 3 "SMTP over pipes"
397.pp
398The SMTP protocol
399[Postel82]
400can be used to run an interactive lock-step interface
401with the mailer.
402A subprocess is still created,
37a260a5 403but no recipient addresses are passed to the mailer
dccb3105 404via the argument list.
fbbba053
EA
405Instead, they are passed one at a time
406in commands sent to the processes standard input.
407Anything appearing on the standard output
408must be a reply code
409in a special format.
410.sh 3 "SMTP over an IPC connection"
411.pp
37a260a5 412This technique is similar to the previous technique,
fbbba053 413except that it uses a 4.2bsd IPC channel
01e97e73 414[UNIX83].
fbbba053
EA
415This method is exceptionally flexible
416in that the mailer need not reside
417on the same machine.
37a260a5 418It is normally used to connect to a sendmail process
fbbba053 419on another machine.
64dbe651 420.sh 2 "Operational Description"
b7e67727 421.pp
37a260a5 422When a sender wants to send a message,
fbbba053
EA
423it issues a request to
424.i sendmail
425using one of the three methods described above.
b7e67727 426.i Sendmail
fbbba053
EA
427operates in two distinct phases.
428In the first phase,
429it collects and stores the message.
430In the second phase,
431message delivery occurs.
37a260a5
EA
432If there were errors during processing
433during the second phase,
fbbba053
EA
434.i sendmail
435creates and returns a new message describing the error
436and/or returns an status code
437telling what went wrong.
64dbe651
EA
438.sh 3 "Argument processing and address parsing"
439.pp
fbbba053 440If
fe65cf0c 441.i sendmail
fbbba053
EA
442is called using one of the two subprocess techniques,
443the arguments
dccb3105 444are first scanned
37a260a5 445and option specifications are processed.
fbbba053
EA
446Recipient addresses are then collected,
447either from the command line
448or from the SMTP
449RCPT command,
64dbe651 450and a list of recipients is created.
37a260a5
EA
451Aliases are expanded at this step,
452including mailing lists.
fe65cf0c 453As much validation as possible of the addresses
d5bda243
EA
454is done at this step:
455syntax is checked, and local addresses are verified,
64dbe651 456but detailed checking of host names and addresses
d5bda243
EA
457is deferred until delivery.
458Forwarding is also performed
64dbe651
EA
459as the local addresses are verified.
460.pp
d5bda243
EA
461.i Sendmail
462appends each address
463to the recipient list after parsing.
64dbe651 464When a name is aliased or forwarded,
d5bda243 465the old name is retained in the list,
fbbba053 466and a flag is set that tells the delivery phase
d5bda243 467to ignore this recipient.
37a260a5 468This list is kept free from duplicates,
64dbe651 469preventing alias loops
37a260a5
EA
470and duplicate messages deliverd to the same recipient,
471as might occur if a person is in two groups.
64dbe651
EA
472.sh 3 "Message collection"
473.pp
d5bda243 474.i Sendmail
fbbba053
EA
475then collects the message.
476The message should have a header at the beginning.
477No formatting requirements are imposed on the message
478except that they must be lines of text
479(i.e., binary data is not allowed).
480The header is parsed and stored in memory,
64dbe651 481and the body of the message is saved
48cec4c6 482in a temporary file.
64dbe651 483.pp
37a260a5
EA
484To simplify the program interface,
485the message is collected even if no addresses were valid.
64dbe651
EA
486The message will be returned with an error.
487.sh 3 "Message delivery"
488.pp
37a260a5 489For each unique mailer and host in the recipient list,
d5bda243
EA
490.i sendmail
491calls the appropriate mailer.
b7e67727 492Each mailer invocation sends to all users receiving the message on one host.
37a260a5 493Mailers that only accept one recipient at a time
64dbe651
EA
494are handled properly.
495.pp
d5bda243 496The message is sent to the mailer
fbbba053
EA
497using one of the same three interfaces
498used to submit a message to sendmail.
37a260a5 499Each copy of the message is
64dbe651 500prepended by a customized header.
fbbba053 501The mailer status code is caught and checked,
64dbe651
EA
502and a suitable error message given as appropriate.
503The exit code must conform to a system standard
37a260a5 504or a generic message
64dbe651
EA
505(\c
506.q "Service unavailable" )
507is given.
fe65cf0c
EA
508.sh 3 "Queueing for retransmission"
509.pp
fbbba053 510If the mailer returned an status that
fe65cf0c
EA
511indicated that it might be able to handle the mail later,
512.i sendmail
513will queue the mail and try again later.
64dbe651
EA
514.sh 3 "Return to sender"
515.pp
37a260a5 516If errors occur during processing,
d5bda243
EA
517.i sendmail
518returns the message to the sender for retransmission.
64dbe651
EA
519The letter can be mailed back
520or written in the file
521.q dead.letter
48cec4c6
EA
522in the sender's home directory\**.
523.(f
524\**Obviously, if the site giving the error is not the originating
525site, the only reasonable option is to mail back to the sender.
526Also, there are many more error disposition options,
527but they only effect the error message \*- the
528.q "return to sender"
529function is always handled in one of these two ways.
530.)f
1c9783dc
EA
531.sh 2 "Message Header Editing"
532.pp
533Certain editing of the message header
534occurs automatically.
535Header lines can be inserted
536under control of the configuration file.
537Some lines can be merged;
538for example,
539a
540.q From:
541line and a
542.q Full-name:
543line can be merged under certain circumstances.
64dbe651
EA
544.sh 2 "Configuration File"
545.pp
546Almost all configuration information is read at runtime
d5bda243
EA
547from an ASCII file,
548encoding
b7e67727
EA
549macro definitions
550(defining the value of macros used internally),
551header declarations
552(telling sendmail the format of header lines that it will process specially,
553i.e., lines that it will add or reformat),
554mailer definitions
555(giving information such as the location and characteristics
556of each mailer),
557and address rewriting rules
558(a limited production system to rewrite addresses
1c9783dc 559which is used to parse and rewrite the addresses).
2fb78b49
EA
560.pp
561To improve performance when reading the configuration file,
562a memory image can be provided.
563This provides a
564.q compiled
565form of the configuration file.
48cec4c6 566.sh 1 "USAGE AND IMPLEMENTATION"
64dbe651
EA
567.sh 2 "Arguments"
568.pp
7f667328 569Arguments may be flags and addresses.
fbbba053 570Flags set various processing options.
64dbe651 571Following flag arguments,
fe65cf0c
EA
572address arguments may be given,
573unless we are running in SMTP mode.
37a260a5 574Addresses follow the syntax in RFC822
fbbba053 575[Crocker82]
64dbe651
EA
576for ARPANET
577address formats.
578In brief, the format is:
579.np
580Anything in parentheses is thrown away
581(as a comment).
582.np
b7e67727 583Anything in angle brackets (\c
74b6e641 584.q "<\|>" )
b7e67727 585is preferred
64dbe651 586over anything else.
37a260a5 587This rule implements the ARPANET standard that addresses of the form
b7e67727 588.(b
fbbba053 589user name <machine-address>
b7e67727
EA
590.)b
591will send to the electronic
592.q machine-address
593rather than the human
fbbba053 594.q "user name."
64dbe651
EA
595.np
596Double quotes
597(\ "\ )
598quote phrases;
599backslashes quote characters.
fe65cf0c
EA
600Backslashes are more powerful
601in that they will cause otherwise equivalent phrases
602to compare differently \*- for example,
64dbe651
EA
603.i user
604and
605.i
606"user"
607.r
608are equivalent,
609but
610.i \euser
611is different from either of them.
64dbe651 612.pp
64dbe651
EA
613Parentheses, angle brackets, and double quotes
614must be properly balanced and nested.
1c9783dc
EA
615The rewriting rules control remaining parsing\**.
616.(f
37a260a5 617\**Disclaimer: Some special processing is done
1c9783dc
EA
618after rewriting local names; see below.
619.)f
7f667328
EA
620.sh 2 "Mail to Files and Programs"
621.pp
d5bda243
EA
622Files and programs are legitimate message recipients.
623Files provide archival storage of messages,
7f667328
EA
624useful for project administration and history.
625Programs are useful as recipients in a variety of situations,
626for example,
37a260a5 627to maintain a public repository of systems messages
7f667328
EA
628(such as the Berkeley
629.i msgs
630program,
631or the MARS system
632[Sattley78]).
633.pp
d5bda243 634Any address passing through the initial parsing algorithm
7f667328 635as a local address
d5bda243 636(i.e, not appearing to be a valid address for another mailer)
7f667328 637is scanned for two special cases.
d5bda243 638If prefixed by a vertical bar (\c
7f667328
EA
639.q \^|\^ )
640the rest of the address is processed as a shell command.
a56399d5 641If the user name begins with a slash mark (\c
7f667328
EA
642.q /\^ )
643the name is used as a file name,
644instead of a login name.
0e2142c8
EA
645.pp
646Files that have setuid or setgid bits set
647but no execute bits set
648have those bits honored if
649.i sendmail
650is running as root.
64dbe651
EA
651.sh 2 "Aliasing, Forwarding, Inclusion"
652.pp
653.i Sendmail
d5bda243 654reroutes mail three ways.
64dbe651
EA
655Aliasing applies system wide.
656Forwarding allows each user to reroute incoming mail
657destined for that account.
658Inclusion directs
659.i sendmail
660to read a file for a list of addresses,
d5bda243 661and is normally used
64dbe651
EA
662in conjunction with aliasing.
663.sh 3 "Aliasing"
664.pp
d5bda243 665Aliasing maps names to address lists using a system-wide file.
37a260a5 666This file is indexed to speed access.
d5bda243 667Only names that parse as local
64dbe651 668are allowed as aliases;
37a260a5
EA
669this guarantees a unique key
670(since there are no nicknames for the local host).
64dbe651
EA
671.sh 3 "Forwarding"
672.pp
673After aliasing,
37a260a5 674recipients that are local and valid
64dbe651
EA
675are checked for the existence of a
676.q .forward
677file in their home directory.
678If it exists,
679the message is
680.i not
681sent to that user,
682but rather to the list of users in that file.
37a260a5
EA
683Often
684this list will contain only one address,
685and the feature will be used for network mail forwarding.
64dbe651
EA
686.pp
687Forwarding also permits a user to specify a private incoming mailer.
688For example,
689forwarding to:
690.(b
691"\^|\|/usr/local/newmail myname"
692.)b
693will use a different incoming mailer.
694.sh 3 "Inclusion"
695.pp
fbbba053 696Inclusion is specified in RFC 733 [Crocker77a] syntax:
64dbe651
EA
697.(b
698:Include: pathname
699.)b
700An address of this form reads the file specified by
701.i pathname
702and sends to all users listed in that file.
703.pp
704The intent is
705.i not
706to support direct use of this feature,
707but rather to use this as a subset of aliasing.
708For example,
709an alias of the form:
710.(b
711project: :include:/usr/project/userlist
712.)b
713is a method of letting a project maintain a mailing list
714without interaction with the system administration,
715even if the alias file is protected.
716.pp
2fb78b49 717It is not necessary to rebuild the index on the alias database
64dbe651 718when a :include: list is changed.
fbbba053
EA
719.sh 2 "Message Collection"
720.pp
37a260a5 721Once all recipient addresses are parsed and verified,
1c9783dc 722the message is collected.
fbbba053
EA
723The message comes in two parts:
724a message header and a message body,
725separated by a blank line.
726.pp
727The header is formatted as a series of lines
728of the form
729.(b
37a260a5 730 field-name: field-value
fbbba053
EA
731.)b
732Field-value can be split across lines by starting the following
733lines with a space or a tab.
37a260a5 734Some header fields have special internal meaning,
fbbba053
EA
735and have appropriate special processing.
736Other headers are simply passed through.
737Some header fields may be added automatically,
738such as time stamps.
739.pp
740The body is a series of text lines.
741It is completely uninterpreted and untouched,
742except that lines beginning with a dot
743have the dot doubled
744when transmitted over an SMTP channel.
1c9783dc 745This extra dot is stripped by the receiver.
0e2142c8
EA
746.sh 2 "Message Delivery"
747.pp
fbbba053
EA
748The send queue is ordered by receiving host
749before transmission
750to implement message batching.
37a260a5
EA
751Each address is marked as it is sent
752so rescanning the list is safe.
0e2142c8
EA
753An argument list is built as the scan proceeds.
754Mail to files is detected during the scan of the send list.
fbbba053
EA
755The interface to the mailer
756is performed using one of the techniques
1c9783dc 757described in section 2.2.
0e2142c8 758.pp
37a260a5 759After a connection is established,
0e2142c8 760.i sendmail
fbbba053
EA
761makes the per-mailer changes to the header
762and sends the result to the mailer.
0e2142c8
EA
763If any mail is rejected by the mailer,
764a flag is set to invoke the return-to-sender function
765after all delivery completes.
fe65cf0c
EA
766.sh 2 "Queued Messages"
767.pp
37a260a5 768If the mailer returns a
fe65cf0c
EA
769.q "temporary failure"
770exit status,
771the message is queued.
772A control file is used to describe the recipients to be sent to
773and various other parameters.
fbbba053
EA
774This control file is formatted as a series of lines,
775each describing a sender,
776a recipient,
777the time of submission,
778or some other salient parameter of the message.
779The header of the message is stored
780in the control file,
781so that the associated data file in the queue
782is just the temporary file that was originally collected.
fbbba053 783.sh 2 "Configuration"
64dbe651 784.pp
fbbba053
EA
785Configuration is controlled primarily by a configuration file
786read at startup.
64dbe651
EA
787.i Sendmail
788should not need to be recomplied except
789.np
790To change operating systems
791(V6, V7/32V, 4BSD).
792.np
b7e67727
EA
793To remove or insert the DBM
794(UNIX database)
795library.
64dbe651
EA
796.np
797To change ARPANET reply codes.
798.np
37a260a5 799To add headers fields requiring special processing.
64dbe651 800.lp
b7e67727
EA
801Adding mailers or changing parsing
802(i.e., rewriting)
803or routing information
64dbe651
EA
804does not require recompilation.
805.pp
806If the mail is being sent by a local user,
807and the file
808.q .mailcf
809exists in the sender's home directory,
810that file is read as a configuration file
811after the system configuration file.
37a260a5 812The primary use of this feature is to add header lines.
dccb3105
EA
813.pp
814The configuration file encodes macro definitions,
815header definitions,
816mailer definitions,
817rewriting rules,
818and options.
819.sh 3 Macros
820.pp
821Macros can be used in three ways.
822Certain macros transmit
823unstructured textual information
824into the mail system,
825such as the name
826.i sendmail
827will use to identify itself in error messages.
828Other macros transmit information from
829.i sendmail
830to the configuration file
831for use in creating other fields
832(such as argument vectors to mailers);
833e.g., the name of the sender,
834and the host and user
835of the recipient.
836Other macros are unused internally,
837and can be used as shorthand in the configuration file.
838.sh 3 "Header declarations"
839.pp
840Header declarations inform
841.i sendmail
842of the format of known header lines.
843Knowledge of a few header lines
844is built into
845.i sendmail ,
846such as the
847.q From:
848and
849.q Date:
850lines.
851.pp
852Most configured headers
853will be automatically inserted
854in the outgoing message
855if they don't exist in the incoming message.
856Certain headers are suppressed by some mailers.
857.sh 3 "Mailer declarations"
858.pp
859Mailer declarations tell
860.i sendmail
861of the various mailers available to it.
862The definition specifies the internal name of the mailer,
863the pathname of the program to call,
864some flags associated with the mailer,
865and an argument vector to be used on the call;
37a260a5 866this vector is macro-expanded before use.
dccb3105
EA
867.sh 3 "Address rewriting rules"
868.pp
869The heart of address parsing in
870.i sendmail
871is a set of rewriting rules.
872These are an ordered list of pattern-replacement rules,
873(somewhat like a production system,
874except that order is critical),
875which are applied to each address.
876The address is rewritten textually until it is either rewritten
877into a special canonical form
878(i.e.,
879a (mailer, host, user)
8803-tuple,
881such as {arpanet, usc-isif, postel}
882representing the address
883.q "postel@usc-isif" ),
884or it falls off the end.
885When a pattern matches,
886the rule is reapplied until it fails.
887.pp
888The configuration file also supports the editing of addresses
889into different formats.
890For example,
891an address of the form:
892.(b
893ucsfcgl!tef
894.)b
895might be mapped into:
896.(b
897tef@ucsfcgl.UUCP
898.)b
899to conform to the domain syntax.
900Translations can also be done in the other direction.
901.sh 3 "Option setting"
902.pp
37a260a5 903There are several options that can be set
dccb3105
EA
904from the configuration file.
905These include the pathnames of various support files,
906timeouts,
907default modes,
908etc.
64dbe651
EA
909.sh 1 "COMPARISON WITH OTHER MAILERS"
910.sh 2 "Delivermail"
911.pp
912.i Sendmail
913is an outgrowth of
914.i delivermail .
915The primary differences are:
916.np
917Configuration information is not compiled in.
37a260a5 918This change simplifies many of the problems
64dbe651
EA
919of moving to other machines.
920It also allows easy debugging of new mailers.
921.np
922Address parsing is more flexible.
923For example,
924.i delivermail
925only supported one gateway to any network,
926whereas
927.i sendmail
928can be sensitive to host names
929and reroute to different gateways.
930.np
931Forwarding and
932:include:
d5bda243 933features eliminate the requirement that the system alias file
64dbe651
EA
934be writable by any user
935(or that an update program be written,
936or that the system administration make all changes).
937.np
938.i Sendmail
939supports message batching across networks
940when a message is being sent to multiple recipients.
2fb78b49
EA
941.np
942A mail queue is provided in
943.i sendmail.
944Mail that cannot be delivered immediately
945but can potentially be delivered later
946is stored in this queue for a later retry.
947The queue also provides a buffer against system crashes;
948after the message has been collected
949it may be reliably redelivered
950even if the system crashes during the initial delivery.
951.np
952.i Sendmail
953uses the networking support provided by 4.2BSD
954to provide a direct interface networks such as the ARPANET
955and/or Ethernet
956using SMTP (the Simple Mail Transfer Protocol)
957over a TCP/IP connection.
64dbe651
EA
958.sh 2 "MMDF"
959.pp
7f667328
EA
960MMDF
961[Crocker79]
fe65cf0c 962spans a wider problem set than
64dbe651
EA
963.i sendmail .
964For example,
5296a55f 965the domain of
64dbe651
EA
966MMDF includes a
967.q "phone network"
968mailer, whereas
969.i sendmail
970calls on preexisting mailers in most cases.
64dbe651
EA
971.pp
972MMDF and
973.i sendmail
974both support aliasing,
975customized mailers,
976message batching,
fe65cf0c
EA
977automatic forwarding to gateways,
978queueing,
979and retransmission.
5296a55f
EA
980MMDF supports two-stage timeout,
981which
982.i sendmail
2fb78b49 983does not support.
fbbba053
EA
984.pp
985The configuration for MMDF
2fb78b49 986is compiled into the code\**.
fbbba053
EA
987.(f
988\**Dynamic configuration tables are currently being considered
989for MMDF;
37a260a5 990allowing the installer to select either compiled
fbbba053
EA
991or dynamic tables.
992.)f
1c9783dc 993.pp
fbbba053
EA
994Since MMDF does not consider backwards compatibility
995as a design goal,
2fb78b49 996the address parsing is simpler but much less flexible.
1c9783dc 997.pp
2fb78b49 998It is somewhat harder to integrate a new channel\**
1c9783dc
EA
999.(f
1000\**The MMDF equivalent of a
1001.i sendmail
1002.q mailer.
1003.)f
1004into MMDF.
1005In particular,
1006MMDF must know the location and format
1007of host tables for all channels,
1008and the channel must speak a special protocol.
2fb78b49
EA
1009This allows MMDF to do additional verification
1010(such as verifying host names)
1011at submission time.
fbbba053
EA
1012.pp
1013MMDF strictly separates the submission and delivery phases.
1014Although
1015.i sendmail
1016has the concept of each of these stages,
1017they are integrated into one program,
1018whereas in MMDF they are split into two programs.
64dbe651
EA
1019.sh 2 "Message Processing Module"
1020.pp
1021The Message Processing Module (MPM)
7f667328 1022discussed by Postel [Postel79b]
64dbe651
EA
1023matches
1024.i sendmail
1025closely in terms of its basic architecture.
1026However,
1027like MMDF,
1028the MPM includes the network interface software
1029as part of its domain.
1030.pp
1031MPM also postulates a duplex channel to the receiver,
37a260a5
EA
1032as does MMDF,
1033thus allowing simpler handling of errors
64dbe651 1034by the mailer
37a260a5
EA
1035than is possible in
1036.i sendmail .
1037When a message queued by
64dbe651
EA
1038.i sendmail
1039is sent,
1040any errors must be returned to the sender
1041by the mailer itself.
1042Both MPM and MMDF mailers
1043can return an immediate error response,
1044and a single error processor can create an appropriate response.
1045.pp
37a260a5 1046MPM prefers passing the message as a structured object,
2fb78b49
EA
1047with type-length-value tuples\**.
1048.(f
1049\**This is similar to the NBS standard.
1050.)f
37a260a5
EA
1051Such a convention requires a much higher degree of cooperation
1052between mailers than is required by
64dbe651
EA
1053.i sendmail .
1054MPM also assumes a universally agreed upon internet name space
37a260a5 1055(with each address in the form of a net-host-user tuple),
64dbe651
EA
1056which
1057.i sendmail
1058does not.
1059.sh 1 "EVALUATIONS AND FUTURE PLANS"
1060.pp
1061.i Sendmail
1062is designed to work in a nonhomogeneous environment.
2fb78b49 1063Every attempt is made to avoid imposing unnecessary constraints
64dbe651
EA
1064on the underlying mailers.
1065This goal has driven much of the design.
1066One of the major problems
1067has been the lack of a uniform address space,
7f667328
EA
1068as postulated in [Postel79a]
1069and [Postel79b].
64dbe651 1070.pp
37a260a5 1071A nonuniform address space implies that a path will be specified
64dbe651
EA
1072in all addresses,
1073either explicitly (as part of the address)
1074or implicitly
1075(as with implied forwarding to gateways).
37a260a5 1076This restriction has the unpleasant effect of making replying to messages
64dbe651
EA
1077exceedingly difficult,
1078since there is no one
1079.q address
1080for any person,
1081but only a way to get there from wherever you are.
1082.pp
1083Interfacing to mail programs
1084that were not initially intended to be applied
1085in an internet environment
1086has been amazingly successful,
1087and has reduced the job to a manageable task.
1088.pp
64dbe651
EA
1089.i Sendmail
1090has knowledge of a few difficult environments
1091built in.
fbbba053 1092It generates ARPANET FTP/SMTP compatible error messages
64dbe651 1093(prepended with three-digit numbers
fbbba053 1094[Neigus73, Postel74, Postel82])
64dbe651
EA
1095as necessary,
1096optionally generates UNIX-style
1097.q From
1098lines on the front of messages for some mailers,
1099and knows how to parse the same lines on input.
64dbe651
EA
1100Also,
1101error handling has an option customized for BerkNet.
1102.pp
fbbba053
EA
1103The decision to avoid doing any type of delivery where possible
1104(even, or perhaps especially, local delivery)
1105has turned out to be a good idea.
1106Even with local delivery,
1107there are issues of the location of the mailbox,
1108the format of the mailbox,
1109the locking protocol used,
1110etc.,
1111that are best decided by other programs.
1112One surprisingly major annoyance in many internet mailers
1113is that the location and format of local mail is built in.
1114The feeling seems to be that local mail is so common
1115that it should be efficient.
37a260a5
EA
1116This feeling is not born out by
1117our experience;
1c9783dc 1118on the contrary,
fbbba053
EA
1119the location and format of mailboxes seems to vary widely
1120from system to system.
64dbe651
EA
1121.pp
1122The ability to automatically generate a response to incoming mail
1123(by forwarding mail to a program)
1124seems useful
1125(\c
1126.q "I am on vacation until late August...." )
1127but can create problems
1128such as forwarding loops
1129(two people on vacation whose programs send notes back and forth,
1130for instance)
1131if these programs are not well written.
37a260a5
EA
1132A program could be written to do standard tasks correctly,
1133but this would solve the general case.
1134.pp
64dbe651 1135It might be desirable to implement some form of load limiting.
48cec4c6
EA
1136I am unaware of any mail system that addresses this problem,
1137nor am I aware of any reasonable solution at this time.
64dbe651 1138.pp
64dbe651
EA
1139The configuration file is currently practically inscrutable;
1140considerable convenience could be realized
1141with a higher-level format.
64dbe651 1142.pp
7f667328
EA
1143It seems clear that common protocols will be changing soon
1144to accommodate changing requirements and environments.
1145These changes will include modifications to the message header
1c9783dc 1146(e.g., [NBS80])
7f667328
EA
1147or to the body of the message itself
1148(such as for multimedia messages
1149[Postel80]).
fbbba053
EA
1150Experience indicates that
1151these changes should be relatively trivial to integrate
7f667328
EA
1152into the existing system.
1153.pp
7f667328 1154In tightly coupled environments,
2fb78b49
EA
1155it would be nice to have a name server
1156such as Grapvine
1157[Birrell82]
1158integrated into the mail system.
1c9783dc 1159This would allow a site such as
fbbba053 1160.q Berkeley
1c9783dc 1161to appear as a single host,
fbbba053
EA
1162rather than as a collection of hosts,
1163and would allow people to move transparently among machines
1164without having to change their addresses.
37a260a5
EA
1165Such a facility
1166would require an automatically updated database
7f667328 1167and some method of resolving conflicts.
37a260a5
EA
1168Ideally this would be effective even without
1169all hosts being under
1170a single management.
fbbba053 1171However,
37a260a5
EA
1172it is not clear whether this feature
1173should be integrated into the
1174aliasing facility
fbbba053
EA
1175or should be considered a
1176.q "value added"
1177feature outside
1178.i sendmail
1179itself.
37a260a5
EA
1180.pp
1181As a more interesting case,
1182the CSNET name server
01e97e73 1183[Solomon81]
37a260a5
EA
1184provides an facility that goes beyond a single
1185tightly-coupled environment.
1186Such a facility would normally exist outside of
1187.i sendmail
1188however.
d5bda243 1189.sh 0 "ACKNOWLEDGEMENTS"
7f667328 1190.pp
0e2142c8 1191Thanks are due to Kurt Shoens for his continual cheerful
7f667328
EA
1192assistance and good advice,
1193Bill Joy for pointing me in the correct direction
1194(over and over),
1195and Mark Horton for more advice,
1196prodding,
1197and many of the good ideas.
1198Kurt and Eric Schmidt are to be credited
1199for using
1200.i delivermail
1201as a server for their programs
1202(\c
1203.i Mail
1204and BerkNet respectively)
1205before any sane person should have,
1206and making the necessary modifications
1207promptly and happily.
1208Eric gave me considerable advice about the perils
1209of network software which saved me an unknown
1210amount of work and grief.
1211Mark did the original implementation of the DBM version
1212of aliasing, installed the VFORK code,
1213wrote the current version of
1214.i rmail ,
1215and was the person who really convinced me
1216to put the work into
1217.i delivermail
1218to turn it into
1219.i sendmail .
1220Kurt deserves accolades for using
1221.i sendmail
1222when I was myself afraid to take the risk;
1223how a person can continue to be so enthusiastic
1224in the face of so much bitter reality is beyond me.
1225.pp
37a260a5
EA
1226Kurt,
1227Mark,
1228Kirk McKusick,
1229Marvin Solomon,
1230and many others have reviewed this paper,
7f667328
EA
1231giving considerable useful advice.
1232.pp
1c9783dc
EA
1233Special thanks are reserved for Mike Stonebraker at Berkeley
1234and Bob Epstein at Britton-Lee,
fbbba053 1235who both knowingly allowed me to put so much work into this
37a260a5 1236project
7f667328
EA
1237when there were so many other things I really should
1238have been working on.
1239.+c
1240.ce
1241REFERENCES
1242.nr ii 1.5i
2fb78b49
EA
1243.ip [Birrell82]
1244Birrell, A. D.,
1245Levin, R.,
1246Needham, R. M.,
1247and
1248Schroeder, M. D.,
1249.q "Grapevine: An Exercise in Distributed Computing."
1250In
1251.ul
1252Comm. A.C.M. 25,
12534,
1254April 82.
fe65cf0c
EA
1255.ip [Borden79]
1256Borden, S.,
1257Gaines, R. S.,
1258and
1259Shapiro, N. Z.,
1260.ul
1261The MH Message Handling System: Users' Manual.
1262R-2367-PAF.
1263Rand Corporation.
1264October 1979.
7f667328
EA
1265.ip [Crocker77a]
1266Crocker, D. H.,
1267Vittal, J. J.,
1268Pogran, K. T.,
1269and
1270Henderson, D. A. Jr.,
1271.ul
d5bda243 1272Standard for the Format of ARPA Network Text Messages.
7f667328
EA
1273RFC 733,
1274NIC 41952.
1275In [Feinler78].
1276November 1977.
1277.ip [Crocker77b]
1278Crocker, D. H.,
1279.ul
d5bda243 1280Framework and Functions of the MS Personal Message System.
7f667328
EA
1281R-2134-ARPA,
1282Rand Corporation,
1283Santa Monica, California.
12841977.
1285.ip [Crocker79]
1286Crocker, D. H.,
1287Szurkowski, E. S.,
1288and
1289Farber, D. J.,
1290.ul
d5bda243 1291An Internetwork Memo Distribution Facility \*- MMDF.
7f667328
EA
12926th Data Communication Symposium,
1293Asilomar.
1294November 1979.
fbbba053
EA
1295.ip [Crocker82]
1296Crocker, D. H.,
1297.ul
1298Standard for the Format of Arpa Internet Text Messages.
1299RFC 822.
1300Network Information Center,
1301SRI International,
1302Menlo Park, California.
1303August 1982.
31a22de8
EA
1304.ip [Metcalfe76]
1305Metcalfe, R.,
1306and
7f667328 1307Boggs, D.,
31a22de8 1308.q "Ethernet: Distributed Packet Switching for Local Computer Networks" ,
7f667328 1309.ul
31a22de8
EA
1310Communications of the ACM 19,
13117.
1312July 1976.
7f667328
EA
1313.ip [Feinler78]
1314Feinler, E.,
1315and
1316Postel, J.
1317(eds.),
1318.ul
d5bda243 1319ARPANET Protocol Handbook.
7f667328
EA
1320NIC 7104,
1321Network Information Center,
1322SRI International,
1323Menlo Park, California.
13241978.
7f667328
EA
1325.ip [NBS80]
1326National Bureau of Standards,
1327.ul
d5bda243
EA
1328Specification of a Draft Message Format Standard.
1329Report No. ICST/CBOS 80-2.
7f667328 1330October 1980.
ce4c8997 1331.ip [Neigus73]
7f667328
EA
1332Neigus, N.,
1333.ul
d5bda243 1334File Transfer Protocol for the ARPA Network.
ce4c8997 1335RFC 542, NIC 17759.
d5bda243 1336In [Feinler78].
ce4c8997 1337August, 1973.
7f667328
EA
1338.ip [Nowitz78a]
1339Nowitz, D. A.,
1340and
1341Lesk, M. E.,
1342.ul
d5bda243 1343A Dial-Up Network of UNIX Systems.
7f667328 1344Bell Laboratories.
7f667328
EA
1345In
1346UNIX Programmer's Manual, Seventh Edition,
1347Volume 2.
d5bda243 1348August, 1978.
7f667328
EA
1349.ip [Nowitz78b]
1350Nowitz, D. A.,
1351.ul
d5bda243 1352Uucp Implementation Description.
7f667328 1353Bell Laboratories.
7f667328
EA
1354In
1355UNIX Programmer's Manual, Seventh Edition,
1356Volume 2.
d5bda243 1357October, 1978.
ce4c8997
EA
1358.ip [Postel74]
1359Postel, J.,
1360and
1361Neigus, N.,
1362Revised FTP Reply Codes.
1363RFC 640, NIC 30843.
1364In [Feinler78].
1365June, 1974.
7f667328
EA
1366.ip [Postel77]
1367Postel, J.,
1368.ul
d5bda243 1369Mail Protocol.
7f667328
EA
1370NIC 29588.
1371In [Feinler78].
1372November 1977.
1373.ip [Postel79a]
1374Postel, J.,
1375.ul
d5bda243 1376Internet Message Protocol.
7f667328
EA
1377RFC 753,
1378IEN 85.
1379Network Information Center,
1380SRI International,
1381Menlo Park, California.
1382March 1979.
1383.ip [Postel79b]
1384Postel, J. B.,
1385.ul
d5bda243 1386An Internetwork Message Structure.
ce4c8997
EA
1387In
1388.ul
1389Proceedings of the Sixth Data Communications Symposium,
1390IEEE.
1391New York.
1392November 1979.
7f667328
EA
1393.ip [Postel80]
1394Postel, J. B.,
1395.ul
1396A Structured Format for Transmission of Multi-Media Documents.
d5bda243 1397RFC 767.
7f667328
EA
1398Network Information Center,
1399SRI International,
1400Menlo Park, California.
1401August 1980.
fbbba053 1402.ip [Postel82]
fe65cf0c
EA
1403Postel, J. B.,
1404.ul
1405Simple Mail Transfer Protocol.
fbbba053
EA
1406RFC821
1407(obsoleting RFC788).
fe65cf0c
EA
1408Network Information Center,
1409SRI International,
1410Menlo Park, California.
fbbba053 1411August 1982.
ce4c8997 1412.ip [Schmidt79]
7f667328
EA
1413Schmidt, E.,
1414.ul
ce4c8997 1415An Introduction to the Berkeley Network.
7f667328 1416University of California, Berkeley California.
ce4c8997 14171979.
0e2142c8
EA
1418.ip [Shoens79]
1419Shoens, K.,
7f667328 1420.ul
d5bda243
EA
1421Mail Reference Manual.
1422University of California, Berkeley.
1423In UNIX Programmer's Manual,
7f667328
EA
1424Seventh Edition,
1425Volume 2C.
7f667328
EA
1426December 1979.
1427.ip [Sluizer81]
1428Sluizer, S.,
1429and
1430Postel, J. B.,
1431.ul
d5bda243
EA
1432Mail Transfer Protocol.
1433RFC 780.
7f667328
EA
1434Network Information Center,
1435SRI International,
1436Menlo Park, California.
1437May 1981.
01e97e73
EA
1438.ip [Solomon81]
1439Solomon, M., Landweber, L., and Neuhengen, D.,
1440.q "The Design of the CSNET Name Server."
1441CS-DN-2,
1442University of Wisconsin, Madison.
1443November 1981.
fbbba053
EA
1444.ip [Su82]
1445Su, Zaw-Sing,
1446and
1447Postel, Jon,
1448.ul
1449The Domain Naming Convention for Internet User Applications.
1450RFC819.
1451Network Information Center,
1452SRI International,
1453Menlo Park, California.
1454August 1982.
01e97e73 1455.ip [UNIX83]
7f667328
EA
1456.ul
1457The UNIX Programmer's Manual, Seventh Edition,
1458Virtual VAX-11 Version,
1459Volume 1.
1460Bell Laboratories,
1461modified by the University of California,
01e97e73
EA
1462Berkeley, California.
1463March, 1983.