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