1.nr DR 1 \" this is a draft copy 2.nr si 3n 3.he 'SENDMAIL''%' 4.if \n(DR .fo 'For Your Eyes Only'\*-DRAFT\*-'\*(td' 5.ls 2 6.+c 7.(l C 8.sz 14 9SENDMAIL \*- An Internet Mail Router 10.sz 11.sp 12Eric Allman 13.sp 0.5 14.i 15Project INGRES 16Electronics Research Lab 17University of California 18Berkeley, California 94720 19.)l 20.sp 2 21.(f 22This is 23.if \n(DR draft 24version 3.10, 25last modified on 10/01/81. 26.if \n(DR Please do not distribute this version without permission 27.if \n(DR of the author. 28.)f 29.pp 30.i Sendmail 31implements a general internetwork mail routing facility, 32featuring aliasing and forwarding, 33automatic routing to network gateways, 34and flexible configuration. 35.pp 36In the early days of computer networking, 37the problems of identification and communication 38were quite simple by today's standards. 39Each node on the network 40would have an address, 41and resources could be identified 42with a host-resource pair; 43in particular, 44the mail system could refer to users 45using a host-username pair. 46Host names and numbers had to be administered by a central authority, 47but usernames could be assigned locally to each host. 48One early example is the ARPANET. 49However, access to the ARPANET is limited, 50and the connection cost is high. 51Many alternative networks appeared, 52such as the Berkeley Network, 53the UUCP network, 54and the CHAOS network. 55Each network defined its own standards 56for resource identification. 57.pp 58As networks grew, 59they eventually touched. 60Certain special cases could be handled trivially 61by ad hoc techniques, 62as when one computer hung off another by a link, 63or by providing network names that appeared local to hosts 64on other networks, 65as with the Ethernet at Xerox PARC. 66The internet was born. 67.pp 68Internet topology became more complex with time. 69Two networks might touch 70in more than one place, 71and the rapid expansion of networks 72created a serious database update problem. 73Since all the address syntaxes were created arbitrarily, 74considerable confusion reigned. 75Some networks required point-to-point routing, 76which simplifies the database update problem 77since only adjacent hosts must be entered 78into the system tables, 79while others used end-to-end routing. 80Some networks used a left-associative syntax 81and others used a right-associative syntax: 82ambiguity raised its ugly head. 83.pp 84Internet proposals came to the rescue. 85Basically, these proposed expanding the address pairs 86to address triples, 87comprised of network-host-resource. 88Network numbers would be universally agreed upon, 89and hosts could be assigned in the old way 90on each network. 91But these proposals all tended to be far-reaching 92and fundamentally incompatible with the old networks. 93Protocols and proposals met to do battle. 94And there was the issue of assigning network numbers: 95there had to be a central clearing house, 96and any networks that might ever touch 97had to be given their very own number. 98Naturally, not everyone who thought they deserved a number 99got one. 100.pp 101Which brings us to today. 102Although it will be nice when everyone everywhere 103has a unique network number, 104it cannot be expected very soon. 105The old, stupid networks take time to die, 106and bureaucratic inertia is still the rule. 107.pp 108.i Sendmail 109is intended to help bridge the gap 110between the totally ad hoc world 111of networks that know nothing of each other 112and the clean, tightly-coupled world 113of unique network numbers. 114It uses old arbitrary address syntaxes 115and resolves ambiguities using heuristics 116specified by the system administrator 117who creates the configuration file. 118It helps guide the conversion of message formats 119between disparate networks. 120In short, 121.i sendmail 122is glue that holds the world together 123until the new world is ready to be inhabited. 124.sp 125.pp 126Section 1 discusses the design goals for 127.i sendmail . 128Section 2 gives an overview of the basic functions of the system. 129In section 3, 130details of usage are discussed. 131A detailed description of the configuration file 132is given in section 4, 133including a walkthrough of a specific configuration file. 134Section 5 compares 135.i sendmail 136to other internet mail routers, 137and an evaluation of 138.i sendmail 139is given in section 6, 140including future plans. 141.sh 1 "DESIGN GOALS" 142.pp 143.i Sendmail 144was an outgrowth of 145.i delivermail, 146a previous incarnation of a UNIX internetwork mail router. 147.i Delivermail 148was written relatively quickly. 149The first version only knew about taking apart addresses 150for explicit forwarding 151and limited aliasing; 152automatic forwarding and other features 153came later. 154.pp 155Design goals for 156.i delivermail 157included: 158.np 159Compatibility with the existing mail system, 160including Bell version 6 mail, 161Bell version 7 mail 162[UNIX80], 163Berkeley 164.i Mail 165[Shoens79], 166BerkNet mail 167[Schmidt79], 168and hopefully UUCP mail 169[Nowitz78a, Nowitz78b]. 170ARPANET mail 171[Crocker77a, Postel77] 172was also required. 173.np 174Because of time constraints, 175.np 176Reliability, in the sense of guaranteeing 177that every message is correctly delivered 178or at least brought to the attention of a human 179for correct disposal; 180no message should ever be completely lost. 181This was considered essential 182because of the emphasis on mail in our environment. 183This turned out to be one of the hardest goals to satisfy, 184especially in the face of the many anomalous message formats 185produced by various ARPANET sites. 186For example, 187certain sites generate incorrect from addresses 188which caused error message loops. 189Some hosts use blanks in names, 190which created problems with 191UNIX mail programs that assume that an address 192is one word. 193And at least one person lists his address as 194.q "From: the TTY of ..." , 195giving a 196.q Sender: 197field with his real address. 198In summary, 199the obscure aspects of the ARPANET mail protocol 200really 201.i are 202used and 203are difficult to support, 204but must be supported. 205But even obeying the standard is insufficient. 206For example, 207WHARTON changes our host name from 208.q BERKELEY 209to 210.q BERKEL- , 211which confused error processing. 212Degenerate cases such as this 213must be handled gracefully. 214.pp 215There were certain other non-goals in 216.i delivermail . 217These resulted from the expectation that 218it would only be used at Berkeley, 219and probably only at a few sites at Berkeley. 220.np 221It was fair game to compile configuration information 222into the code, 223even to assume that every host was running BerkNet. 224.np 225The problem of multiple gateways to a single network 226was not foreseen. 227For example, 228all UUCP mail was sent to a single gateway host. 229In fact, 230Berkeley has at least three UUCP gateway hosts. 231.np 232No attempt was made to reduce the volume of mail across a network link 233by sending only one copy of a message 234to multiple recipients on the same host. 235Besides the difficulty of doing this, 236we failed to appreciate how much volume there would be. 237.np 238Existing software to do actual delivery 239should be used whenever possible. 240This resulted as much from political and practical considerations 241as technical. 242.pp 243This resulted in an architecture illustrated in figure 1. 244.(z 245.hl 246.ie t \ 247. sp 18 248.el \{\ 249.(c 250+---------+ +---------+ +---------+ 251| sender1 | | sender2 | | sender3 | 252+---------+ +---------+ +---------+ 253 | | | 254 +----------+ + +----------+ 255 | | | 256 v v v 257 +-------------+ 258 | delivermail | 259 +-------------+ 260 | | | 261 +----------+ + +----------+ 262 | | | 263 v v v 264+---------+ +---------+ +---------+ 265| mailer1 | | mailer2 | | mailer3 | 266+---------+ +---------+ +---------+ 267.)c 268.\} 269 270.ce 271Figure 1 \*- Delivermail System Structure. 272.hl 273.)z 274The user interacts with a mail generating and sending program. 275When the mail is created, 276generator calls 277.i delivermail , 278which routes the message to the correct mailer(s). 279Since some of the senders may be network servers 280and some of the mailers may be network users, 281.i delivermail 282is referred to as an 283.q "internet mailer" . 284.pp 285.i Sendmail 286maintained the goals of 287.i delivermail. 288Time was less of a constraint, 289but not reimplementing basic mailers 290has proven to be a wise move in many ways. 291For example, 292many internet mailers deliver local mail directly. 293This is more efficient, 294but builds in the design decisions 295of the local mailer, 296and makes it difficult to concentrate 297on the 298.q "real problems" 299(such as locking). 300Other design goals were: 301.np 302.i Sendmail 303should operate in more complex environments, 304including multiple 305connections to a single network type 306(such as with multiple UUCP or Ether nets 307[Metcalfe76]), 308requiring that the contents of an address 309be considered 310as well as the syntax, 311in order to determine the gateway to use. 312For example, 313the ARPANET is bringing up a new protocol 314called TCP to replace the old NCP protocol. 315No host at Berkeley runs both TCP and NCP, 316so it is necessary to look at the ARPANET host name 317to determine whether to route mail to an NCP gateway 318or a TCP gateway. 319.np 320Configuration should not be compiled into the code. 321A single binary should be able to run as is at any site 322(modulo such basic changes as the CPU type or the operating system). 323We have found this seemingly unimportant goal 324to be critical in real life. 325Besides the simple problems that occur when any program gets recompiled 326in a different environment, 327many sites like to 328.q fiddle 329with anything that they will be recompiling anyway. 330.np 331.i Delivermail 332only knows about one alias file 333and per-user forwarding is unsupported. 334Berkeley is a sufficiently relaxed environment 335that the system alias file can be writable by everyone, 336but other environments are not so lax. 337Thus, 338.i sendmail 339must be able to let various groups maintain their own mailing lists, 340and let individuals specify their own forwarding, 341without writing the system alias file. 342.np 343Each user should be able to specify the mailer to execute 344to process mail being delivered for them. 345This allows users who are using specialized mailers 346that want to use a different format to build their environment 347without changing the system, 348and allows specialized functions 349(such as returning an 350.q "I am on vacation" 351message). 352.np 353Network traffic should be minimized 354by batching addresses to a single host where possible, 355without assistance by the user. 356.sh 1 "OVERVIEW" 357.sh 2 "System Organization" 358.pp 359.i Sendmail 360neither interfaces with the user 361nor does actual mail delivery. 362Rather, 363it collects a message 364generated by a user interface program (UIP) 365such as Berkeley 366.i Mail , 367MS 368[Crocker77b], 369or MH 370[Borden79], 371edits the message as required by the destination network, 372and calls appropriate mailers 373to do mail delivery or queueing for network transmission\**. 374.(f 375\**except when mailing to a file, 376when 377.i sendmail 378does the delivery directly. 379.)f 380This discipline allows the insertion of new mailers 381at minimum cost. 382In this sense 383.i sendmail 384resembles the Message Processing Module (MPM) 385of [Postel79b]. 386.sh 2 "Operational Description" 387.pp 388When an agent wants to send a message, 389it does a normal program call to 390.i sendmail . 391The arguments it passes include flags giving options 392and a list of addresses of intended recipients. 393It then writes the message to be sent to the standard input 394of 395.i sendmail . 396.i Sendmail 397delivers the message if possible, 398saving a copy of it if there were errors, 399and returns an exit status code 400telling what (if anything) went wrong. 401.pp 402The message should have a header at the beginning. 403The header is formatted as a series of lines 404of the form 405.(b 406field-name: field-value 407.)b 408Field-value can be split across lines by starting the following 409lines with a space or a tab. 410The header is separated from the body of the message 411by a blank line. 412No formatting requirements are imposed on the message 413except that they must be lines of text 414(i.e., binary data is not allowed). 415.sh 3 "Argument processing and address parsing" 416.pp 417The arguments are first scanned, 418and flag arguments processed. 419The remaining arguments are 420parsed in turn as addresses, 421and a list of recipients is created. 422Aliases are expanded at this step. 423As much validation of the addresses as possible 424is done at this step: 425syntax is checked, and local addresses are verified, 426but detailed checking of host names and addresses 427is deferred until delivery. 428Forwarding is also performed 429as the local addresses are verified. 430.pp 431.i Sendmail 432appends each address 433to the recipient list after parsing. 434When a name is aliased or forwarded, 435the old name is retained in the list, 436and a flag is set in the address header 437that tells the delivery phase 438to ignore this recipient. 439This list is kept without duplicates, 440preventing alias loops 441and eliminating people receiving two copies of a message, 442as might occur if a person were in two groups. 443.sh 3 "Message collection" 444.pp 445.i Sendmail 446then collects the message from the standard input. 447The message header is parsed at this point. 448The header is stored in memory, 449and the body of the message is saved 450in a temporary file. 451.pp 452The message is still collected even if no addresses were valid 453to simplify program interface. 454The message will be returned with an error. 455.sh 3 "Message delivery" 456.pp 457For each unique mailer and host in the send list, 458.i sendmail 459calls the appropriate mailer. 460Each mailer invocation sends to all users receiving the message on one host. 461Mailers that only accept one user at a time 462are handled properly. 463.pp 464The message is sent to the mailer 465(which must read its standard input) 466prepended by a customized header. 467The mailer exit status code is caught and checked, 468and a suitable error message given as appropriate. 469The exit code must conform to a system standard 470or a meaningless message 471(\c 472.q "Service unavailable" ) 473is given. 474.sh 3 "Return to sender" 475.pp 476If errors occurred during processing, 477.i sendmail 478returns the message to the sender for retransmission. 479The letter can be mailed back 480or written in the file 481.q dead.letter 482in the sender's home directory\**. 483.(f 484\**Obviously, if the site giving the error is not the originating 485site, the only reasonable option is to mail back to the sender. 486Also, there are many more error disposition options, 487but they only effect the error message \*- the 488.q "return to sender" 489function is always handled in one of these two ways. 490.)f 491.sh 2 "Configuration File" 492.pp 493Almost all configuration information is read at runtime 494from an ASCII file, 495encoding 496macro definitions 497(defining the value of macros used internally), 498header declarations 499(telling sendmail the format of header lines that it will process specially, 500i.e., lines that it will add or reformat), 501mailer definitions 502(giving information such as the location and characteristics 503of each mailer), 504and address rewriting rules 505(a limited production system to rewrite addresses 506which is used to effectively parse the addresses). 507.sh 3 Macros 508.pp 509Macros can be used in three ways. 510Certain macros transmit 511unstructured textual information 512into the mail system, 513such as the name 514.i sendmail 515will use to identify itself in error messages. 516Other macros transmit information from 517.i sendmail 518to the configuration file 519for use in creating other fields 520(such as argument vectors to mailers); 521e.g., the name of the sender, 522and the host and user 523of the recipient. 524Other macros are unused internally, 525and can be used as shorthand in the configuration file. 526.sh 3 "Header declarations" 527.pp 528Header declarations inform 529.i sendmail 530of the format of known header lines. 531Knowledge of a few header lines 532is built into 533.i sendmail , 534such as the 535.q From: 536and 537.q Date: 538lines. 539.pp 540Most configured headers 541will be automatically inserted 542in the outgoing message 543if they don't exist in the incoming message. 544Certain headers are suppressed by some mailers. 545.sh 3 "Mailer declarations" 546.pp 547Mailer declarations tell 548.i sendmail 549of the various mailers available to it. 550The definition specifies the internal name of the mailer, 551the pathname of the program to call, 552some flags associated with the mailer, 553and an argument vector to be used on the call; 554this vector is macro expanded before use. 555.sh 3 "Address rewriting rules" 556.pp 557The heart of address parsing in 558.i sendmail 559is a set of rewriting rules. 560These are an ordered list of pattern-replacement rules, 561(somewhat like a production system, 562except that order is critical), 563which are applied to each address. 564The address is rewritten textually until it is either rewritten 565into a special canonical form 566(i.e., 567a (mailer, host, user) 5683-tuple, 569such as (arpanet, usc-isif, postel) 570representing the address 571.q "postel@usc-isif" ), 572or it falls off the end. 573When a pattern matches, 574the rule is reapplied until it fails. 575.sh 2 "Message Header Editing" 576.pp 577Certain editing of the message header 578occurs automatically. 579Header lines can be inserted 580under control of the configuration file. 581Some lines can be merged; 582for example, 583a 584.q From: 585line and a 586.q Full-name: 587line can be merged under certain circumstances. 588.sh 1 "USAGE AND IMPLEMENTATION" 589.sh 2 "Arguments" 590.pp 591Arguments may be flags and addresses. 592The flag arguments are described in Appendix A. 593Following flag arguments, 594address arguments may be given. 595These follow the syntax in RFC733 596[Crocker77a] 597for ARPANET 598address formats. 599In brief, the format is: 600.np 601Anything in parentheses is thrown away 602(as a comment). 603.np 604Anything in angle brackets (\c 605.q "<>" ) 606is preferred 607over anything else. 608This implements the ARPANET standard that addresses of the form 609.(b 610username <machine-address> 611.)b 612will send to the electronic 613.q machine-address 614rather than the human 615.q username. 616.np 617Double quotes 618(\ "\ ) 619quote phrases; 620backslashes quote characters. 621Backslashes are more powerful \*- for example, 622.i user 623and 624.i 625"user" 626.r 627are equivalent, 628but 629.i \euser 630is different from either of them. 631.pp 632The rewriting rules control remaining parsing 633(disclaimer: some special processing is done 634after rewriting local names; see below). 635Parentheses, angle brackets, and double quotes 636must be properly balanced and nested. 637.sh 2 "Mail to Files and Programs" 638.pp 639Files and programs are legitimate message recipients. 640Files provide archival storage of messages, 641useful for project administration and history. 642Programs are useful as recipients in a variety of situations, 643for example, 644as a public repository of systems messages 645(such as the Berkeley 646.i msgs 647program, 648or the MARS system 649[Sattley78]). 650.pp 651Any address passing through the initial parsing algorithm 652as a local address 653(i.e, not appearing to be a valid address for another mailer) 654is scanned for two special cases. 655If prefixed by a vertical bar (\c 656.q \^|\^ ) 657the rest of the address is processed as a shell command. 658If the user name contains slash marks (\c 659.q /\^ ) 660the name is used as a file name, 661instead of a login name. 662.pp 663Files that have setuid or setgid bits set 664but no execute bits set 665have those bits honored if 666.i sendmail 667is running as root. 668.sh 2 "Aliasing, Forwarding, Inclusion" 669.pp 670.i Sendmail 671reroutes mail three ways. 672Aliasing applies system wide. 673Forwarding allows each user to reroute incoming mail 674destined for that account. 675Inclusion directs 676.i sendmail 677to read a file for a list of addresses, 678and is normally used 679in conjunction with aliasing. 680.sh 3 "Aliasing" 681.pp 682Aliasing maps names to address lists using a system-wide file. 683This file is inverted to speed access. 684Only names that parse as local 685are allowed as aliases; 686this guarantees a unique key. 687.pp 688The inverted form of the file 689must be recreated when the text copy is changed. 690Under certain circumstances, 691.i sendmail 692will do this automatically; 693an option can force rebuilding. 694.sh 3 "Forwarding" 695.pp 696After aliasing, 697users that are local and valid 698are checked for the existence of a 699.q .forward 700file in their home directory. 701If it exists, 702the message is 703.i not 704sent to that user, 705but rather to the list of users in that file. 706The expectation is that this will normally 707be one user only, 708and the use will be for network mail forwarding. 709.pp 710Forwarding also permits a user to specify a private incoming mailer. 711For example, 712forwarding to: 713.(b 714"\^|\|/usr/local/newmail myname" 715.)b 716will use a different incoming mailer. 717.sh 3 "Inclusion" 718.pp 719Inclusion is specified in ARPANET syntax: 720.(b 721:Include: pathname 722.)b 723An address of this form reads the file specified by 724.i pathname 725and sends to all users listed in that file. 726.pp 727The intent is 728.i not 729to support direct use of this feature, 730but rather to use this as a subset of aliasing. 731For example, 732an alias of the form: 733.(b 734project: :include:/usr/project/userlist 735.)b 736is a method of letting a project maintain a mailing list 737without interaction with the system administration, 738even if the alias file is protected. 739.pp 740It is not necessary to rebuild the alias database 741when a :include: list is changed. 742.sh 2 "Message Delivery" 743.pp 744Internally, 745the recipient list is stored as one list per mailer. 746Each mailer list can be scanned trivially 747and mail to each host picked out to implement message batching. 748Each address is marked as it is sent, 749so rescanning the list is safe; 750this makes sending to mailers that can only accept one user easy. 751An argument list is built as the scan proceeds. 752Mail to files is detected during the scan of the send list. 753.pp 754When an argument vector is built, 755.i sendmail 756creates a pipe and subprocess for the mailer. 757The parent calls an 758.q "editing function" 759which makes the per-mailer changes to the header 760and sends the result to the mailer; 761a different editing function is used for sending error messages 762which prepends the error information. 763.pp 764The exit status from the mailer is collected 765after the message is sent, 766and a diagnostic is printed if appropriate. 767If any mail is rejected by the mailer, 768a flag is set to invoke the return-to-sender function 769after all delivery completes. 770.sh 2 "Exit Status" 771.pp 772An exit status is returned that corresponds to the system standard 773used by the other mailers. 774.sh 2 "Interaction With Other Mailers" 775.pp 776Two examples of how network-specific work is passed to other programs 777are the incoming UUCP mailer 778(\c 779.i rmail ) 780and the outgoing ARPANET mailer. 781.sh 3 "Incoming UUCP mail" 782.pp 783Mail coming in from the UUCP network 784is not guaranteed to have a normal header line, 785nor will an argument be passed telling who it is from\**. 786.(f 787\**As a result of this, 788it is impossible to verify UUCP sender addresses. 789.)f 790Fortuitously, 791UUCP mail calls the program 792.i rmail 793rather than 794.i mail 795or 796.i sendmail . 797The 798.i rmail 799program has been modified here to do the special-purpose parsing 800necessary to decode UUCP headers 801and turn them into a normal UUCP address; 802this address is then passed to 803.i sendmail . 804.sh 3 "Outgoing ARPANET mail" 805.pp 806The ARPANET imposes many standards that 807.i sendmail 808does not care to enforce. 809For example, 810an arpanet sitename must be on 811.i every 812address, 813not just the 814.q "From:" 815address. 816Certain UNIX sites like to use 817.q % 818as an alternative to 819.q @ , 820which must be translated. 821The outgoing ARPANET mailer makes these transformations 822before passing the message to the network. 823.sh 1 CONFIGURATION 824.pp 825Configuration is controlled primarily by the file 826.i /usr/lib/sendmail.cf . 827.i Sendmail 828should not need to be recomplied except 829.np 830To change operating systems 831(V6, V7/32V, 4BSD). 832.np 833To remove or insert the DBM 834(UNIX database) 835library. 836.np 837To change ARPANET reply codes. 838.np 839To add headers requiring special processing. 840.lp 841Adding mailers or changing parsing 842(i.e., rewriting) 843or routing information 844does not require recompilation. 845.pp 846If the mail is being sent by a local user, 847and the file 848.q .mailcf 849exists in the sender's home directory, 850that file is read as a configuration file 851after the system configuration file. 852The primary use of this is to add header lines. 853.sh 2 "Configuration File Description" 854.pp 855The configuration file is formatted 856as a series of text lines, 857each beginning with a character describing its semantics. 858Blank lines and lines beginning with a sharp sign 859(#) 860are ignored. 861Other lines are: 862.(b 863.ta 3n 864D define macro 865H define header 866M define mailer 867S use rewriting set 868C define word class 869R specify rewriting rule 870.)b 871.pp 872See figure 2 for an example configuration file. 873.(z 874.hl 875.sz -2 876.re 877########################################## 878# sendmail configuration file 879# @(#)sendmail.cf 3.6 8/17/81 880########################################## 881.sp \n(psu 882### local hosts on various nets 883DABerkeley 884DBIngVAX 885DUucbvax 886.sp \n(psu 887### special macros 888# my name 889D\&n\&MAILER-DAEMON 890# UNIX header format 891D\&l\&From $g $d 892# delimiter (operator) characters 893D\&o\&.:@!^ 894.sp \n(psu 895### format of headers: 896H\&Date: $a 897H\&From: $g$?x ($x)$. 898H\&Full-Name: $x 899H\&Message-Id: <$t.$p.$B@$A> 900H\&Posted-Date: $a 901.sp \n(psu 902### name classifications 903# arpanet hostnames 904C\&A\&ucb berkeley 905# list of local host names 906C\&B\&j IngVax 907# berknet hosts on the arpanet 908C\&C\&i ingres ing70 909# uucp hostnames 910C\&U\&ucbvax ernie 911.sp \n(psu 912.ta \w'M\&local 'u +\w'/usr/net/bin/sendberkmail 'u +\w'rlsAmn 'u +\w'$f@$A 'u 913### mailers 914# local mail -- must be zero 915M\&local /bin/mail rlsAmn $f ...local\&mail -d $u 916# program mail -- must be one 917M\&prog /bin/csh lA $f ...prog\&mail -fc $u 918# berkeley net mail 919M\&berk /usr/net/bin/sendberkmail fxs $B:$f ...berk\&mail -m $h -h $c -t $u 920# arpanet mail 921M\&arpa /usr/lib/mailers/arpa sAu $f@$A ...arpa\&mail $f $h $u 922# uucp mail 923M\&uucp /usr/bin/uux rsDxm $U!$f ...uucp\&mail - $h!rmail ($u) 924.sp \n(psu 925### rewriting rules 926.ta \w'R\&CSVAX:$-h!$+u 'u +\w'$#berk$@ing70$:$+u@$+h 'u 927R\&$-h.$+u $+h:$+u change "." to ":" 928R\&$=C:$+u@$-h $+u@$+h delete ing70: on arpanet addresses 929R\&$+u@$=A ing70:$+u delete local arpa hosts 930R\&$+u@$-h $#berk$@ing70$:$+u@$+h send arpa mail to ing70 931R\&$+h^$+u $+h!$+u change "^" to "!" 932R\&$-x!$=U!$+y csvax:$+y delete uucp loops through csvax 933R\&$-h!$+u csvax:$+h!$+u send uucp mail to csvax 934R\&$-x:$-h:$+u $+h:$+u delete multiple berk hosts 935R\&$=B:$+u $+u delete local berk hosts 936R\&$-h:$+u $#berk$@$+h$:$+u resolve berk mail 937R\&$+u $#local$:$+u resolve local mail 938.sp \n(psu 939### rewriting rules for from host 940S\&1 941R\&ing70:$+u@$-h $+u@$+h arpanet mail is automatic 942R\&CSVAX:$-h!$+u $+h!$+u uucp mail is automatic 943.sz 944.sp 945.ce 946Figure 2. Sample configuration file. 947.hl 948.)z 949.sh 3 "D \*- define macro" 950.(b 951.b D \c 952.i x\|val 953.)b 954.pp 955This line defines a macro 956with the single character name 957.i x 958and value 959.i val . 960Macros can be interpolated using the escape 961.b $ \c 962.i x , 963where 964.i x 965is the macro name. 966By convention, 967all upper-case letters are unused by 968.i sendmail 969and may be used freely by the user; 970all other names are reserved for use by sendmail. 971Certain macros 972.i must 973be defined, 974and are used internally. 975These are: 976.(b 977.ta 4n 978$l UNIX-style \*(lqFrom\*(rq line. 979$n My address in error messages. 980$o \*(lqOperators\*(rq in addresses. 981.)b 982The 983.b $l 984macro is expanded when 985.i sendmail 986wants to insert a UNIX-style 987.q From 988line on messages. 989This typically expands to something like: 990.(b 991From sally Wed Aug 12 09:15:13 1981 992.)b 993The 994.b $n 995macro is used as the name of this process 996when error messages are being mailed back. 997Typically, 998it is wise to include an alias 999so that mail to this address will be sent to root. 1000The 1001.b $o 1002macro defines the characters 1003that will separate words when addresses are being broken up. 1004Each of these becomes a word by itself when scanned. 1005Blanks and tabs are built-in separators 1006but are ignored, 1007i.e., are not turned into words. 1008For example, the input: 1009.(b 1010Ing70: ZRM @ MIT-MC SRI-KL 1011.)b 1012Is broken up into the six words: 1013.(b 1014Ing70, :, ZRM, @, MIT-MC, SRI-KL 1015.)b 1016assuming that colon and at-sign are operators 1017(but hyphen is not). 1018.pp 1019A number of macros are defined by 1020.i sendmail 1021for use as primitives. 1022These are: 1023.(l 1024.ta 5n 1025$a The \*(lqDate:\*(rq line date in ARPANET format. 1026$b The current date in ARPANET format. 1027$c The hop count. 1028$d The date in UNIX (ctime) format. 1029$f The sender's (from) address. 1030$g The sender's address translated by the mailer. 1031$h The host of the recipient. 1032$p The process id of sendmail in decimal. 1033$t The time in seconds in decimal. 1034$u The user part of the recipient. 1035$v The version number of sendmail. 1036$x The full name of the sender. 1037$y The id of the sender's terminal. 1038$z The home directory of the recipient. 1039.)l 1040.pp 1041There are three types of dates that can be used. 1042The 1043.b $a 1044and 1045.b $b 1046macros are in ARPANET format; 1047.b $a 1048is a copy of the time extracted from the 1049.q Date: 1050field of the incoming message 1051(if there was one), 1052and 1053.b $b 1054is the current date and time \*- used for postmarks. 1055If no 1056.q Date: 1057is found in the message, 1058they are the same. 1059The 1060.b $d 1061macro has the date in UNIX 1062.i ctime 1063format; 1064this is extracted from the message if possible 1065and is otherwise the current date. 1066.pp 1067The 1068.b $f 1069macro is the id of the sender 1070as originally determined; 1071when mailing to a specific person, 1072the 1073.b $g 1074macro is the address of the sender 1075with respect to the receiver. 1076For example, 1077if I send to 1078.q csvax:samwise 1079the 1080.b $f 1081and 1082.b $g 1083macros are: 1084.(b 1085.ta 4n 1086$f eric 1087$g IngVAX:eric 1088.)b 1089This only applies to the first step in the link. 1090For example, 1091sending to Ing70:drb@bbn-unix, 1092we have 1093.b $f 1094and 1095.b $g 1096as above for the transfer to Ing70, but: 1097.(b 1098$f IngVAX:eric 1099$g IngVAX:eric@Berkeley 1100.)b 1101for transfer to the ARPANET. 1102.pp 1103The 1104.b $x 1105macro is set to the full name of the sender. 1106This can be determined in several ways. 1107It can be passed as a flag to 1108.i sendmail . 1109The 1110.q Full-Name: 1111line in the header is the second option, 1112and the comment portion of the 1113.q From: 1114line is the third. 1115If all of these fail, 1116and if the message is being originated locally, 1117the full name is looked up in the 1118.i passwd 1119file. 1120.pp 1121When sending, the 1122.b $u , 1123.b $h , 1124and 1125.b $z 1126macros get set to the user, host, and home directory 1127(respectively) 1128of the receiver. 1129The host is only set if the user is not local, 1130and the home directory is only set if the user is local. 1131.pp 1132The 1133.b $p 1134and 1135.b $t 1136macros are used to create unique strings. 1137The 1138.b $y 1139macro is set to the id of the terminal of the sender 1140(if known); 1141some systems like to put this in the 1142.q From 1143line. 1144The 1145.b $v 1146macro is set to the version number of 1147.i sendmail , 1148and can be used in postmarks 1149to help debugging. 1150.pp 1151A primitive conditional is available during macro expansion. 1152The construct: 1153.(b 1154$?x text1 $: text2 $. 1155.)b 1156tests if macro 1157.b $ \c 1158.i x 1159is defined. 1160If it is, 1161text1 is interpolated; 1162otherwise, 1163text2 is interpolated. 1164.sh 3 "H \*- define header" 1165.(b 1166.b H \c 1167.i "Field-Name" \c 1168.b ":" " \c 1169.i "field value" 1170.)b 1171.pp 1172The 1173.b H 1174line looks like a regular header line, 1175except that the field value is macro expanded 1176before use. 1177All headers mentioned in this way 1178are automatically inserted 1179into every message 1180except for headers mentioned in the compile-time 1181configuration file 1182.i conf.c . 1183These headers are 1184Date, 1185From, 1186Full-Name, 1187Message-Id, 1188and 1189Received-Date. 1190To get these fields the appropriate flag 1191must be specified 1192for the receiving mailer. 1193.pp 1194Since the file 1195.q ".mailcf" 1196in the sender's home directory is read and processed, 1197it is possible to add customized header lines. 1198For example, 1199the .mailcf consisting of: 1200.(b 1201H\&Phone: (415) 888-7770 1202.)b 1203will add that line to every outgoing message. 1204.sh 3 "M \*- define mailer" 1205.(b F 1206.b M \c 1207.i mailer-name 1208.i pathname 1209.i flags 1210.i from-macro 1211.i "argument list" 1212.)b 1213.pp 1214This line is structured into fields 1215separated by white space (spaces or tabs). 1216The fields are: 1217.np 1218The internal name of the mailer, 1219referred to in the rewriting rules. 1220.np 1221The pathname of the program to execute for this mailer. 1222.np 1223The flags for this mailer, 1224described below. 1225.np 1226The macro string to become the 1227.b $g 1228macro (translated sender) 1229for this mailer. 1230.np 1231The argument vector passed to the mailer 1232(macro expanded). 1233.pp 1234The flags are a series of characters: 1235.ls 1 1236.ip f 1237The mailer wants a 1238.b \-f 1239.i from 1240flag, 1241but only if this is a network forward operation 1242(i.e., 1243the mailer will give an error 1244if the executing user does not have special permissions). 1245.ip r 1246Same as 1247.b f , 1248but sends a 1249.b \-r 1250flag. 1251.ip q 1252Don't print errors \*- the mailer will do it for us. 1253.ip S 1254Don't reset your userid before calling the mailer. 1255This would be used in a secure environment where 1256.i sendmail 1257ran as a special user. 1258This could be used to prevent 1259(or at least complicate) 1260forged addresses. 1261This option is suppressed in 1262.q unsafe 1263configuration files 1264(i.e., user-supplied, either on a 1265command line 1266option, or in the 1267.i \&.mailcf 1268file in the home directory). 1269.ip n 1270This mailer does not want a UNIX-style 1271.q From 1272line on the message. 1273.ip l 1274This mailer is local, 1275so no host will be specified. 1276Also, 1277the mailer wants special local processing 1278(such as a 1279.q Received-Date: 1280field). 1281.ip s 1282Strip quote characters off of addresses 1283before calling the mailer. 1284.ip m 1285This mailer can send to multiple users 1286(on the same host) 1287in one call. 1288.ip F 1289This mailer wants a 1290.q From: 1291header line. 1292.ip D 1293This mailer wants a 1294.q Date: 1295header line. 1296.ip M 1297This mailer wants a 1298.q Message-Id: 1299header line. 1300.ip x 1301This mailer wants a 1302.q Full-Name: 1303header line. 1304.ip u 1305Upper case should be preserved in user names. 1306.ip h 1307Upper case should be preserved in host names. 1308.ip A 1309This mailer wants an ARPANET standard header 1310(equivalent to the 1311.b F 1312and 1313.b D 1314flags). 1315.ls 1316.sh 3 "S \*- use rewriting set" 1317.(b 1318.b S \c 1319.i N 1320.)b 1321.pp 1322There are two sets of rewriting rules. 1323Set zero is used to rewrite recipient addresses. 1324Set one is used to rewrite sender addresses. 1325Set one can be used to eliminate implicit links. 1326For example, 1327if there exists a site on on the BerkNet called 1328.q Ing70 1329which is an ARPANET gateway, 1330and we are on a site called 1331.q IngVAX , 1332ARPANET mail coming into 1333.q Ing70 1334for someone on 1335.q IngVAX 1336will read: 1337.(b 1338From: Ing70:auser@ahost 1339.)b 1340Rewriting set one can rewrite this as: 1341.(b 1342From: auser@ahost 1343.)b 1344since 1345.q Ing70 1346will be implied. 1347.pp 1348When you change to a new set, 1349the previous content of that set is cleared. 1350.sh 3 "R \*- rewriting rule" 1351.(b F 1352.b R \c 1353.i pattern 1354.i replacement 1355.i comments 1356.)b 1357.pp 1358The rewriting rules drive the address parser. 1359The rewriting process is essentially textual. 1360First, 1361the address to be rewritten is broken up into words. 1362Words are defined as strings of non-special characters 1363separated by white space or single special characters 1364as defined by the 1365.b $o 1366macro. 1367Then, 1368the words are rewritten using simple pattern matching. 1369Words in the pattern match themselves 1370unless they begin with dollar sign. 1371The dollar escapes have the following meanings\**: 1372.(f 1373\**These dollar escapes have nothing to do with macro expansion. 1374.)f 1375.(b 1376.ta 6n 1377$-x Match a single word (and call it x). 1378$+x Match one or more words (and call them x). 1379$=c Match any word in class c (see below). 1380.)b 1381The case of letters is ignored in pattern matching 1382(including class comparisons). 1383.pp 1384When a pattern (also called a left hand side or LHS) 1385matches, 1386the input is rewritten as defined by the right hand side (RHS). 1387Acceptable escapes in the RHS are: 1388.(b 1389.ta \w'$#mailer 'u 1390$+x Replace from corresponding match in LHS. 1391$#mailer Canonical mailer name. 1392$@host Canonical host name. 1393$:user Canonical user name. 1394.)b 1395The replacement from the LHS to the RHS does not use macros, 1396and there are no name conflicts. 1397Each pattern reexecutes until it fails. 1398As soon as the input resolves to a canonical name 1399(i.e., 1400.q "$#mailer$@host$:user" ), 1401rewriting ends; 1402otherwise, 1403the next pattern is tried. 1404The 1405.q "$@host" 1406part is not needed 1407if the mailer does not require a host. 1408The special mailer 1409.q error 1410causes the user part to be printed as an error. 1411.sh 3 "C \*- define word class" 1412.(b F 1413.b C \c 1414.i c\|word\&1 1415.i word\&2 ... 1416.)b 1417.pp 1418There are twenty six word classes, 1419represented as 1420.q A 1421through 1422.q Z . 1423For example: 1424.(b 1425CVcsvax ingvax esvax 1426.)b 1427defines the words 1428.q csvax , 1429.q ingvax , 1430and 1431.q esvax 1432to all be in class 1433.q V , 1434so that 1435.q $=V 1436on the LHS of a rewriting rule 1437will match any of these words. 1438.sh 2 "A Detailed Example" 1439.pp 1440We will now follow the configuration file 1441in figure 2 1442through in detail. 1443.sh 3 "Macro definitions" 1444.(b 1445DABerkeley 1446DBIngVAX 1447DUucbvax 1448DnMAILER-DAEMON 1449DlFrom $g $d 1450Do.:@!^ 1451.)b 1452The first three macros are for convenience only, 1453and are used to define the local host names 1454on the ARPANET, BerkNet, and the UUCP net 1455respectively. 1456.pp 1457Macro 1458.b n 1459defines the name of 1460.i sendmail 1461when error messages are sent. 1462Macro 1463.b l 1464defines what the first line 1465of a message in UNIX format looks like, 1466in this case the version 7 standard of: 1467.(b 1468From sender-name time-of-submission 1469.)b 1470The 1471.b o 1472macro 1473tells what characters will be distinct from names 1474when scanning addresses. 1475In this case, 1476dot and colon will be used 1477to distinguish BerkNet addresses, 1478at sign for ARPANET addresses, 1479and exclamation point and caret for UUCP addresses. 1480.sh 3 "Header definitions" 1481.(b 1482H\&Date: $a 1483H\&From: $g$?x ($x)$. 1484H\&Full-Name: $x 1485H\&Message-Id: <$t.$p.$B@$A> 1486H\&Posted-Date: $a 1487.)b 1488These define the headers 1489that may be added to a message. 1490The 1491.q Date: 1492is just the ARPANET idea of the date. 1493The 1494.q From: 1495line is the translated version of the sender, 1496followed by the sender's full name if known. 1497The 1498.q Full-Name: 1499field is used to transmit the sender's full name 1500when a 1501.q From: 1502line is not being sent; 1503these will normally be mutually exclusive. 1504The 1505.q Message-Id: 1506field has the time and process id's concatenated 1507with the BerkNet and ARPANET addresses 1508to make a unique string. 1509Finally, the 1510.q Posted-Date: 1511is the date in ARPANET format; 1512it differs from 1513.q Date: 1514in that it is always output as soon as the message enters 1515.i sendmail 's 1516domain, 1517and hence indicates the time that the message first enters 1518the mail delivery system 1519[Postel79b, NBS80]. 1520.sh 3 "Name classifications" 1521.(b 1522C\&A\&ucb berkeley 1523C\&B\&j IngVax 1524C\&C\&i ingres ing70 1525C\&U\&ucbvax ernie 1526.)b 1527These commands put the words 1528.q ucb 1529and 1530.q berkeley 1531into class 1532.q A , 1533the valid names of this site on the ARPANET. 1534Words 1535.q j 1536and 1537.q ingvax 1538are in class 1539.q B , 1540the local names on BerkNet. 1541Class 1542.q C , 1543the names of the site which has the ARPANET link, 1544has the words 1545.q i , 1546.q ingres , 1547and 1548.q ing70 . 1549Finally, 1550.q ucbvax 1551and 1552.q ernie 1553are the UUCP names of our UUCP gateway, 1554and are in class 1555.q U . 1556.pp 1557The classes will be used in the patterns of the rewriting rules 1558as described below. 1559.sh 3 "Mailer definitions" 1560.(b 1561.sz -2 1562.ta \w'M\&local 'u +\w'/usr/net/bin/sendberkmail 'u +\w'rlsAmn 'u +\w'$f@$A 'u 1563M\&local /bin/mail rlsAmn $f ...localmail -d $u 1564M\&prog /bin/csh lA $f ...progmail -fc $u 1565M\&berk /usr/net/bin/sendberkmail fxs $B:$f ...berkmail -m $h -h $c -t $u 1566M\&arpa /usr/lib/mailers/arpa sAu $f@$A ...arpamail $f $h $u 1567M\&uucp /usr/bin/uux rsDxm $U!$f ...uucpmail - $h!rmail ($u) 1568.sz 1569.)b 1570Five mailers are known in the configuration file. 1571The first two 1572.i must 1573be for local and program mail, 1574and must come as the first and second mailers respectively. 1575.pp 1576Local mail is sent using 1577/bin/mail. 1578It takes a 1579.b \-r 1580flag, 1581is local, 1582quote characters are stripped before sending, 1583takes ARPANET standard headers, 1584can deliver to multiple recipients at once, 1585and does not want a UNIX-style 1586.q From 1587line since it will add one itself. 1588The translated from address is the same as the raw from address, 1589since no network hops are made. 1590The argument vector has a program name, 1591a 1592.b \-d 1593flag (\c 1594.q "really deliver" , 1595which must be added to /bin/mail), 1596and the list of recipients \*- one recipient per argument. 1597.pp 1598Mail piped through programs 1599is interpreted by /bin/csh. 1600Unlike local mail, 1601it does not take a 1602.b \-r 1603flag, 1604quotes should be left, 1605it can only deal with one user, 1606and it does want a UNIX-style 1607.q From 1608line, 1609but is still local and still wants an ARPANET style header. 1610.pp 1611BerkNet mail is processed by 1612/usr/net/bin/sendberkmail. 1613It takes a 1614.b \-f 1615flag, 1616wants a 1617.q Full-Name: 1618header line, 1619and wants quotes stripped. 1620The 1621.q Full-Name: 1622is used here because if it were given as a comment 1623in a 1624.q From: 1625line the machine address of the sender 1626would not be modified by later instantiations of 1627.i delivermail \**. 1628.(f 1629\**\c 1630.i Delivermail 1631did no header editing, 1632so 1633.q From: 1634lines were always passed untouched. 1635When the gateways are converted to 1636.i sendmail 1637this can be changed. 1638.)f 1639The from address as seen by the receiver is 1640.q IngVAX:sender , 1641and it takes a flag-oriented 1642rather than a positional 1643command list. 1644.pp 1645The ARPANET wants quotes stripped, 1646ARPANET standard headers, 1647and wants the user name left with case intact. 1648It takes a positional command list. 1649.pp 1650UUCP mail calls 1651.i uux 1652with a 1653.b \-r 1654flag, 1655quotes stripped, 1656a 1657.q Date: 1658line, 1659a 1660.q Full-Name: 1661line, 1662and with multiple users listed. 1663.sh 3 "Rewriting rules for recipient addresses" 1664.(b 1665.sz -2 1666.ta \w'[88] 'u +\w'R\&CSVAX:$-h!$+u 'u +\w'$#berk$@ing70$:$+u@$+h 'u 1667[1] R\&$-h.$+u $+h:$+u change "." to ":" 1668[2] R\&$=C:$+u@$-h $+u@$+h delete ing70: on arpanet addresses 1669[3] R\&$+u@$=A ing70:$+u delete local arpa hosts 1670[4] R\&$+u@$-h $#berk$@ing70$:$+u@$+h send arpa mail to ing70 1671[5] R\&$+h^$+u $+h!$+u change "^" to "!" 1672[6] R\&$-x!$=U!$+y csvax:$+y delete uucp loops through csvax 1673[7] R\&$-h!$+u csvax:$+h!$+u send uucp mail to csvax 1674[8] R\&$-x:$-h:$+u $+h:$+u delete multiple berk hosts 1675[9] R\&$=B:$+u $+u delete local berk hosts 1676[10] R\&$-h:$+u $#berk$@$+h$:$+u resolve berk mail 1677[11] R\&$+u $#local$:$+u resolve local mail 1678.sz 1679.)b 1680The first rule translates dots to colons. 1681Redundant explicit routing to the ARPANET is deleted 1682in the second rule. 1683Hops out over the ARPANET 1684back to us are deleted in the third rule \*- 1685note that the BerkNet host that we would have come in on 1686is inserted. 1687Real ARPANET mail is resolved immediately with no further ado \*- 1688it is sent out over the BerkNet to the ing70, 1689and further rewriting stops immediately. 1690.pp 1691Carets are changed to exclamation points 1692for UUCP addresses in the fifth rule. 1693The sixth rule deletes loops out into UUCP land 1694and back to us \*- noting that we will be left on CSVAX. 1695Multiple BerkNet hosts are deleted in rule seven \*- 1696this can occur internally quite easily 1697as a side effect of a rewriting rule. 1698Rule eight deletes local BerkNet hosts. 1699The last two rules resolve BerkNet and local mail. 1700.pp 1701Consider the following examples. 1702The numbers to the left are the rule that is being applied 1703to make the transformation. 1704.(b 1705.re 1706 esvax.asa 1707[1] esvax:asa 1708[10] $#berk$@esvax$:asa 1709.)b 1710.(b 1711 research^vax135^dmr 1712[5] research!vax135^dmr 1713[5] research!vax135!dmr 1714[7] $#berk$@csvax$:research!vax135!dmr 1715.)b 1716.(b 1717 research!ucbvax!j:eric 1718[6] csvax:j:eric 1719[8] j:eric 1720[9] eric 1721[11] $#local$:eric 1722.)b 1723.(b 1724 ing70:wnj@Berkeley 1725[2] wnj@Berkeley 1726[3] ing70:wnj 1727[10] $#berk$@ing70$:wnj 1728.)b 1729.sh 3 "Rewriting rules for sender addresses" 1730.(b 1731.sz -2 1732.ta \w'R\&CSVAX:$-h!$+u 'u +\w'$+u@$+h 'u 1733S\&1 1734R\&ing70:$+u@$-h $+u@$+h arpanet mail is automatic 1735R\&CSVAX:$-h!$+u $+h!$+u uucp mail is automatic 1736.sz 1737.)b 1738The 1739.b S 1740line starts putting the rules into set one. 1741These rules strip off the 1742.q ing70: 1743from incoming ARPANET mail 1744and the 1745.q CSVAX: 1746off of incoming UUCP mail. 1747.pp 1748The name classes could be used here, 1749but using literal strings is safe 1750because they will always be program-generated. 1751.sh 1 "COMPARISON WITH OTHER MAILERS" 1752.sh 2 "Delivermail" 1753.pp 1754.i Sendmail 1755is an outgrowth of 1756.i delivermail . 1757The primary differences are: 1758.np 1759Configuration information is not compiled in. 1760This simplifies many of the problems 1761of moving to other machines. 1762It also allows easy debugging of new mailers. 1763.np 1764Address parsing is more flexible. 1765For example, 1766.i delivermail 1767only supported one gateway to any network, 1768whereas 1769.i sendmail 1770can be sensitive to host names 1771and reroute to different gateways. 1772.np 1773Forwarding and 1774:include: 1775features eliminate the requirement that the system alias file 1776be writable by any user 1777(or that an update program be written, 1778or that the system administration make all changes). 1779.np 1780.i Sendmail 1781supports message batching across networks 1782when a message is being sent to multiple recipients. 1783.sh 2 "MMDF" 1784.pp 1785MMDF 1786[Crocker79] 1787spans a much wider problem set than 1788.i sendmail . 1789For example, 1790MMDF includes a 1791.q "phone network" 1792mailer, whereas 1793.i sendmail 1794calls on preexisting mailers in most cases. 1795.i Sendmail 1796is approximately equivalent to the 1797SUBMIT and DELIVER phases of MMDF. 1798Because of this difference in design goals, 1799some of the important features of MMDF 1800(queueing, retransmission, and two-phase timeout) 1801are unimplemented by 1802.i sendmail . 1803.pp 1804MMDF and 1805.i sendmail 1806both support aliasing, 1807customized mailers, 1808message batching, 1809and automatic forwarding to gateways. 1810.sh 2 "Message Processing Module" 1811.pp 1812The Message Processing Module (MPM) 1813discussed by Postel [Postel79b] 1814matches 1815.i sendmail 1816closely in terms of its basic architecture. 1817However, 1818like MMDF, 1819the MPM includes the network interface software 1820as part of its domain. 1821.pp 1822MPM also postulates a duplex channel to the receiver, 1823as does MMDF. 1824This allows simpler handling of errors 1825by the mailer 1826than possible in 1827.i sendmail ; 1828when a message queued by 1829.i sendmail 1830is sent, 1831any errors must be returned to the sender 1832by the mailer itself. 1833Both MPM and MMDF mailers 1834can return an immediate error response, 1835and a single error processor can create an appropriate response. 1836.pp 1837MPM prefers passing the message as a structured message, 1838with type-length-value tuples. 1839This implies a much higher degree of cooperation 1840between mailers than required by 1841.i sendmail . 1842MPM also assumes a universally agreed upon internet name space 1843(with each address a net-host-user tuple), 1844which 1845.i sendmail 1846does not. 1847.sh 1 "EVALUATIONS AND FUTURE PLANS" 1848.pp 1849.i Sendmail 1850is designed to work in a nonhomogeneous environment. 1851Every attempt is made to avoid imposing any constraints 1852on the underlying mailers. 1853This goal has driven much of the design. 1854One of the major problems 1855has been the lack of a uniform address space, 1856as postulated in [Postel79a] 1857and [Postel79b]. 1858.pp 1859A nonuniform address space implies that path will be specified 1860in all addresses, 1861either explicitly (as part of the address) 1862or implicitly 1863(as with implied forwarding to gateways). 1864This has the unpleasant effect of making replying to messages 1865exceedingly difficult, 1866since there is no one 1867.q address 1868for any person, 1869but only a way to get there from wherever you are. 1870.pp 1871Interfacing to mail programs 1872that were not initially intended to be applied 1873in an internet environment 1874has been amazingly successful, 1875and has reduced the job to a manageable task. 1876.pp 1877However, 1878many of these mailers implement their own queueing and retransmission. 1879In networks that support store-and-forward file transfer, 1880such as BerkNet and UUCP, 1881this feature must be supplied already. 1882However, 1883networks that transfer in real time, 1884such as the ARPANET or an Ether-based network 1885[Metcalfe76], 1886generally do not provide these features. 1887Also, 1888networks which provide these generally do not understand 1889timeouts or returning the text of the message on error, 1890both highly desirable features\**. 1891.(f 1892\**We have implemented an ARPANET mailer which 1893returns the message on error and does one-stage timeout 1894(returning the message after three days). 1895.)f 1896Such queueing, retransmission, and two-phase timeout 1897may be integrated into 1898.i sendmail 1899if it seems desirable. 1900.pp 1901.i Sendmail 1902has knowledge of a few difficult environments 1903built in. 1904It generates ARPANET FTP compatible error messages 1905(prepended with three-digit numbers 1906[Neigus73, Postel74]) 1907as necessary, 1908optionally generates UNIX-style 1909.q From 1910lines on the front of messages for some mailers, 1911and knows how to parse the same lines on input. 1912This can be inconvenient to sites which have abandoned UNIX mail, 1913although 1914.i sendmail 1915still adds and understands ARPANET-style 1916.q From: 1917lines. 1918Also, 1919error handling has an option customized for BerkNet. 1920.pp 1921One surprisingly major annoyance in most internet mailers 1922(such as MMDF) 1923is that the location and format of local mail is built in\**. 1924.(f 1925\**For example, 1926MMDF puts local mail in the file 1927.q .mail 1928\*- useful if you are running version 6. 1929.)f 1930.i Sendmail 1931eliminates all knowledge of location 1932and can function successfully with different formats. 1933.pp 1934The ability to automatically generate a response to incoming mail 1935(by forwarding mail to a program) 1936seems useful 1937(\c 1938.q "I am on vacation until late August...." ) 1939but can create problems 1940such as forwarding loops 1941(two people on vacation whose programs send notes back and forth, 1942for instance) 1943if these programs are not well written. 1944A program should be written to do standard tasks correctly, 1945but this does not solve the general case. 1946It might be desirable to implement some form of load limiting. 1947I am unaware of any mail system that addresses this problem, 1948nor am I aware of any reasonable solution at this time. 1949.pp 1950.i Sendmail 1951should be modified to run as a daemon, 1952reading an MPX file 1953(or other IPC scheme) 1954to receive mail and process it. 1955This would reduce the cost of sending mail to writing the message 1956into a known file. 1957.i Sendmail 1958would be modified to have a very different argument structure. 1959It already has an option to read the recipients 1960from the message header. 1961A more palatable technique for giving error messages 1962would also have to be devised. 1963.pp 1964The configuration file is currently practically inscrutable; 1965considerable convenience could be realized 1966with a higher-level format. 1967For example, a description might read: 1968.(b 1969.re 1970(MACRO name value) 1971(HEADER name value 1972 (OPTION option) ... 1973 (NEEDS option) ... ) 1974(MAILER name path xlatstring 1975 (OPTION option) ... 1976 (ARGV arg ... )) 1977(CLASS name word ...) 1978(REWRITE setname 1979 (RULE lhs rhs) ... ) 1980.)b 1981.pp 1982It seems clear that common protocols will be changing soon 1983to accommodate changing requirements and environments. 1984These changes will include modifications to the message header 1985[NBS80] 1986or to the body of the message itself 1987(such as for multimedia messages 1988[Postel80]). 1989Other changes will include changes to communication protocols 1990which may effect 1991.i sendmail ; 1992for example, the changes implied by the new Mail Transfer Protocol 1993[Sluizer81]. 1994These changes should be relatively trivial to integrate 1995into the existing system. 1996.pp 1997Many other nice features could be implemented. 1998For example, 1999if we were sure that the alias file were writable by the effective user 2000(i.e., if 2001.i sendmail 2002were to run setuid) 2003then the inverted form could be rebuilt automatically when the 2004text copy was changed. 2005However, this appears to be little more than frosting. 2006.pp 2007Some proposals call for a single address syntax, 2008such that the host name uniquely determines the network. 2009There are a number of evident problems with this. 2010In a large internet, 2011the database update problem becomes considerable, 2012especially under multiple managements; 2013this can be solved by a daemon that updates the tables 2014dynamically, 2015but it is not clear what the problems are here. 2016More to the point, 2017this requires a unique namespace among all networks. 2018In our current configuration 2019we have been unable to even find out the names of all the hosts 2020on the UUCP network; 2021to hope that on an internet with fifty or more networks 2022would have no name conflicts is beyond the scope of 2023.i sendmail . 2024Despite the difficulties, however, 2025this is probably a better long-term solution to the problem 2026of internet addressing. 2027The ambiguities implied by addresses combining 2028left-associative and right-associative addresses 2029are impossible to solve without parentheses; 2030acceptable for mathematical equations, 2031but absurd for network addresses. 2032.pp 2033A related problem occurs with the user namespace. 2034In tightly coupled environments, 2035it would be nice to have automatic forwarding between machines 2036on the basis of the user name alone, 2037without cumbersome aliases. 2038This would require an automatically updated database 2039and some method of resolving conflicts. 2040Ideally this would be effective even with multiple managements. 2041A student at Berkeley, 2042Alan Biocca, 2043is working on a facility which may provide the necessary functionality. 2044.pp 2045In the long run, 2046a system that understands canonical internet addresses 2047(net, host, user) 2048implemented in a world that understands these addresses 2049would be an incredible win. 2050.i Sendmail 2051seems to be a useful tool to pull together 2052the haphazard environment that exists today, 2053until the better tools permeate the internetwork world. 2054.sh 0 "ACKNOWLEDGEMENTS" 2055.pp 2056Thanks are due to Kurt Shoens for his continual cheerful 2057assistance and good advice, 2058Bill Joy for pointing me in the correct direction 2059(over and over), 2060and Mark Horton for more advice, 2061prodding, 2062and many of the good ideas. 2063Kurt and Eric Schmidt are to be credited 2064for using 2065.i delivermail 2066as a server for their programs 2067(\c 2068.i Mail 2069and BerkNet respectively) 2070before any sane person should have, 2071and making the necessary modifications 2072promptly and happily. 2073Eric gave me considerable advice about the perils 2074of network software which saved me an unknown 2075amount of work and grief. 2076Mark did the original implementation of the DBM version 2077of aliasing, installed the VFORK code, 2078wrote the current version of 2079.i rmail , 2080and was the person who really convinced me 2081to put the work into 2082.i delivermail 2083to turn it into 2084.i sendmail . 2085Kurt deserves accolades for using 2086.i sendmail 2087when I was myself afraid to take the risk; 2088how a person can continue to be so enthusiastic 2089in the face of so much bitter reality is beyond me. 2090.pp 2091Kurt and Kirk McKusick 2092read early copies of this paper, 2093giving considerable useful advice. 2094.pp 2095Special thanks are reserved for Mike Stonebraker, 2096who knowingly allowed me to put so much work into this 2097when there were so many other things I really should 2098have been working on. 2099.+c 2100.ce 2101REFERENCES 2102.nr ii 1.5i 2103.ip [Crocker77a] 2104Crocker, D. H., 2105Vittal, J. J., 2106Pogran, K. T., 2107and 2108Henderson, D. A. Jr., 2109.ul 2110Standard for the Format of ARPA Network Text Messages. 2111RFC 733, 2112NIC 41952. 2113In [Feinler78]. 2114November 1977. 2115.ip [Crocker77b] 2116Crocker, D. H., 2117.ul 2118Framework and Functions of the MS Personal Message System. 2119R-2134-ARPA, 2120Rand Corporation, 2121Santa Monica, California. 21221977. 2123.ip [Crocker79] 2124Crocker, D. H., 2125Szurkowski, E. S., 2126and 2127Farber, D. J., 2128.ul 2129An Internetwork Memo Distribution Facility \*- MMDF. 21306th Data Communication Symposium, 2131Asilomar. 2132November 1979. 2133.ip [Metcalfe76] 2134Metcalfe, R., 2135and 2136Boggs, D., 2137.q "Ethernet: Distributed Packet Switching for Local Computer Networks" , 2138.ul 2139Communications of the ACM 19, 21407. 2141July 1976. 2142.ip [Feinler78] 2143Feinler, E., 2144and 2145Postel, J. 2146(eds.), 2147.ul 2148ARPANET Protocol Handbook. 2149NIC 7104, 2150Network Information Center, 2151SRI International, 2152Menlo Park, California. 21531978. 2154.ip [Borden79] 2155Borden, S., 2156Gaines, R. S., 2157and 2158Shapiro, N. Z., 2159.ul 2160The MH Message Handling System: Users' Manual. 2161R-2367-PAF. 2162Rand Corporation. 2163October 1979. 2164.ip [NBS80] 2165National Bureau of Standards, 2166.ul 2167Specification of a Draft Message Format Standard. 2168Report No. ICST/CBOS 80-2. 2169October 1980. 2170.ip [Neigus73] 2171Neigus, N., 2172.ul 2173File Transfer Protocol for the ARPA Network. 2174RFC 542, NIC 17759. 2175In [Feinler78]. 2176August, 1973. 2177.ip [Nowitz78a] 2178Nowitz, D. A., 2179and 2180Lesk, M. E., 2181.ul 2182A Dial-Up Network of UNIX Systems. 2183Bell Laboratories. 2184In 2185UNIX Programmer's Manual, Seventh Edition, 2186Volume 2. 2187August, 1978. 2188.ip [Nowitz78b] 2189Nowitz, D. A., 2190.ul 2191Uucp Implementation Description. 2192Bell Laboratories. 2193In 2194UNIX Programmer's Manual, Seventh Edition, 2195Volume 2. 2196October, 1978. 2197.ip [Postel74] 2198Postel, J., 2199and 2200Neigus, N., 2201Revised FTP Reply Codes. 2202RFC 640, NIC 30843. 2203In [Feinler78]. 2204June, 1974. 2205.ip [Postel77] 2206Postel, J., 2207.ul 2208Mail Protocol. 2209NIC 29588. 2210In [Feinler78]. 2211November 1977. 2212.ip [Postel79a] 2213Postel, J., 2214.ul 2215Internet Message Protocol. 2216RFC 753, 2217IEN 85. 2218Network Information Center, 2219SRI International, 2220Menlo Park, California. 2221March 1979. 2222.ip [Postel79b] 2223Postel, J. B., 2224.ul 2225An Internetwork Message Structure. 2226In 2227.ul 2228Proceedings of the Sixth Data Communications Symposium, 2229IEEE. 2230New York. 2231November 1979. 2232.ip [Postel80] 2233Postel, J. B., 2234.ul 2235A Structured Format for Transmission of Multi-Media Documents. 2236RFC 767. 2237Network Information Center, 2238SRI International, 2239Menlo Park, California. 2240August 1980. 2241.ip [Schmidt79] 2242Schmidt, E., 2243.ul 2244An Introduction to the Berkeley Network. 2245University of California, Berkeley California. 22461979. 2247.ip [Shoens79] 2248Shoens, K., 2249.ul 2250Mail Reference Manual. 2251University of California, Berkeley. 2252In UNIX Programmer's Manual, 2253Seventh Edition, 2254Volume 2C. 2255December 1979. 2256.ip [Sluizer81] 2257Sluizer, S., 2258and 2259Postel, J. B., 2260.ul 2261Mail Transfer Protocol. 2262RFC 780. 2263Network Information Center, 2264SRI International, 2265Menlo Park, California. 2266May 1981. 2267.ip [UNIX80] 2268.ul 2269The UNIX Programmer's Manual, Seventh Edition, 2270Virtual VAX-11 Version, 2271Volume 1. 2272Bell Laboratories, 2273modified by the University of California, 2274Berkeley California. 2275November 1980. 2276.++ A 2277.+c "SENDMAIL USAGE" 2278.pp 2279Arguments must be presented with flags before addresses. 2280The flags are: 2281.nr ii 1i 2282.ip "\-f addr" 2283The sender's machine address is 2284.i addr . 2285This flag is ignored unless the real user 2286is root, 2287network, 2288or uucp, 2289or if 2290.i addr 2291contains an exclamation point 2292(because of certain restrictions in UUCP). 2293.ip "\-r addr" 2294An obsolete form of 2295.b \-f . 2296.ip "\-h cnt" 2297Sets the 2298.q "hop count" 2299to 2300.i cnt . 2301This represents the number of times this message has been processed 2302by 2303.i sendmail 2304(to the extent that it is supported by the underlying networks). 2305.i Cnt 2306is incremented during processing, 2307and if it reaches 2308MAXHOP 2309(currently 30) 2310.i sendmail 2311throws away the message with an error. 2312.ip "\-F\&name" 2313Sets the full name of this user to 2314.i name . 2315.ip \-e\&p 2316Print error messages (default). 2317.ip \-e\&q 2318Throw away error messages. 2319The only response is the exit status. 2320.ip \-e\&m 2321Mail back errors. 2322.ip \-e\&w 2323.q Write 2324back errors \*- or mail them if the user is not logged in. 2325.ip \-e\&e 2326Do special error processing for BerkNet. 2327This involves mailing back the errors 2328but always returning a zero exit status. 2329.ip \-n 2330Don't do aliasing or forwarding. 2331.ip \-m 2332Include me in alias expansions. 2333Normally 2334.i sendmail 2335suppresses the sender 2336if in a group being sent to. 2337.ip \-i 2338Don't take a dot to end a message. 2339.ip \-t 2340Read the header for 2341.q To: , 2342.q Cc: , 2343and 2344.q Bcc: 2345lines, and send to everyone listed in those lists. 2346The 2347.q Bcc: 2348line will be deleted before sending. 2349Any addresses in the argument vector will be deleted 2350from the send list. 2351.ip \-a\&m 2352Do special processing for the 2353ARPANET. 2354This includes reading the 2355.q "From:" 2356line from the header to find the sender, 2357printing 2358ARPANET 2359style messages 2360(preceded by three digit reply codes for compatibility with 2361the FTP protocol 2362[Neigus73, Postel74, Postel77]), 2363and ending lines of error messages with <CRLF>. 2364.ip \-a\&f 2365Same as 2366.b \-a\&m , 2367except print out message numbers appropriate for the MLFL command 2368[Postel77]. 2369.ip \-s 2370Save UNIX-style 2371.q From 2372lines at the beginning of headers. 2373Normally they are assumed redundant 2374and discarded. 2375.ip \-v 2376Give a blow-by-blow description of function. 2377This gives information of interest to the user 2378rather than for the 2379.i sendmail 2380maintainer; 2381for example, 2382aliases are printed as expanded 2383and mailer functions are printed as they run. 2384.ip \-C\&file 2385Use a different configuration file. 2386.ip \-A\&file 2387Use a different alias file. 2388.ip \-I 2389Initialize the DBM version 2390of the alias file. 2391If 2392.b \-I 2393is given, 2394no delivery is attempted. 2395The DBM version will be rebuilt automatically if the DBM files 2396are mode 666, 2397or if they are owned by the effective userid. 2398.ip \-V 2399Verify the addresses only. 2400Only partial verification is done: 2401syntax is checked, and local names are verified, 2402but no checking normally done by the mailer is attempted. 2403.ip \-d\&level 2404Set debugging level. 2405.ip \-D\&x\&val 2406Define macro 2407.i x 2408to have value 2409.i val . 2410.nr ii 5n 2411.+c "OTHER CONFIGURATION" 2412.pp 2413There are some configuration changes that can be made by 2414recompiling 2415.i sendmail . 2416Some of these are changes to compilation flags: 2417.nr ii 1i 2418.ip V6 2419If set, 2420this will compile a version 6 system, 2421with 8-bit user id's, 2422single character tty id's, 2423etc. 2424If not set, 2425a version 7 system is assumed. 2426.ip DBM 2427If set, 2428the 2429.q DBM 2430package in UNIX is used 2431(see DBM(3X) in [UNIX80]). 2432If not set, 2433a much less efficient algorithm for processing aliases is used. 2434.ip VFORK 2435Set if your system has the experimental 2436.i vfork 2437system call. 2438See vfork(2) in [UNIX80]. 2439If not set, 2440the regular 2441.i fork 2442system call is used. 2443This option improves performance. 2444.ip DEBUG 2445If set, debugging information is compiled in. 2446To actually get the debugging output, 2447the 2448.b \-d 2449flag must be used. 2450.ip LOG 2451If set, 2452the 2453.i syslog 2454routine in use at some Berkeley sites is used. 2455This logs an informational log record 2456for each message processed, 2457and logs a higher priority log record 2458for internal system errors. 2459.ip NEWFTP 2460If set, the ARPANET reply codes for 2461.q "Revised New FTP" 2462are used 2463[Postel74]. 2464If not set, 2465reply codes for the old, unrevised 2466.q "New FTP" 2467are used 2468[Neigus73]. 2469If you want to use reply codes for the Mail Transfer Protocol 2470[Sluizer81] 2471you may find it necessary to make some code modifications. 2472.ip PARANOID 2473There are places where 2474.i sendmail 2475may opt for a more secure, 2476but probably less convenient environment. 2477For example, 2478if this flag is set 2479it is not possible to specify a program as an address directly; 2480this can only be done with an alias. 2481.ip NOTUNIX 2482If you are using a non-UNIX mail format, 2483you can set this flag to turn off special processing 2484of UNIX-style 2485.q "From " 2486lines. 2487.nr ii 5n 2488.pp 2489If you want to enable special processing of other headers, 2490you will have to add them to the 2491.i HdrInfo 2492table in 2493.i conf.c . 2494This table contains the header name 2495(which should be in all lower case), 2496a set of header control flags (described below), 2497and a set of mailer flags, 2498used by some of the header flags. 2499The header flags are: 2500.nr ii \w'H_ACHECK 'u 2501.ip H_CHECK 2502Check the flags for the receiving mailer 2503against the third field in the 2504.i HdrInfo 2505entry. 2506If the mailer has any of those bits set, 2507send this field; 2508otherwise, do not send this field to that mailer. 2509If the field was in the message originally, however, 2510it will always be sent 2511(i.e., this only applies to headers being added by 2512.i sendmail ). 2513.ip H_ACHECK 2514Same as H_CHECK, 2515except that it even applies to headers that were in the 2516original message. 2517That is, 2518if this bit is set and the mailer does not have flag bits set 2519that intersect with the third field in this 2520.i HdrInfo 2521entry, 2522the header line is 2523.i always 2524deleted. 2525.ip H_EOH 2526If this header field is set, 2527treat it like a blank line, 2528i.e., 2529it will signal the end of the header 2530and the beginning of the message text. 2531.ip H_FORCE 2532Add this header entry 2533even if one existed in the message before. 2534If a header entry does not have this bit set, 2535.i sendmail 2536will not add another header line if a header line 2537of this name already existed. 2538This would normally be used to stamp the message 2539by everyone who handled it. 2540.ip H_ADDR 2541If set, 2542this field contains recipient addresses. 2543This is used by the 2544.b \-t 2545flag to determine who to send to 2546when it is collecting recipients from the message. 2547.nr ii 5n 2548.lp 2549Let's look at a sample 2550.i HdrInfo 2551specification: 2552.(b 2553.sz -2 2554.ta 4n +\w'"received-from", 'u +\w'H_ADDR|H_ACHECK, 'u 2555struct hdrinfo HdrInfo[] = 2556{ 2557 "date", H_CHECK, M_NEEDDATE, 2558 "from", H_CHECK, M_NEEDFROM, 2559 "original-from", H_ACHECK, 0, 2560 "sender", 0, 0, 2561 "full-name", H_ACHECK, M_FULLNAME, 2562 "to", H_ADDR, 0, 2563 "cc", H_ADDR, 0, 2564 "bcc", H_ADDR|H_ACHECK, 0, 2565 "message-id", H_CHECK, M_MSGID, 2566 "message", H_EOH, 0, 2567 "text", H_EOH, 0, 2568 "received-date", H_CHECK, M_LOCAL, 2569 "received-from", H_CHECK, M_LOCAL, 2570 "via", H_FORCE, 0, 2571 NULL, 0, 0, 2572}; 2573.sz 2574.)b 2575This specification says that the 2576.q Date: , 2577.q From: , 2578.q Message-Id: , 2579.q Received-Date: , 2580and 2581.q Received-From: 2582must be requested by the mailer to be inserted. 2583However, 2584if they were in the message as received by 2585.i sendmail 2586they will be propagated. 2587The 2588.q Full-Name: 2589field, on the other hand, 2590will be deleted even if it was specified before, 2591unless the mailer wants it. 2592The 2593.q Original-From: 2594and 2595.q Bcc: 2596fields will be deleted unconditionally 2597(since it is never possible for a mailer's flags 2598to intersect with zero). 2599The 2600.q Original-From: 2601is in fact used internally, 2602and will be reinserted by ad hoc code, 2603but only if it differs from the 2604.q From: 2605line that would otherwise be inserted. 2606.q To: , 2607.q Cc: , 2608and 2609.q Bcc: 2610all specify recipient addresses. 2611The 2612.q Message: 2613and 2614.q Text: 2615fields will terminate the header; 2616these are specified in new protocols 2617[NBS80] 2618or used by random dissenters around the network world. 2619The 2620.q Via: 2621field will always be added, 2622and can be used to trace messages. 2623The 2624.q Sender: 2625field is used internally, 2626although no cliched special processing occurs. 2627.pp 2628There are a number of important points here. 2629First, 2630header fields are not added automatically just because they are in the 2631.i HdrInfo 2632structure; 2633they must be specified in the configuration file 2634in order to be added to the message. 2635Any header fields mentioned in the configuration file but not 2636mentioned in the 2637.i HdrInfo 2638structure have default processing performed; 2639that is, 2640they are added unless they were in the message already. 2641Second, 2642the 2643.i HdrInfo 2644structure only specifies cliched processing; 2645certain headers are processed specially by ad hoc code 2646regardless of the status specified in 2647.i HdrInfo . 2648For example, 2649the 2650.q Sender: 2651and 2652.q From: 2653fields are always scanned on ARPANET mail 2654to determine the sender; 2655this is used to perform the 2656.q "return to sender" 2657function. 2658The 2659.q "From:" 2660and 2661.q "Full-Name:" 2662fields are used to determine the full name of the sender 2663if possible; 2664this is stored in the macro 2665.b $x 2666and used in a number of ways. 2667Although the 2668.q "Original-From:" 2669field is specified to be deleted in 2670.i HdrInfo , 2671it is added automatically if the 2672.q From: 2673field that would be generated internally 2674differs from the 2675.q From: 2676field that was specified in the message; 2677in this case, 2678the original 2679.q From: 2680field is renamed 2681.q Original-From: . 2682.pp 2683The file 2684.i conf.c 2685also contains the specification of ARPANET reply codes. 2686There are six classifications these fall into: 2687.(b 2688.sz -2 2689.ta \w'char 'u +\w'Arpa_Usrerr[] = 'u +\w'"888"; 'u 2690char Arpa_Info[] = "050"; /* arbitrary info */ 2691char Arpa_Enter[] = "350"; /* start mail input */ 2692char Arpa_Mmsg[] = "256"; /* mail successful (MAIL cmd) */ 2693char Arpa_Fmsg[] = "250"; /* mail successful (MLFL cmd) */ 2694char Arpa_Syserr[] = "455"; /* some (transient) system error */ 2695char Arpa_Usrerr[] = "450"; /* some (fatal) user error */ 2696.sz 2697.)b 2698The class 2699.i Arpa_Info 2700is for any information that is not required by the protocol, 2701such as forwarding information. 2702.i Arpa_Enter 2703is output when 2704.i sendmail 2705wants to start receiving the mail. 2706.i Arpa_Mmsg 2707and 2708.i Arpa_Fmsg 2709are given if the mail is successfully delivered; 2710the selection of message number depends on the FTP command given 2711(which is communicated via the 2712.b \-a 2713flag). 2714.i Arpa_Syserr 2715is printed by the 2716.i syserr 2717routine; 2718typically, this occurs when something has gone wrong at the 2719receiving site, 2720with the assumption that it is a transient condition. 2721Finally, 2722.i Arpa_Usrerr 2723is the result of a user error 2724and is generated by the 2725.i usrerr 2726routine; 2727these are generated when the user has specified something wrong, 2728and hence the error is permanent, 2729i.e., 2730it will not work simply by resubmitting the request. 2731.pp 2732If it is necessary to restrict mail through a gateway, 2733the 2734.i checkcompat 2735routine can be modified. 2736This routine is called for every recipient address. 2737It can return 2738.b TRUE 2739to indicate that the address is acceptable 2740and mail processing will continue, 2741or it can return 2742.b FALSE 2743to reject the recipient. 2744If it returns false, 2745it is up to 2746.i checkcompat 2747to print an error message 2748(using 2749.i usrerr ) 2750saying why the message is rejected. 2751For example, 2752.i checkcompat 2753could read: 2754.(b 2755.re 2756.sz -2 2757bool 2758checkcompat(to) 2759 register ADDRESS *to; 2760{ 2761 if (MsgSize > 50000 && to->q_mailer != MN_LOCAL) 2762 { 2763 usrerr("Message too large for non-local delivery"); 2764 return (FALSE); 2765 } 2766 return (TRUE); 2767} 2768.sz 2769.)b 2770This would reject messages greater than 50000 bytes 2771unless they were local. 2772The actual use of this routine is highly dependent on the 2773implementation, 2774and use should be limited. 2775