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