SENDMAIL—AnInternetworkMailRouter EricAllman† Britton-Lee,Inc. 1919AddisonStreet,Suite105. Berkeley,California94704. ABSTRACT Routingmailthroughaheterogenousinternetpresentsmanynewproblems. Amongtheworstoftheseisthatofaddressmapping.Historically,thishas beenhandledonanadhocbasis.However,thisapproachhasbecomeunmanageableasinternetsgrow. Sendmailactsaunified"postoffice"towhichallmailcanbesubmitted.Addressinterpretationiscontrolledbyaproductionsystem,whichcanparseboth domain-basedaddressingandold-styleadhocaddresses.Theproductionsys-temispowerfulenoughtorewriteaddressesinthemessageheadertoconform tothestandardsofanumberofcommontargetnetworks,includingold (NCP/RFC733)Arpanet,new(TCP/RFC822)Arpanet,UUCP,andPhonenet. SendmailalsoimplementsanSMTPserver,messagequeueing,andaliasing. Sendmailimplementsageneralinternetworkmailroutingfacility,featuringaliasingandforwarding,automaticroutingtonetworkgateways,andflexibleconfiguration. Inasimplenetwork,eachnodehasanaddress,andresourcescanbeidentifiedwithahostresourcepair;inparticular,themailsystemcanrefertousersusingahost-usernamepair.Host namesandnumbershavetobeadministeredbyacentralauthority,butusernamescanbe assignedlocallytoeachhost. Inaninternet,multiplenetworkswithdifferentcharactersticsandmanagementsmustcommunicate.Inparticular,thesyntaxandsemanticsofresourceidentificationchange.Certainspecialcasescanbehandledtriviallybyadhoctechniques,suchasprovidingnetworknamesthat appearlocaltohostsonothernetworks,aswiththeEthernetatXeroxPARC.However,the generalcaseisextremelycomplex.Forexample,somenetworksrequirepoint-to-pointrouting, whichsimplifiesthedatabaseupdateproblemsinceonlyadjacenthostsmustbeenteredintothe systemtables,whileothersuseend-to-endaddressing.Somenetworksusealeft-associativesyn-taxandothersusearight-associativesyntax,causingambiguityinmixedaddresses. Internetstandardsseektoeliminatetheseproblems.Initially,theseproposedexpandingthe addresspairstoaddresstriples,consistingof{network,host,resource}triples.Networknumbers mustbeuniversallyagreedupon,andhostscanbeassignedlocallyoneachnetwork.Theuserlevelpresentationwasquicklyexpandedtoaddressdomains,comprisedofalocalresourceidentificationandahierarchicaldomainspecificationwithacommonstaticroot.Thedomaintechnique separatestheissueofphysicalversuslogicaladdressing.Forexample,anaddressoftheform †AconsiderablepartofthisworkwasdonewhileundertheemployoftheINGRESProjectattheUniversityofCaliforniaatBerkeley. SENDMAIL 1 SENDMAIL 2 “eric@a.cc.berkeley.arpa”describesonlythelogicalorganizationoftheaddressspace. Sendmailisintendedtohelpbridgethegapbetweenthetotallyadhocworldofnetworks thatknownothingofeachotherandtheclean,tightly-coupledworldofuniquenetworknumbers. Itcanacceptoldarbitraryaddresssyntaxes,resolvingambiguitiesusingheuristicsspecifiedbythe systemadministrator,aswellasdomain-basedaddressing.Ithelpsguidetheconversionofmes-sageformatsbetweendisparatenetworks.Inshort,sendmailisdesignedtoassistagracefultran-sitiontoconsistentinternetworkaddressingschemes. Section1discussesthedesigngoalsforsendmail.Section2givesanoverviewofthebasic functionsofthesystem.Insection3,detailsofusagearediscussed.Section4comparessendmail tootherinternetmailrouters,andanevaluationofsendmailisgiveninsection5,includingfuture plans. 1.DESIGNGOALS Designgoalsforsendmailinclude: (1)Compatibilitywiththeexistingmailprograms,includingBellversion6mail,Bellversion7mail[UNIX83],BerkeleyMail[Shoens79],BerkNetmail[Schmidt79],andhopefullyUUCPmail[Nowitz78a,Nowitz78b].ARPANETmail[Crocker77a,Postel77]was alsorequired. (2)Reliability,inthesenseofguaranteeingthateverymessageiscorrectlydeliveredorat leastbroughttotheattentionofahumanforcorrectdisposal;nomessageshouldever becompletelylost.Thisgoalwasconsideredessentialbecauseoftheemphasisonmail inourenvironment.Ithasturnedouttobeoneofthehardestgoalstosatisfy,especiallyinthefaceofthemanyanomalousmessageformatsproducedbyvarious ARPANETsites.Forexample,certainsitesgenerateimproperlyformatedaddresses, occasionallycausingerror-messageloops.Somehostsuseblanksinnames,causing problemswithUNIXmailprogramsthatassumethatanaddressisoneword.The semanticsofsomefieldsareinterpretedslightlydifferentlybydifferentsites.Insummary,theobscurefeaturesoftheARPANETmailprotocolreallyareusedandaredifficulttosupport,butmustbesupported. (3)Existingsoftwaretodoactualdeliveryshouldbeusedwheneverpossible.Thisgoal derivesasmuchfrompoliticalandpracticalconsiderationsastechnical. (4)Easyexpansiontofairlycomplexenvironments,includingmultipleconnectionstoasinglenetworktype(suchaswithmultipleUUCPorEthernets[Metcalfe76]).Thisgoal requiresconsiderationofthecontentsofanaddressaswellasitssyntaxinorderto determinewhichgatewaytouse.Forexample,theARPANETisbringinguptheTCP protocoltoreplacetheoldNCPprotocol.NohostatBerkeleyrunsbothTCPand NCP,soitisnecessarytolookattheARPANEThostnametodeterminewhetherto routemailtoanNCPgatewayoraTCPgateway. (5)Configurationshouldnotbecompiledintothecode.Asinglecompiledprogramshould beabletorunasisatanysite(barringsuchbasicchangesastheCPUtypeorthe operatingsystem).Wehavefoundthisseeminglyunimportantgoaltobecriticalin reallife.Besidesthesimpleproblemsthatoccurwhenanyprogramgetsrecompiledin adifferentenvironment,manysitesliketo“fiddle”withanythingthattheywillbe recompilinganyway. (6)Sendmailmustbeabletoletvariousgroupsmaintaintheirownmailinglists,andlet individualsspecifytheirownforwarding,withoutmodifyingthesystemaliasfile. (7)Eachusershouldbeabletospecifywhichmailertoexecutetoprocessmailbeingdeliveredforhim.Thisfeatureallowsuserswhoareusingspecializedmailersthatuseadifferentformattobuildtheirenvironmentwithoutchangingthesystem,andfacilitates Version4.1 DRAFTLastMod7/25/83 SENDMAIL 3 specializedfunctions(suchasreturningan“Iamonvacation”message). (8)Networktrafficshouldbeminimizedbybatchingaddressestoasinglehostwherepossible,withoutassistancefromtheuser. Thesegoalsmotivatedthearchitectureillustratedinfigure1.Theuserinteractswitha mailgeneratingandsendingprogram.Whenthemailiscreated,thegeneratorcallssendmail, whichroutesthemessagetothecorrectmailer(s).Sincesomeofthesendersmaybenetwork serversandsomeofthemailersmaybenetworkclients,sendmailmaybeusedasaninternet mailgateway. 2.OVERVIEW 2.1.SystemOrganization Sendmailneitherinterfaceswiththeusernordoesactualmaildelivery.Rather,it collectsamessagegeneratedbyauserinterfaceprogram(UIP)suchasBerkeleyMail,MS [Crocker77b],orMH[Borden79],editsthemessageasrequiredbythedestinationnetwork, andcallsappropriatemailerstodomaildeliveryorqueueingfornetworktransmission1. Thisdisciplineallowstheinsertionofnewmailersatminimumcost.Inthissensesendmail resemblestheMessageProcessingModule(MPM)of[Postel79b]. Figure1—SendmailSystemStructure. 1exceptwhenmailingtoafile,whensendmaildoesthedeliverydirectly. Version4.1 DRAFTLastMod7/25/83 SENDMAIL 4 2.2.InterfacestotheOutsideWorld Therearethreewayssendmailcancommunicatewiththeoutsideworld,bothin receivingandinsendingmail.TheseareusingtheconventionalUNIXargumentvector/returnstatus,speakingSMTPoverapairofUNIXpipes,andspeakingSMTPoveran interprocess(or)channel. 2.2.1.Argumentvector/exitstatus ThistechniqueisthestandardUNIXmethodforcommunicatingwiththeprocess. Alistofrecipientsissentintheargumentvector,andthemessagebodyissentonthe standardinput.Anythingthatthemailerprintsissimplycollectedandsentbackto thesenderiftherewereanyproblems.Theexitstatusfromthemaileriscollectedafter themessageissent,andadiagnosticisprintedifappropriate. 2.2.2.SMTPoverpipes TheSMTPprotocol[Postel82]canbeusedtorunaninteractivelock-stepinter-facewiththemailer.Asubprocessisstillcreated,butnorecipientaddressesarepassed tothemailerviatheargumentlist.Instead,theyarepassedoneatatimeincommandssenttotheprocessesstandardinput.Anythingappearingonthestandardoutputmustbeareplycodeinaspecialformat. 2.2.3.SMTPoveranIPCconnection Thistechniqueissimilartotheprevioustechnique,exceptthatitusesa4.2BSD IPCchannel[UNIX83].Thismethodisexceptionallyflexibleinthatthemailerneed notresideonthesamemachine.Itisnormallyusedtoconnecttoasendmailprocess onanothermachine. 2.3.OperationalDescription Whenasenderwantstosendamessage,itissuesarequesttosendmailusingoneof thethreemethodsdescribedabove.Sendmailoperatesintwodistinctphases.Inthefirst phase,itcollectsandstoresthemessage.Inthesecondphase,messagedeliveryoccurs.If therewereerrorsduringprocessingduringthesecondphase,sendmailcreatesandreturnsa newmessagedescribingtheerrorand/orreturnsanstatuscodetellingwhatwentwrong. 2.3.1.Argumentprocessingandaddressparsing Ifsendmailiscalledusingoneofthetwosubprocesstechniques,theargumentsare firstscannedandoptionspecificationsareprocessed.Recipientaddressesarethencollected,eitherfromthecommandlineorfromtheSMTPRCPTcommand,andalistof recipientsiscreated.Aliasesareexpandedatthisstep,includingmailinglists.As muchvalidationaspossibleoftheaddressesisdoneatthisstep:syntaxischecked,and localaddressesareverified,butdetailedcheckingofhostnamesandaddressesis deferreduntildelivery.Forwardingisalsoperformedasthelocaladdressesareverified. Sendmailappendseachaddresstotherecipientlistafterparsing.Whenaname isaliasedorforwarded,theoldnameisretainedinthelist,andaflagissetthattells thedeliveryphasetoignorethisrecipient.Thislistiskeptfreefromduplicates,preventingaliasloopsandduplicatemessagesdeliverdtothesamerecipient,asmight occurifapersonisintwogroups. 2.3.2.Messagecollection Sendmailthencollectsthemessage.Themessageshouldhaveaheaderatthe beginning.Noformattingrequirementsareimposedonthemessageexceptthatthey Version4.1 DRAFTLastMod7/25/83 SENDMAIL 5 mustbelinesoftext(i.e.,binarydataisnotallowed).Theheaderisparsedandstored inmemory,andthebodyofthemessageissavedinatemporaryfile. Tosimplifytheprograminterface,themessageiscollectedevenifnoaddresses werevalid.Themessagewillbereturnedwithanerror. 2.3.3.Messagedelivery Foreachuniquemailerandhostintherecipientlist,sendmailcallstheappropriatemailer.Eachmailerinvocationsendstoallusersreceivingthemessageononehost. Mailersthatonlyacceptonerecipientatatimearehandledproperly. Themessageissenttothemailerusingoneofthesamethreeinterfacesusedto submitamessagetosendmail.Eachcopyofthemessageisprependedbyacustomized header.Themailerstatuscodeiscaughtandchecked,andasuitableerrormessage givenasappropriate.Theexitcodemustconformtoasystemstandardorageneric message(“Serviceunavailable”)isgiven. 2.3.4.Queueingforretransmission Ifthemailerreturnedanstatusthatindicatedthatitmightbeabletohandlethe maillater,sendmailwillqueuethemailandtryagainlater. 2.3.5.Returntosender Iferrorsoccurduringprocessing,sendmailreturnsthemessagetothesenderfor retransmission.Thelettercanbemailedbackorwritteninthefile“dead.letter”inthe sender’shomedirectory2. 2.4.MessageHeaderEditing Certaineditingofthemessageheaderoccursautomatically.Headerlinescanbe insertedundercontroloftheconfigurationfile.Somelinescanbemerged;forexample,a “From:”lineanda“Full-name:”linecanbemergedundercertaincircumstances. 2.5.ConfigurationFile AlmostallconfigurationinformationisreadatruntimefromanASCIIfile,encoding macrodefinitions(definingthevalueofmacrosusedinternally),headerdeclarations(telling sendmailtheformatofheaderlinesthatitwillprocessspecially,i.e.,linesthatitwilladd orreformat),mailerdefinitions(givinginformationsuchasthelocationandcharacteristics ofeachmailer),andaddressrewritingrules(alimitedproductionsystemtorewrite addresseswhichisusedtoparseandrewritetheaddresses). Toimproveperformancewhenreadingtheconfigurationfile,amemoryimagecanbe provided.Thisprovidesa“compiled”formoftheconfigurationfile. 3.USAGEANDIMPLEMENTATION 3.1.Arguments Argumentsmaybeflagsandaddresses.Flagssetvariousprocessingoptions.Followingflagarguments,addressargumentsmaybegiven,unlesswearerunninginSMTP 2Obviously,ifthesitegivingtheerrorisnottheoriginatingsite,theonlyreasonableoptionistomailbacktothe sender.Also,therearemanymoreerrordispositionoptions,buttheyonlyeffecttheerrormessage—the“returnto sender”functionisalwayshandledinoneofthesetwoways. Version4.1 DRAFTLastMod7/25/83 SENDMAIL 6 mode.AddressesfollowthesyntaxinRFC822[Crocker82]forARPANETaddressformats. Inbrief,theformatis: (1)Anythinginparenthesesisthrownaway(asacomment). (2)Anythinginanglebrackets(“<>”)ispreferredoveranythingelse.ThisruleimplementstheARPANETstandardthataddressesoftheform username<machine-address> willsendtotheelectronic“machine-address”ratherthanthehuman“username.” (3)Doublequotes(")quotephrases;backslashesquotecharacters.Backslashesare morepowerfulinthattheywillcauseotherwiseequivalentphrasestocomparedifferently—forexample,userand"user"areequivalent,but\userisdifferentfrom eitherofthem. Parentheses,anglebrackets,anddoublequotesmustbeproperlybalancedand nested.Therewritingrulescontrolremainingparsing3. 3.2.MailtoFilesandPrograms Filesandprogramsarelegitimatemessagerecipients.Filesprovidearchivalstorage ofmessages,usefulforprojectadministrationandhistory.Programsareusefulasrecipientsinavarietyofsituations,forexample,tomaintainapublicrepositoryofsystemsmessages(suchastheBerkeleymsgsprogram,ortheMARSsystem[Sattley78]). Anyaddresspassingthroughtheinitialparsingalgorithmasalocaladdress(i.e,not appearingtobeavalidaddressforanothermailer)isscannedfortwospecialcases.Ifprefixedbyaverticalbar(“|”)therestoftheaddressisprocessedasashellcommand.Ifthe usernamebeginswithaslashmark(“/”)thenameisusedasafilename,insteadofa loginname. Filesthathavesetuidorsetgidbitssetbutnoexecutebitssethavethosebitshonoredifsendmailisrunningasroot. 3.3.Aliasing,Forwarding,Inclusion Sendmailreroutesmailthreeways.Aliasingappliessystemwide.Forwardingallows eachusertorerouteincomingmaildestinedforthataccount.Inclusiondirectssendmailto readafileforalistofaddresses,andisnormallyusedinconjunctionwithaliasing. 3.3.1.Aliasing Aliasingmapsnamestoaddresslistsusingasystem-widefile.Thisfileisindexed tospeedaccess.Onlynamesthatparseaslocalareallowedasaliases;thisguaranteesa uniquekey(sincetherearenonicknamesforthelocalhost). 3.3.2.Forwarding Afteraliasing,recipientsthatarelocalandvalidarecheckedfortheexistenceofa “.forward”fileintheirhomedirectory.Ifitexists,themessageisnotsenttothatuser, butrathertothelistofusersinthatfile.Oftenthislistwillcontainonlyoneaddress, andthefeaturewillbeusedfornetworkmailforwarding. Forwardingalsopermitsausertospecifyaprivateincomingmailer.Forexample, forwardingto: 3Disclaimer:Somespecialprocessingisdoneafterrewritinglocalnames;seebelow. Version4.1 DRAFTLastMod7/25/83 SENDMAIL 7 "|/usr/local/newmailmyname" willuseadifferentincomingmailer. 3.3.3.Inclusion InclusionisspecifiedinRFC733[Crocker77a]syntax: :Include:pathname Anaddressofthisformreadsthefilespecifiedbypathnameandsendstoalluserslisted inthatfile. Theintentisnottosupportdirectuseofthisfeature,butrathertousethisasa subsetofaliasing.Forexample,analiasoftheform: project::include:/usr/project/userlist isamethodoflettingaprojectmaintainamailinglistwithoutinteractionwiththesystemadministration,evenifthealiasfileisprotected. Itisnotnecessarytorebuildtheindexonthealiasdatabasewhena:include:list ischanged. 3.4.MessageCollection Onceallrecipientaddressesareparsedandverified,themessageiscollected.The messagecomesintwoparts:amessageheaderandamessagebody,separatedbyablank line. Theheaderisformattedasaseriesoflinesoftheform field-name:field-value Field-valuecanbesplitacrosslinesbystartingthefollowinglineswithaspaceoratab. Someheaderfieldshavespecialinternalmeaning,andhaveappropriatespecialprocessing. Otherheadersaresimplypassedthrough.Someheaderfieldsmaybeaddedautomatically, suchastimestamps. Thebodyisaseriesoftextlines.Itiscompletelyuninterpretedanduntouched, exceptthatlinesbeginningwithadothavethedotdoubledwhentransmittedoveran SMTPchannel.Thisextradotisstrippedbythereceiver. 3.5.MessageDelivery Thesendqueueisorderedbyreceivinghostbeforetransmissiontoimplementmessagebatching.Eachaddressismarkedasitissentsorescanningthelistissafe.Anargumentlistisbuiltasthescanproceeds.Mailtofilesisdetectedduringthescanofthesend list.Theinterfacetothemailerisperformedusingoneofthetechniquesdescribedinsection2.2. Afteraconnectionisestablished,sendmailmakestheper-mailerchangestothe headerandsendstheresulttothemailer.Ifanymailisrejectedbythemailer,aflagisset toinvokethereturn-to-senderfunctionafteralldeliverycompletes. 3.6.QueuedMessages Ifthemailerreturnsa“temporaryfailure”exitstatus,themessageisqueued.Acontrolfileisusedtodescribetherecipientstobesenttoandvariousotherparameters.This controlfileisformattedasaseriesoflines,eachdescribingasender,arecipient,thetimeof submission,orsomeothersalientparameterofthemessage.Theheaderofthemessageis storedinthecontrolfile,sothattheassociateddatafileinthequeueisjustthetemporary filethatwasoriginallycollected. Version4.1 DRAFTLastMod7/25/83 SENDMAIL 8 3.7.Configuration Configurationiscontrolledprimarilybyaconfigurationfilereadatstartup.Sendmail shouldnotneedtoberecompliedexcept (1)Tochangeoperatingsystems(V6,V7/32V,4BSD). (2)ToremoveorinserttheDBM(UNIXdatabase)library. (3)TochangeARPANETreplycodes. (4)Toaddheadersfieldsrequiringspecialprocessing. Addingmailersorchangingparsing(i.e.,rewriting)orroutinginformationdoesnotrequire recompilation. Ifthemailisbeingsentbyalocaluser,andthefile“.mailcf”existsinthesender’s homedirectory,thatfileisreadasaconfigurationfileafterthesystemconfigurationfile. Theprimaryuseofthisfeatureistoaddheaderlines. Theconfigurationfileencodesmacrodefinitions,headerdefinitions,mailerdefinitions, rewritingrules,andoptions. 3.7.1.Macros Macroscanbeusedinthreeways.Certainmacrostransmitunstructuredtextual informationintothemailsystem,suchasthenamesendmailwillusetoidentifyitselfin errormessages.Othermacrostransmitinformationfromsendmailtotheconfiguration fileforuseincreatingotherfields(suchasargumentvectorstomailers);e.g.,thename ofthesender,andthehostanduseroftherecipient.Othermacrosareunusedinternally,andcanbeusedasshorthandintheconfigurationfile. 3.7.2.Headerdeclarations Headerdeclarationsinformsendmailoftheformatofknownheaderlines.Knowledgeofafewheaderlinesisbuiltintosendmail,suchasthe“From:”and“Date:”lines. Mostconfiguredheaderswillbeautomaticallyinsertedintheoutgoingmessageif theydon’texistintheincomingmessage.Certainheadersaresuppressedbysome mailers. 3.7.3.Mailerdeclarations Mailerdeclarationstellsendmailofthevariousmailersavailabletoit.Thedefinitionspecifiestheinternalnameofthemailer,thepathnameoftheprogramtocall, someflagsassociatedwiththemailer,andanargumentvectortobeusedonthecall; thisvectorismacro-expandedbeforeuse. 3.7.4.Addressrewritingrules Theheartofaddressparsinginsendmailisasetofrewritingrules.Thesearean orderedlistofpattern-replacementrules,(somewhatlikeaproductionsystem,except thatorderiscritical),whichareappliedtoeachaddress.Theaddressisrewrittentextuallyuntilitiseitherrewrittenintoaspecialcanonicalform(i.e.,a(mailer,host,user) 3-tuple,suchas{arpanet,usc-isif,postel}representingtheaddress“postel@usc-isif”),or itfallsofftheend.Whenapatternmatches,theruleisreapplieduntilitfails. Theconfigurationfilealsosupportstheeditingofaddressesintodifferentformats. Forexample,anaddressoftheform: ucsfcgl!tef mightbemappedinto: Version4.1 DRAFTLastMod7/25/83 SENDMAIL 9 tef@ucsfcgl.UUCP toconformtothedomainsyntax.Translationscanalsobedoneintheotherdirection. 3.7.5.Optionsetting Thereareseveraloptionsthatcanbesetfromtheconfigurationfile.These includethepathnamesofvarioussupportfiles,timeouts,defaultmodes,etc. 4.COMPARISONWITHOTHERMAILERS 4.1.Delivermail Sendmailisanoutgrowthofdelivermail.Theprimarydifferencesare: (1)Configurationinformationisnotcompiledin.Thischangesimplifiesmanyofthe problemsofmovingtoothermachines.Italsoallowseasydebuggingofnewmailers. (2)Addressparsingismoreflexible.Forexample,delivermailonlysupportedonegatewaytoanynetwork,whereassendmailcanbesensitivetohostnamesandreroute todifferentgateways. (3)Forwardingand:include:featureseliminatetherequirementthatthesystemalias filebewritablebyanyuser(orthatanupdateprogrambewritten,orthatthesystemadministrationmakeallchanges). (4)Sendmailsupportsmessagebatchingacrossnetworkswhenamessageisbeingsent tomultiplerecipients. (5)Amailqueueisprovidedinsendmail.Mailthatcannotbedeliveredimmediately butcanpotentiallybedeliveredlaterisstoredinthisqueueforalaterretry.The queuealsoprovidesabufferagainstsystemcrashes;afterthemessagehasbeencollecteditmaybereliablyredeliveredevenifthesystemcrashesduringtheinitial delivery. (6)Sendmailusesthenetworkingsupportprovidedby4.2BSDtoprovideadirectinterfacenetworkssuchastheARPANETand/orEthernetusingSMTP(theSimple MailTransferProtocol)overaTCP/IPconnection. 4.2.MMDF MMDF[Crocker79]spansawiderproblemsetthansendmail.Forexample,the domainofMMDFincludesa“phonenetwork”mailer,whereassendmailcallsonpreexistingmailersinmostcases. MMDFandsendmailbothsupportaliasing,customizedmailers,messagebatching, automaticforwardingtogateways,queueing,andretransmission.MMDFsupportstwostagetimeout,whichsendmaildoesnotsupport. TheconfigurationforMMDFiscompiledintothecode4. SinceMMDFdoesnotconsiderbackwardscompatibilityasadesigngoal,theaddress parsingissimplerbutmuchlessflexible. Itissomewhathardertointegrateanewchannel5intoMMDF.Inparticular, 4DynamicconfigurationtablesarecurrentlybeingconsideredforMMDF;allowingtheinstallertoselecteithercompiledordynamictables. 5TheMMDFequivalentofasendmail“mailer.” Version4.1 DRAFTLastMod7/25/83 SENDMAIL 10 MMDFmustknowthelocationandformatofhosttablesforallchannels,andthechannel mustspeakaspecialprotocol.ThisallowsMMDFtodoadditionalverification(suchas verifyinghostnames)atsubmissiontime. MMDFstrictlyseparatesthesubmissionanddeliveryphases.Althoughsendmailhas theconceptofeachofthesestages,theyareintegratedintooneprogram,whereasin MMDFtheyaresplitintotwoprograms. 4.3.MessageProcessingModule TheMessageProcessingModule(MPM)discussedbyPostel[Postel79b]matches sendmailcloselyintermsofitsbasicarchitecture.However,likeMMDF,theMPM includesthenetworkinterfacesoftwareaspartofitsdomain. MPMalsopostulatesaduplexchanneltothereceiver,asdoesMMDF,thusallowing simplerhandlingoferrorsbythemailerthanispossibleinsendmail.Whenamessage queuedbysendmailissent,anyerrorsmustbereturnedtothesenderbythemaileritself. BothMPMandMMDFmailerscanreturnanimmediateerrorresponse,andasingleerror processorcancreateanappropriateresponse. MPMpreferspassingthemessageasastructuredobject,withtype-length-value tuples6.Suchaconventionrequiresamuchhigherdegreeofcooperationbetweenmailers thanisrequiredbysendmail.MPMalsoassumesauniversallyagreeduponinternetname space(witheachaddressintheformofanet-host-usertuple),whichsendmaildoesnot. 5.EVALUATIONSANDFUTUREPLANS Sendmailisdesignedtoworkinanonhomogeneousenvironment.Everyattemptismade toavoidimposingunnecessaryconstraintsontheunderlyingmailers.Thisgoalhasdriven muchofthedesign.Oneofthemajorproblemshasbeenthelackofauniformaddressspace, aspostulatedin[Postel79a]and[Postel79b]. Anonuniformaddressspaceimpliesthatapathwillbespecifiedinalladdresses,either explicitly(aspartoftheaddress)orimplicitly(aswithimpliedforwardingtogateways).This restrictionhastheunpleasanteffectofmakingreplyingtomessagesexceedinglydifficult,since thereisnoone“address”foranyperson,butonlyawaytogettherefromwhereveryouare. Interfacingtomailprogramsthatwerenotinitiallyintendedtobeappliedinaninternet environmenthasbeenamazinglysuccessful,andhasreducedthejobtoamanageabletask. Sendmailhasknowledgeofafewdifficultenvironmentsbuiltin.ItgeneratesARPANET FTP/SMTPcompatibleerrormessages(prependedwiththree-digitnumbers[Neigus73,Pos-tel74,Postel82])asnecessary,optionallygeneratesUNIX-style“From”linesonthefrontof messagesforsomemailers,andknowshowtoparsethesamelinesoninput.Also,errorhandlinghasanoptioncustomizedforBerkNet. Thedecisiontoavoiddoinganytypeofdeliverywherepossible(even,orperhapsespecially,localdelivery)hasturnedouttobeagoodidea.Evenwithlocaldelivery,thereare issuesofthelocationofthemailbox,theformatofthemailbox,thelockingprotocolused,etc., thatarebestdecidedbyotherprograms.Onesurprisinglymajorannoyanceinmanyinternet mailersisthatthelocationandformatoflocalmailisbuiltin.Thefeelingseemstobethat localmailissocommonthatitshouldbeefficient.Thisfeelingisnotbornoutbyourexperience;onthecontrary,thelocationandformatofmailboxesseemstovarywidelyfromsystem tosystem. 6ThisissimilartotheNBSstandard. Version4.1 DRAFTLastMod7/25/83 SENDMAIL 11 Theabilitytoautomaticallygeneratearesponsetoincomingmail(byforwardingmailto aprogram)seemsuseful(“IamonvacationuntillateAugust....”)butcancreateproblems suchasforwardingloops(twopeopleonvacationwhoseprogramssendnotesbackandforth, forinstance)iftheseprogramsarenotwellwritten.Aprogramcouldbewrittentodostandardtaskscorrectly,butthiswouldsolvethegeneralcase. Itmightbedesirabletoimplementsomeformofloadlimiting.Iamunawareofany mailsystemthataddressesthisproblem,noramIawareofanyreasonablesolutionatthis time. Theconfigurationfileiscurrentlypracticallyinscrutable;considerableconveniencecould berealizedwithahigher-levelformat. Itseemsclearthatcommonprotocolswillbechangingsoontoaccommodatechanging requirementsandenvironments.Thesechangeswillincludemodificationstothemessage header(e.g.,[NBS80])ortothebodyofthemessageitself(suchasformultimediamessages [Postel80]).Experienceindicatesthatthesechangesshouldberelativelytrivialtointegrate intotheexistingsystem. Intightlycoupledenvironments,itwouldbenicetohaveanameserversuchasGrapvine [Birrell82]integratedintothemailsystem.Thiswouldallowasitesuchas“Berkeley”to appearasasinglehost,ratherthanasacollectionofhosts,andwouldallowpeopletomove transparentlyamongmachineswithouthavingtochangetheiraddresses.Suchafacilitywould requireanautomaticallyupdateddatabaseandsomemethodofresolvingconflicts.Ideally thiswouldbeeffectiveevenwithoutallhostsbeingunderasinglemanagement.However,itis notclearwhetherthisfeatureshouldbeintegratedintothealiasingfacilityorshouldbeconsidereda“valueadded”featureoutsidesendmailitself. Asamoreinterestingcase,theCSNETnameserver[Solomon81]providesanfacilitythat goesbeyondasingletightly-coupledenvironment.Suchafacilitywouldnormallyexistoutside ofsendmailhowever. ACKNOWLEDGEMENTS ThanksareduetoKurtShoensforhiscontinualcheerfulassistanceandgoodadvice,Bill Joyforpointingmeinthecorrectdirection(overandover),andMarkHortonformoreadvice, prodding,andmanyofthegoodideas.KurtandEricSchmidtaretobecreditedforusingdelivermailasaserverfortheirprograms(MailandBerkNetrespectively)beforeanysaneperson shouldhave,andmakingthenecessarymodificationspromptlyandhappily.Ericgavemeconsiderableadviceabouttheperilsofnetworksoftwarewhichsavedmeanunknownamountofwork andgrief.MarkdidtheoriginalimplementationoftheDBMversionofaliasing,installedthe VFORKcode,wrotethecurrentversionofrmail,andwasthepersonwhoreallyconvincedmeto puttheworkintodelivermailtoturnitintosendmail.Kurtdeservesaccoladesforusingsendmail whenIwasmyselfafraidtotaketherisk;howapersoncancontinuetobesoenthusiasticinthe faceofsomuchbitterrealityisbeyondme. Kurt,Mark,KirkMcKusick,MarvinSolomon,andmanyothershavereviewedthispaper, givingconsiderableusefuladvice. SpecialthanksarereservedforMikeStonebrakeratBerkeleyandBobEpsteinatBritton-Lee,whobothknowinglyallowedmetoputsomuchworkintothisprojectwhentherewereso manyotherthingsIreallyshouldhavebeenworkingon. Version4.1 DRAFTLastMod7/25/83 REFERENCES [Birrell82]Birrell,A.D.,Levin,R.,Needham,R.M.,andSchroeder,M.D., “Grapevine:AnExerciseinDistributedComputing.”InComm.A.C.M. 25,4,April82. [Borden79]Borden,S.,Gaines,R.S.,andShapiro,N.Z.,TheMHMessageHandling System:Users’Manual.R-2367-PAF.RandCorporation.October1979. [Crocker77a]Crocker,D.H.,Vittal,J.J.,Pogran,K.T.,andHenderson,D.A.Jr., StandardfortheFormatofARPANetworkTextMessages.RFC733, NIC41952.In[Feinler78].November1977. [Crocker77b]Crocker,D.H.,FrameworkandFunctionsoftheMSPersonalMessage System.R-2134-ARPA,RandCorporation,SantaMonica,California. 1977. [Crocker79]Crocker,D.H.,Szurkowski,E.S.,andFarber,D.J.,AnInternetwork MemoDistributionFacility—MMDF.6thDataCommunicationSymposium,Asilomar.November1979. [Crocker82]Crocker,D.H.,StandardfortheFormatofArpaInternetTextMessages. RFC822.NetworkInformationCenter,SRIInternational,MenloPark, California.August1982. [Metcalfe76]Metcalfe,R.,andBoggs,D.,“Ethernet:DistributedPacketSwitchingfor LocalComputerNetworks”,CommunicationsoftheACM19,7.July 1976. [Feinler78]Feinler,E.,andPostel,J.(eds.),ARPANETProtocolHandbook.NIC 7104,NetworkInformationCenter,SRIInternational,MenloPark,California.1978. [NBS80]NationalBureauofStandards,SpecificationofaDraftMessageFormat Standard.ReportNo.ICST/CBOS80-2.October1980. [Neigus73]Neigus,N.,FileTransferProtocolfortheARPANetwork.RFC542,NIC 17759.In[Feinler78].August,1973. [Nowitz78a]Nowitz,D.A.,andLesk,M.E.,ADial-UpNetworkofUNIXSystems. BellLaboratories.InUNIXProgrammer’sManual,SeventhEdition,Volume2.August,1978. [Nowitz78b]Nowitz,D.A.,UucpImplementationDescription.BellLaboratories.In UNIXProgrammer’sManual,SeventhEdition,Volume2.October,1978. [Postel74]Postel,J.,andNeigus,N.,RevisedFTPReplyCodes.RFC640,NIC 30843.In[Feinler78].June,1974. [Postel77]Postel,J.,MailProtocol.NIC29588.In[Feinler78].November1977. [Postel79a]Postel,J.,InternetMessageProtocol.RFC753,IEN85.NetworkInformationCenter,SRIInternational,MenloPark,California.March1979. [Postel79b]Postel,J.B.,AnInternetworkMessageStructure.InProceedingsofthe SixthDataCommunicationsSymposium,IEEE.NewYork.November 1979. [Postel80]Postel,J.B.,AStructuredFormatforTransmissionofMulti-MediaDoc-uments.RFC767.NetworkInformationCenter,SRIInternational, MenloPark,California.August1980. SENDMAIL 12 SENDMAIL 13 [Postel82]Postel,J.B.,SimpleMailTransferProtocol.RFC821(obsoleting RFC788).NetworkInformationCenter,SRIInternational,MenloPark, California.August1982. [Schmidt79]Schmidt,E.,AnIntroductiontotheBerkeleyNetwork.UniversityofCalifornia,BerkeleyCalifornia.1979. [Shoens79]Shoens,K.,MailReferenceManual.UniversityofCalifornia,Berkeley. InUNIXProgrammer’sManual,SeventhEdition,Volume2C.December 1979. [Sluizer81]Sluizer,S.,andPostel,J.B.,MailTransferProtocol.RFC780.Network InformationCenter,SRIInternational,MenloPark,California.May 1981. [Solomon81]Solomon,M.,Landweber,L.,andNeuhengen,D.,“TheDesignofthe CSNETNameServer.”CS-DN-2,UniversityofWisconsin,Madison. November1981. [Su82]Su,Zaw-Sing,andPostel,Jon,TheDomainNamingConventionfor InternetUserApplications.RFC819.NetworkInformationCenter,SRI International,MenloPark,California.August1982. [UNIX83]TheUNIXProgrammer’sManual,SeventhEdition,VirtualVAX-11Ver-sion,Volume1.BellLaboratories,modifiedbytheUniversityofCalifor-nia,Berkeley,California.March,1983. Version4.1 DRAFTLastMod7/25/83