rfc0821.txt 118KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051
  1. RFC 821
  2. SIMPLE MAIL TRANSFER PROTOCOL
  3. Jonathan B. Postel
  4. August 1982
  5. Information Sciences Institute
  6. University of Southern California
  7. 4676 Admiralty Way
  8. Marina del Rey, California 90291
  9. (213) 822-1511
  10. RFC 821 August 1982
  11. Simple Mail Transfer Protocol
  12. TABLE OF CONTENTS
  13. 1. INTRODUCTION .................................................. 1
  14. 2. THE SMTP MODEL ................................................ 2
  15. 3. THE SMTP PROCEDURE ............................................ 4
  16. 3.1. Mail ..................................................... 4
  17. 3.2. Forwarding ............................................... 7
  18. 3.3. Verifying and Expanding .................................. 8
  19. 3.4. Sending and Mailing ..................................... 11
  20. 3.5. Opening and Closing ..................................... 13
  21. 3.6. Relaying ................................................ 14
  22. 3.7. Domains ................................................. 17
  23. 3.8. Changing Roles .......................................... 18
  24. 4. THE SMTP SPECIFICATIONS ...................................... 19
  25. 4.1. SMTP Commands ........................................... 19
  26. 4.1.1. Command Semantics ..................................... 19
  27. 4.1.2. Command Syntax ........................................ 27
  28. 4.2. SMTP Replies ............................................ 34
  29. 4.2.1. Reply Codes by Function Group ......................... 35
  30. 4.2.2. Reply Codes in Numeric Order .......................... 36
  31. 4.3. Sequencing of Commands and Replies ...................... 37
  32. 4.4. State Diagrams .......................................... 39
  33. 4.5. Details ................................................. 41
  34. 4.5.1. Minimum Implementation ................................ 41
  35. 4.5.2. Transparency .......................................... 41
  36. 4.5.3. Sizes ................................................. 42
  37. APPENDIX A: TCP ................................................. 44
  38. APPENDIX B: NCP ................................................. 45
  39. APPENDIX C: NITS ................................................ 46
  40. APPENDIX D: X.25 ................................................ 47
  41. APPENDIX E: Theory of Reply Codes ............................... 48
  42. APPENDIX F: Scenarios ........................................... 51
  43. GLOSSARY ......................................................... 64
  44. REFERENCES ....................................................... 67
  45. Network Working Group J. Postel
  46. Request for Comments: DRAFT ISI
  47. Replaces: RFC 788, 780, 772 August 1982
  48. SIMPLE MAIL TRANSFER PROTOCOL
  49. 1. INTRODUCTION
  50. The objective of Simple Mail Transfer Protocol (SMTP) is to transfer
  51. mail reliably and efficiently.
  52. SMTP is independent of the particular transmission subsystem and
  53. requires only a reliable ordered data stream channel. Appendices A,
  54. B, C, and D describe the use of SMTP with various transport services.
  55. A Glossary provides the definitions of terms as used in this
  56. document.
  57. An important feature of SMTP is its capability to relay mail across
  58. transport service environments. A transport service provides an
  59. interprocess communication environment (IPCE). An IPCE may cover one
  60. network, several networks, or a subset of a network. It is important
  61. to realize that transport systems (or IPCEs) are not one-to-one with
  62. networks. A process can communicate directly with another process
  63. through any mutually known IPCE. Mail is an application or use of
  64. interprocess communication. Mail can be communicated between
  65. processes in different IPCEs by relaying through a process connected
  66. to two (or more) IPCEs. More specifically, mail can be relayed
  67. between hosts on different transport systems by a host on both
  68. transport systems.
  69. Postel [Page 1]
  70. August 1982 RFC 821
  71. Simple Mail Transfer Protocol
  72. 2. THE SMTP MODEL
  73. The SMTP design is based on the following model of communication: as
  74. the result of a user mail request, the sender-SMTP establishes a
  75. two-way transmission channel to a receiver-SMTP. The receiver-SMTP
  76. may be either the ultimate destination or an intermediate. SMTP
  77. commands are generated by the sender-SMTP and sent to the
  78. receiver-SMTP. SMTP replies are sent from the receiver-SMTP to the
  79. sender-SMTP in response to the commands.
  80. Once the transmission channel is established, the SMTP-sender sends a
  81. MAIL command indicating the sender of the mail. If the SMTP-receiver
  82. can accept mail it responds with an OK reply. The SMTP-sender then
  83. sends a RCPT command identifying a recipient of the mail. If the
  84. SMTP-receiver can accept mail for that recipient it responds with an
  85. OK reply; if not, it responds with a reply rejecting that recipient
  86. (but not the whole mail transaction). The SMTP-sender and
  87. SMTP-receiver may negotiate several recipients. When the recipients
  88. have been negotiated the SMTP-sender sends the mail data, terminating
  89. with a special sequence. If the SMTP-receiver successfully processes
  90. the mail data it responds with an OK reply. The dialog is purposely
  91. lock-step, one-at-a-time.
  92. -------------------------------------------------------------
  93. +----------+ +----------+
  94. +------+ | | | |
  95. | User |<-->| | SMTP | |
  96. +------+ | Sender- |Commands/Replies| Receiver-|
  97. +------+ | SMTP |<-------------->| SMTP | +------+
  98. | File |<-->| | and Mail | |<-->| File |
  99. |System| | | | | |System|
  100. +------+ +----------+ +----------+ +------+
  101. Sender-SMTP Receiver-SMTP
  102. Model for SMTP Use
  103. Figure 1
  104. -------------------------------------------------------------
  105. The SMTP provides mechanisms for the transmission of mail; directly
  106. from the sending user's host to the receiving user's host when the
  107. [Page 2] Postel
  108. RFC 821 August 1982
  109. Simple Mail Transfer Protocol
  110. two host are connected to the same transport service, or via one or
  111. more relay SMTP-servers when the source and destination hosts are not
  112. connected to the same transport service.
  113. To be able to provide the relay capability the SMTP-server must be
  114. supplied with the name of the ultimate destination host as well as
  115. the destination mailbox name.
  116. The argument to the MAIL command is a reverse-path, which specifies
  117. who the mail is from. The argument to the RCPT command is a
  118. forward-path, which specifies who the mail is to. The forward-path
  119. is a source route, while the reverse-path is a return route (which
  120. may be used to return a message to the sender when an error occurs
  121. with a relayed message).
  122. When the same message is sent to multiple recipients the SMTP
  123. encourages the transmission of only one copy of the data for all the
  124. recipients at the same destination host.
  125. The mail commands and replies have a rigid syntax. Replies also have
  126. a numeric code. In the following, examples appear which use actual
  127. commands and replies. The complete lists of commands and replies
  128. appears in Section 4 on specifications.
  129. Commands and replies are not case sensitive. That is, a command or
  130. reply word may be upper case, lower case, or any mixture of upper and
  131. lower case. Note that this is not true of mailbox user names. For
  132. some hosts the user name is case sensitive, and SMTP implementations
  133. must take case to preserve the case of user names as they appear in
  134. mailbox arguments. Host names are not case sensitive.
  135. Commands and replies are composed of characters from the ASCII
  136. character set [1]. When the transport service provides an 8-bit byte
  137. (octet) transmission channel, each 7-bit character is transmitted
  138. right justified in an octet with the high order bit cleared to zero.
  139. When specifying the general form of a command or reply, an argument
  140. (or special symbol) will be denoted by a meta-linguistic variable (or
  141. constant), for example, "<string>" or "<reverse-path>". Here the
  142. angle brackets indicate these are meta-linguistic variables.
  143. However, some arguments use the angle brackets literally. For
  144. example, an actual reverse-path is enclosed in angle brackets, i.e.,
  145. "<John.Smith@USC-ISI.ARPA>" is an instance of <reverse-path> (the
  146. angle brackets are actually transmitted in the command or reply).
  147. Postel [Page 3]
  148. August 1982 RFC 821
  149. Simple Mail Transfer Protocol
  150. 3. THE SMTP PROCEDURES
  151. This section presents the procedures used in SMTP in several parts.
  152. First comes the basic mail procedure defined as a mail transaction.
  153. Following this are descriptions of forwarding mail, verifying mailbox
  154. names and expanding mailing lists, sending to terminals instead of or
  155. in combination with mailboxes, and the opening and closing exchanges.
  156. At the end of this section are comments on relaying, a note on mail
  157. domains, and a discussion of changing roles. Throughout this section
  158. are examples of partial command and reply sequences, several complete
  159. scenarios are presented in Appendix F.
  160. 3.1. MAIL
  161. There are three steps to SMTP mail transactions. The transaction
  162. is started with a MAIL command which gives the sender
  163. identification. A series of one or more RCPT commands follows
  164. giving the receiver information. Then a DATA command gives the
  165. mail data. And finally, the end of mail data indicator confirms
  166. the transaction.
  167. The first step in the procedure is the MAIL command. The
  168. <reverse-path> contains the source mailbox.
  169. MAIL <SP> FROM:<reverse-path> <CRLF>
  170. This command tells the SMTP-receiver that a new mail
  171. transaction is starting and to reset all its state tables and
  172. buffers, including any recipients or mail data. It gives the
  173. reverse-path which can be used to report errors. If accepted,
  174. the receiver-SMTP returns a 250 OK reply.
  175. The <reverse-path> can contain more than just a mailbox. The
  176. <reverse-path> is a reverse source routing list of hosts and
  177. source mailbox. The first host in the <reverse-path> should be
  178. the host sending this command.
  179. The second step in the procedure is the RCPT command.
  180. RCPT <SP> TO:<forward-path> <CRLF>
  181. This command gives a forward-path identifying one recipient.
  182. If accepted, the receiver-SMTP returns a 250 OK reply, and
  183. stores the forward-path. If the recipient is unknown the
  184. receiver-SMTP returns a 550 Failure reply. This second step of
  185. the procedure can be repeated any number of times.
  186. [Page 4] Postel
  187. RFC 821 August 1982
  188. Simple Mail Transfer Protocol
  189. The <forward-path> can contain more than just a mailbox. The
  190. <forward-path> is a source routing list of hosts and the
  191. destination mailbox. The first host in the <forward-path>
  192. should be the host receiving this command.
  193. The third step in the procedure is the DATA command.
  194. DATA <CRLF>
  195. If accepted, the receiver-SMTP returns a 354 Intermediate reply
  196. and considers all succeeding lines to be the message text.
  197. When the end of text is received and stored the SMTP-receiver
  198. sends a 250 OK reply.
  199. Since the mail data is sent on the transmission channel the end
  200. of the mail data must be indicated so that the command and
  201. reply dialog can be resumed. SMTP indicates the end of the
  202. mail data by sending a line containing only a period. A
  203. transparency procedure is used to prevent this from interfering
  204. with the user's text (see Section 4.5.2).
  205. Please note that the mail data includes the memo header
  206. items such as Date, Subject, To, Cc, From [2].
  207. The end of mail data indicator also confirms the mail
  208. transaction and tells the receiver-SMTP to now process the
  209. stored recipients and mail data. If accepted, the
  210. receiver-SMTP returns a 250 OK reply. The DATA command should
  211. fail only if the mail transaction was incomplete (for example,
  212. no recipients), or if resources are not available.
  213. The above procedure is an example of a mail transaction. These
  214. commands must be used only in the order discussed above.
  215. Example 1 (below) illustrates the use of these commands in a mail
  216. transaction.
  217. Postel [Page 5]
  218. August 1982 RFC 821
  219. Simple Mail Transfer Protocol
  220. -------------------------------------------------------------
  221. Example of the SMTP Procedure
  222. This SMTP example shows mail sent by Smith at host Alpha.ARPA,
  223. to Jones, Green, and Brown at host Beta.ARPA. Here we assume
  224. that host Alpha contacts host Beta directly.
  225. S: MAIL FROM:<Smith@Alpha.ARPA>
  226. R: 250 OK
  227. S: RCPT TO:<Jones@Beta.ARPA>
  228. R: 250 OK
  229. S: RCPT TO:<Green@Beta.ARPA>
  230. R: 550 No such user here
  231. S: RCPT TO:<Brown@Beta.ARPA>
  232. R: 250 OK
  233. S: DATA
  234. R: 354 Start mail input; end with <CRLF>.<CRLF>
  235. S: Blah blah blah...
  236. S: ...etc. etc. etc.
  237. S: <CRLF>.<CRLF>
  238. R: 250 OK
  239. The mail has now been accepted for Jones and Brown. Green did
  240. not have a mailbox at host Beta.
  241. Example 1
  242. -------------------------------------------------------------
  243. [Page 6] Postel
  244. RFC 821 August 1982
  245. Simple Mail Transfer Protocol
  246. 3.2. FORWARDING
  247. There are some cases where the destination information in the
  248. <forward-path> is incorrect, but the receiver-SMTP knows the
  249. correct destination. In such cases, one of the following replies
  250. should be used to allow the sender to contact the correct
  251. destination.
  252. 251 User not local; will forward to <forward-path>
  253. This reply indicates that the receiver-SMTP knows the user's
  254. mailbox is on another host and indicates the correct
  255. forward-path to use in the future. Note that either the
  256. host or user or both may be different. The receiver takes
  257. responsibility for delivering the message.
  258. 551 User not local; please try <forward-path>
  259. This reply indicates that the receiver-SMTP knows the user's
  260. mailbox is on another host and indicates the correct
  261. forward-path to use. Note that either the host or user or
  262. both may be different. The receiver refuses to accept mail
  263. for this user, and the sender must either redirect the mail
  264. according to the information provided or return an error
  265. response to the originating user.
  266. Example 2 illustrates the use of these responses.
  267. -------------------------------------------------------------
  268. Example of Forwarding
  269. Either
  270. S: RCPT TO:<Postel@USC-ISI.ARPA>
  271. R: 251 User not local; will forward to <Postel@USC-ISIF.ARPA>
  272. Or
  273. S: RCPT TO:<Paul@USC-ISIB.ARPA>
  274. R: 551 User not local; please try <Mockapetris@USC-ISIF.ARPA>
  275. Example 2
  276. -------------------------------------------------------------
  277. Postel [Page 7]
  278. August 1982 RFC 821
  279. Simple Mail Transfer Protocol
  280. 3.3. VERIFYING AND EXPANDING
  281. SMTP provides as additional features, commands to verify a user
  282. name or expand a mailing list. This is done with the VRFY and
  283. EXPN commands, which have character string arguments. For the
  284. VRFY command, the string is a user name, and the response may
  285. include the full name of the user and must include the mailbox of
  286. the user. For the EXPN command, the string identifies a mailing
  287. list, and the multiline response may include the full name of the
  288. users and must give the mailboxes on the mailing list.
  289. "User name" is a fuzzy term and used purposely. If a host
  290. implements the VRFY or EXPN commands then at least local mailboxes
  291. must be recognized as "user names". If a host chooses to
  292. recognize other strings as "user names" that is allowed.
  293. In some hosts the distinction between a mailing list and an alias
  294. for a single mailbox is a bit fuzzy, since a common data structure
  295. may hold both types of entries, and it is possible to have mailing
  296. lists of one mailbox. If a request is made to verify a mailing
  297. list a positive response can be given if on receipt of a message
  298. so addressed it will be delivered to everyone on the list,
  299. otherwise an error should be reported (e.g., "550 That is a
  300. mailing list, not a user"). If a request is made to expand a user
  301. name a positive response can be formed by returning a list
  302. containing one name, or an error can be reported (e.g., "550 That
  303. is a user name, not a mailing list").
  304. In the case of a multiline reply (normal for EXPN) exactly one
  305. mailbox is to be specified on each line of the reply. In the case
  306. of an ambiguous request, for example, "VRFY Smith", where there
  307. are two Smith's the response must be "553 User ambiguous".
  308. The case of verifying a user name is straightforward as shown in
  309. example 3.
  310. [Page 8] Postel
  311. RFC 821 August 1982
  312. Simple Mail Transfer Protocol
  313. -------------------------------------------------------------
  314. Example of Verifying a User Name
  315. Either
  316. S: VRFY Smith
  317. R: 250 Fred Smith <Smith@USC-ISIF.ARPA>
  318. Or
  319. S: VRFY Smith
  320. R: 251 User not local; will forward to <Smith@USC-ISIQ.ARPA>
  321. Or
  322. S: VRFY Jones
  323. R: 550 String does not match anything.
  324. Or
  325. S: VRFY Jones
  326. R: 551 User not local; please try <Jones@USC-ISIQ.ARPA>
  327. Or
  328. S: VRFY Gourzenkyinplatz
  329. R: 553 User ambiguous.
  330. Example 3
  331. -------------------------------------------------------------
  332. Postel [Page 9]
  333. August 1982 RFC 821
  334. Simple Mail Transfer Protocol
  335. The case of expanding a mailbox list requires a multiline reply as
  336. shown in example 4.
  337. -------------------------------------------------------------
  338. Example of Expanding a Mailing List
  339. Either
  340. S: EXPN Example-People
  341. R: 250-Jon Postel <Postel@USC-ISIF.ARPA>
  342. R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
  343. R: 250-Sam Q. Smith <SQSmith@USC-ISIQ.ARPA>
  344. R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  345. R: 250-<joe@foo-unix.ARPA>
  346. R: 250 <xyz@bar-unix.ARPA>
  347. Or
  348. S: EXPN Executive-Washroom-List
  349. R: 550 Access Denied to You.
  350. Example 4
  351. -------------------------------------------------------------
  352. The character string arguments of the VRFY and EXPN commands
  353. cannot be further restricted due to the variety of implementations
  354. of the user name and mailbox list concepts. On some systems it
  355. may be appropriate for the argument of the EXPN command to be a
  356. file name for a file containing a mailing list, but again there is
  357. a variety of file naming conventions in the Internet.
  358. The VRFY and EXPN commands are not included in the minimum
  359. implementation (Section 4.5.1), and are not required to work
  360. across relays when they are implemented.
  361. [Page 10] Postel
  362. RFC 821 August 1982
  363. Simple Mail Transfer Protocol
  364. 3.4. SENDING AND MAILING
  365. The main purpose of SMTP is to deliver messages to user's
  366. mailboxes. A very similar service provided by some hosts is to
  367. deliver messages to user's terminals (provided the user is active
  368. on the host). The delivery to the user's mailbox is called
  369. "mailing", the delivery to the user's terminal is called
  370. "sending". Because in many hosts the implementation of sending is
  371. nearly identical to the implementation of mailing these two
  372. functions are combined in SMTP. However the sending commands are
  373. not included in the required minimum implementation
  374. (Section 4.5.1). Users should have the ability to control the
  375. writing of messages on their terminals. Most hosts permit the
  376. users to accept or refuse such messages.
  377. The following three command are defined to support the sending
  378. options. These are used in the mail transaction instead of the
  379. MAIL command and inform the receiver-SMTP of the special semantics
  380. of this transaction:
  381. SEND <SP> FROM:<reverse-path> <CRLF>
  382. The SEND command requires that the mail data be delivered to
  383. the user's terminal. If the user is not active (or not
  384. accepting terminal messages) on the host a 450 reply may
  385. returned to a RCPT command. The mail transaction is
  386. successful if the message is delivered the terminal.
  387. SOML <SP> FROM:<reverse-path> <CRLF>
  388. The Send Or MaiL command requires that the mail data be
  389. delivered to the user's terminal if the user is active (and
  390. accepting terminal messages) on the host. If the user is
  391. not active (or not accepting terminal messages) then the
  392. mail data is entered into the user's mailbox. The mail
  393. transaction is successful if the message is delivered either
  394. to the terminal or the mailbox.
  395. SAML <SP> FROM:<reverse-path> <CRLF>
  396. The Send And MaiL command requires that the mail data be
  397. delivered to the user's terminal if the user is active (and
  398. accepting terminal messages) on the host. In any case the
  399. mail data is entered into the user's mailbox. The mail
  400. transaction is successful if the message is delivered the
  401. mailbox.
  402. Postel [Page 11]
  403. August 1982 RFC 821
  404. Simple Mail Transfer Protocol
  405. The same reply codes that are used for the MAIL commands are used
  406. for these commands.
  407. [Page 12] Postel
  408. RFC 821 August 1982
  409. Simple Mail Transfer Protocol
  410. 3.5. OPENING AND CLOSING
  411. At the time the transmission channel is opened there is an
  412. exchange to ensure that the hosts are communicating with the hosts
  413. they think they are.
  414. The following two commands are used in transmission channel
  415. opening and closing:
  416. HELO <SP> <domain> <CRLF>
  417. QUIT <CRLF>
  418. In the HELO command the host sending the command identifies
  419. itself; the command may be interpreted as saying "Hello, I am
  420. <domain>".
  421. -------------------------------------------------------------
  422. Example of Connection Opening
  423. R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
  424. S: HELO USC-ISIF.ARPA
  425. R: 250 BBN-UNIX.ARPA
  426. Example 5
  427. -------------------------------------------------------------
  428. -------------------------------------------------------------
  429. Example of Connection Closing
  430. S: QUIT
  431. R: 221 BBN-UNIX.ARPA Service closing transmission channel
  432. Example 6
  433. -------------------------------------------------------------
  434. Postel [Page 13]
  435. August 1982 RFC 821
  436. Simple Mail Transfer Protocol
  437. 3.6. RELAYING
  438. The forward-path may be a source route of the form
  439. "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE are hosts. This
  440. form is used to emphasize the distinction between an address and a
  441. route. The mailbox is an absolute address, and the route is
  442. information about how to get there. The two concepts should not
  443. be confused.
  444. Conceptually the elements of the forward-path are moved to the
  445. reverse-path as the message is relayed from one server-SMTP to
  446. another. The reverse-path is a reverse source route, (i.e., a
  447. source route from the current location of the message to the
  448. originator of the message). When a server-SMTP deletes its
  449. identifier from the forward-path and inserts it into the
  450. reverse-path, it must use the name it is known by in the
  451. environment it is sending into, not the environment the mail came
  452. from, in case the server-SMTP is known by different names in
  453. different environments.
  454. If when the message arrives at an SMTP the first element of the
  455. forward-path is not the identifier of that SMTP the element is not
  456. deleted from the forward-path and is used to determine the next
  457. SMTP to send the message to. In any case, the SMTP adds its own
  458. identifier to the reverse-path.
  459. Using source routing the receiver-SMTP receives mail to be relayed
  460. to another server-SMTP The receiver-SMTP may accept or reject the
  461. task of relaying the mail in the same way it accepts or rejects
  462. mail for a local user. The receiver-SMTP transforms the command
  463. arguments by moving its own identifier from the forward-path to
  464. the beginning of the reverse-path. The receiver-SMTP then becomes
  465. a sender-SMTP, establishes a transmission channel to the next SMTP
  466. in the forward-path, and sends it the mail.
  467. The first host in the reverse-path should be the host sending the
  468. SMTP commands, and the first host in the forward-path should be
  469. the host receiving the SMTP commands.
  470. Notice that the forward-path and reverse-path appear in the SMTP
  471. commands and replies, but not necessarily in the message. That
  472. is, there is no need for these paths and especially this syntax to
  473. appear in the "To:" , "From:", "CC:", etc. fields of the message
  474. header.
  475. If a server-SMTP has accepted the task of relaying the mail and
  476. [Page 14] Postel
  477. RFC 821 August 1982
  478. Simple Mail Transfer Protocol
  479. later finds that the forward-path is incorrect or that the mail
  480. cannot be delivered for whatever reason, then it must construct an
  481. "undeliverable mail" notification message and send it to the
  482. originator of the undeliverable mail (as indicated by the
  483. reverse-path).
  484. This notification message must be from the server-SMTP at this
  485. host. Of course, server-SMTPs should not send notification
  486. messages about problems with notification messages. One way to
  487. prevent loops in error reporting is to specify a null reverse-path
  488. in the MAIL command of a notification message. When such a
  489. message is relayed it is permissible to leave the reverse-path
  490. null. A MAIL command with a null reverse-path appears as follows:
  491. MAIL FROM:<>
  492. An undeliverable mail notification message is shown in example 7.
  493. This notification is in response to a message originated by JOE at
  494. HOSTW and sent via HOSTX to HOSTY with instructions to relay it on
  495. to HOSTZ. What we see in the example is the transaction between
  496. HOSTY and HOSTX, which is the first step in the return of the
  497. notification message.
  498. Postel [Page 15]
  499. August 1982 RFC 821
  500. Simple Mail Transfer Protocol
  501. -------------------------------------------------------------
  502. Example Undeliverable Mail Notification Message
  503. S: MAIL FROM:<>
  504. R: 250 ok
  505. S: RCPT TO:<@HOSTX.ARPA:JOE@HOSTW.ARPA>
  506. R: 250 ok
  507. S: DATA
  508. R: 354 send the mail data, end with .
  509. S: Date: 23 Oct 81 11:22:33
  510. S: From: SMTP@HOSTY.ARPA
  511. S: To: JOE@HOSTW.ARPA
  512. S: Subject: Mail System Problem
  513. S:
  514. S: Sorry JOE, your message to SAM@HOSTZ.ARPA lost.
  515. S: HOSTZ.ARPA said this:
  516. S: "550 No Such User"
  517. S: .
  518. R: 250 ok
  519. Example 7
  520. -------------------------------------------------------------
  521. [Page 16] Postel
  522. RFC 821 August 1982
  523. Simple Mail Transfer Protocol
  524. 3.7. DOMAINS
  525. Domains are a recently introduced concept in the ARPA Internet
  526. mail system. The use of domains changes the address space from a
  527. flat global space of simple character string host names to a
  528. hierarchically structured rooted tree of global addresses. The
  529. host name is replaced by a domain and host designator which is a
  530. sequence of domain element strings separated by periods with the
  531. understanding that the domain elements are ordered from the most
  532. specific to the most general.
  533. For example, "USC-ISIF.ARPA", "Fred.Cambridge.UK", and
  534. "PC7.LCS.MIT.ARPA" might be host-and-domain identifiers.
  535. Whenever domain names are used in SMTP only the official names are
  536. used, the use of nicknames or aliases is not allowed.
  537. Postel [Page 17]
  538. August 1982 RFC 821
  539. Simple Mail Transfer Protocol
  540. 3.8. CHANGING ROLES
  541. The TURN command may be used to reverse the roles of the two
  542. programs communicating over the transmission channel.
  543. If program-A is currently the sender-SMTP and it sends the TURN
  544. command and receives an ok reply (250) then program-A becomes the
  545. receiver-SMTP.
  546. If program-B is currently the receiver-SMTP and it receives the
  547. TURN command and sends an ok reply (250) then program-B becomes
  548. the sender-SMTP.
  549. To refuse to change roles the receiver sends the 502 reply.
  550. Please note that this command is optional. It would not normally
  551. be used in situations where the transmission channel is TCP.
  552. However, when the cost of establishing the transmission channel is
  553. high, this command may be quite useful. For example, this command
  554. may be useful in supporting be mail exchange using the public
  555. switched telephone system as a transmission channel, especially if
  556. some hosts poll other hosts for mail exchanges.
  557. [Page 18] Postel
  558. RFC 821 August 1982
  559. Simple Mail Transfer Protocol
  560. 4. THE SMTP SPECIFICATIONS
  561. 4.1. SMTP COMMANDS
  562. 4.1.1. COMMAND SEMANTICS
  563. The SMTP commands define the mail transfer or the mail system
  564. function requested by the user. SMTP commands are character
  565. strings terminated by <CRLF>. The command codes themselves are
  566. alphabetic characters terminated by <SP> if parameters follow
  567. and <CRLF> otherwise. The syntax of mailboxes must conform to
  568. receiver site conventions. The SMTP commands are discussed
  569. below. The SMTP replies are discussed in the Section 4.2.
  570. A mail transaction involves several data objects which are
  571. communicated as arguments to different commands. The
  572. reverse-path is the argument of the MAIL command, the
  573. forward-path is the argument of the RCPT command, and the mail
  574. data is the argument of the DATA command. These arguments or
  575. data objects must be transmitted and held pending the
  576. confirmation communicated by the end of mail data indication
  577. which finalizes the transaction. The model for this is that
  578. distinct buffers are provided to hold the types of data
  579. objects, that is, there is a reverse-path buffer, a
  580. forward-path buffer, and a mail data buffer. Specific commands
  581. cause information to be appended to a specific buffer, or cause
  582. one or more buffers to be cleared.
  583. HELLO (HELO)
  584. This command is used to identify the sender-SMTP to the
  585. receiver-SMTP. The argument field contains the host name of
  586. the sender-SMTP.
  587. The receiver-SMTP identifies itself to the sender-SMTP in
  588. the connection greeting reply, and in the response to this
  589. command.
  590. This command and an OK reply to it confirm that both the
  591. sender-SMTP and the receiver-SMTP are in the initial state,
  592. that is, there is no transaction in progress and all state
  593. tables and buffers are cleared.
  594. Postel [Page 19]
  595. August 1982 RFC 821
  596. Simple Mail Transfer Protocol
  597. MAIL (MAIL)
  598. This command is used to initiate a mail transaction in which
  599. the mail data is delivered to one or more mailboxes. The
  600. argument field contains a reverse-path.
  601. The reverse-path consists of an optional list of hosts and
  602. the sender mailbox. When the list of hosts is present, it
  603. is a "reverse" source route and indicates that the mail was
  604. relayed through each host on the list (the first host in the
  605. list was the most recent relay). This list is used as a
  606. source route to return non-delivery notices to the sender.
  607. As each relay host adds itself to the beginning of the list,
  608. it must use its name as known in the IPCE to which it is
  609. relaying the mail rather than the IPCE from which the mail
  610. came (if they are different). In some types of error
  611. reporting messages (for example, undeliverable mail
  612. notifications) the reverse-path may be null (see Example 7).
  613. This command clears the reverse-path buffer, the
  614. forward-path buffer, and the mail data buffer; and inserts
  615. the reverse-path information from this command into the
  616. reverse-path buffer.
  617. RECIPIENT (RCPT)
  618. This command is used to identify an individual recipient of
  619. the mail data; multiple recipients are specified by multiple
  620. use of this command.
  621. The forward-path consists of an optional list of hosts and a
  622. required destination mailbox. When the list of hosts is
  623. present, it is a source route and indicates that the mail
  624. must be relayed to the next host on the list. If the
  625. receiver-SMTP does not implement the relay function it may
  626. user the same reply it would for an unknown local user
  627. (550).
  628. When mail is relayed, the relay host must remove itself from
  629. the beginning forward-path and put itself at the beginning
  630. of the reverse-path. When mail reaches its ultimate
  631. destination (the forward-path contains only a destination
  632. mailbox), the receiver-SMTP inserts it into the destination
  633. mailbox in accordance with its host mail conventions.
  634. [Page 20] Postel
  635. RFC 821 August 1982
  636. Simple Mail Transfer Protocol
  637. For example, mail received at relay host A with arguments
  638. FROM:<USERX@HOSTY.ARPA>
  639. TO:<@HOSTA.ARPA,@HOSTB.ARPA:USERC@HOSTD.ARPA>
  640. will be relayed on to host B with arguments
  641. FROM:<@HOSTA.ARPA:USERX@HOSTY.ARPA>
  642. TO:<@HOSTB.ARPA:USERC@HOSTD.ARPA>.
  643. This command causes its forward-path argument to be appended
  644. to the forward-path buffer.
  645. DATA (DATA)
  646. The receiver treats the lines following the command as mail
  647. data from the sender. This command causes the mail data
  648. from this command to be appended to the mail data buffer.
  649. The mail data may contain any of the 128 ASCII character
  650. codes.
  651. The mail data is terminated by a line containing only a
  652. period, that is the character sequence "<CRLF>.<CRLF>" (see
  653. Section 4.5.2 on Transparency). This is the end of mail
  654. data indication.
  655. The end of mail data indication requires that the receiver
  656. must now process the stored mail transaction information.
  657. This processing consumes the information in the reverse-path
  658. buffer, the forward-path buffer, and the mail data buffer,
  659. and on the completion of this command these buffers are
  660. cleared. If the processing is successful the receiver must
  661. send an OK reply. If the processing fails completely the
  662. receiver must send a failure reply.
  663. When the receiver-SMTP accepts a message either for relaying
  664. or for final delivery it inserts at the beginning of the
  665. mail data a time stamp line. The time stamp line indicates
  666. the identity of the host that sent the message, and the
  667. identity of the host that received the message (and is
  668. inserting this time stamp), and the date and time the
  669. message was received. Relayed messages will have multiple
  670. time stamp lines.
  671. When the receiver-SMTP makes the "final delivery" of a
  672. message it inserts at the beginning of the mail data a
  673. Postel [Page 21]
  674. August 1982 RFC 821
  675. Simple Mail Transfer Protocol
  676. return path line. The return path line preserves the
  677. information in the <reverse-path> from the MAIL command.
  678. Here, final delivery means the message leaves the SMTP
  679. world. Normally, this would mean it has been delivered to
  680. the destination user, but in some cases it may be further
  681. processed and transmitted by another mail system.
  682. It is possible for the mailbox in the return path be
  683. different from the actual sender's mailbox, for example,
  684. if error responses are to be delivered a special error
  685. handling mailbox rather than the message senders.
  686. The preceding two paragraphs imply that the final mail data
  687. will begin with a return path line, followed by one or more
  688. time stamp lines. These lines will be followed by the mail
  689. data header and body [2]. See Example 8.
  690. Special mention is needed of the response and further action
  691. required when the processing following the end of mail data
  692. indication is partially successful. This could arise if
  693. after accepting several recipients and the mail data, the
  694. receiver-SMTP finds that the mail data can be successfully
  695. delivered to some of the recipients, but it cannot be to
  696. others (for example, due to mailbox space allocation
  697. problems). In such a situation, the response to the DATA
  698. command must be an OK reply. But, the receiver-SMTP must
  699. compose and send an "undeliverable mail" notification
  700. message to the originator of the message. Either a single
  701. notification which lists all of the recipients that failed
  702. to get the message, or separate notification messages must
  703. be sent for each failed recipient (see Example 7). All
  704. undeliverable mail notification messages are sent using the
  705. MAIL command (even if they result from processing a SEND,
  706. SOML, or SAML command).
  707. [Page 22] Postel
  708. RFC 821 August 1982
  709. Simple Mail Transfer Protocol
  710. -------------------------------------------------------------
  711. Example of Return Path and Received Time Stamps
  712. Return-Path: <@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:JOE@ABC.ARPA>
  713. Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 PST
  714. Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 PST
  715. Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 PST
  716. Date: 27 Oct 81 15:01:01 PST
  717. From: JOE@ABC.ARPA
  718. Subject: Improved Mailing System Installed
  719. To: SAM@JKL.ARPA
  720. This is to inform you that ...
  721. Example 8
  722. -------------------------------------------------------------
  723. SEND (SEND)
  724. This command is used to initiate a mail transaction in which
  725. the mail data is delivered to one or more terminals. The
  726. argument field contains a reverse-path. This command is
  727. successful if the message is delivered to a terminal.
  728. The reverse-path consists of an optional list of hosts and
  729. the sender mailbox. When the list of hosts is present, it
  730. is a "reverse" source route and indicates that the mail was
  731. relayed through each host on the list (the first host in the
  732. list was the most recent relay). This list is used as a
  733. source route to return non-delivery notices to the sender.
  734. As each relay host adds itself to the beginning of the list,
  735. it must use its name as known in the IPCE to which it is
  736. relaying the mail rather than the IPCE from which the mail
  737. came (if they are different).
  738. This command clears the reverse-path buffer, the
  739. forward-path buffer, and the mail data buffer; and inserts
  740. the reverse-path information from this command into the
  741. reverse-path buffer.
  742. SEND OR MAIL (SOML)
  743. This command is used to initiate a mail transaction in which
  744. the mail data is delivered to one or more terminals or
  745. Postel [Page 23]
  746. August 1982 RFC 821
  747. Simple Mail Transfer Protocol
  748. mailboxes. For each recipient the mail data is delivered to
  749. the recipient's terminal if the recipient is active on the
  750. host (and accepting terminal messages), otherwise to the
  751. recipient's mailbox. The argument field contains a
  752. reverse-path. This command is successful if the message is
  753. delivered to a terminal or the mailbox.
  754. The reverse-path consists of an optional list of hosts and
  755. the sender mailbox. When the list of hosts is present, it
  756. is a "reverse" source route and indicates that the mail was
  757. relayed through each host on the list (the first host in the
  758. list was the most recent relay). This list is used as a
  759. source route to return non-delivery notices to the sender.
  760. As each relay host adds itself to the beginning of the list,
  761. it must use its name as known in the IPCE to which it is
  762. relaying the mail rather than the IPCE from which the mail
  763. came (if they are different).
  764. This command clears the reverse-path buffer, the
  765. forward-path buffer, and the mail data buffer; and inserts
  766. the reverse-path information from this command into the
  767. reverse-path buffer.
  768. SEND AND MAIL (SAML)
  769. This command is used to initiate a mail transaction in which
  770. the mail data is delivered to one or more terminals and
  771. mailboxes. For each recipient the mail data is delivered to
  772. the recipient's terminal if the recipient is active on the
  773. host (and accepting terminal messages), and for all
  774. recipients to the recipient's mailbox. The argument field
  775. contains a reverse-path. This command is successful if the
  776. message is delivered to the mailbox.
  777. The reverse-path consists of an optional list of hosts and
  778. the sender mailbox. When the list of hosts is present, it
  779. is a "reverse" source route and indicates that the mail was
  780. relayed through each host on the list (the first host in the
  781. list was the most recent relay). This list is used as a
  782. source route to return non-delivery notices to the sender.
  783. As each relay host adds itself to the beginning of the list,
  784. it must use its name as known in the IPCE to which it is
  785. relaying the mail rather than the IPCE from which the mail
  786. came (if they are different).
  787. This command clears the reverse-path buffer, the
  788. [Page 24] Postel
  789. RFC 821 August 1982
  790. Simple Mail Transfer Protocol
  791. forward-path buffer, and the mail data buffer; and inserts
  792. the reverse-path information from this command into the
  793. reverse-path buffer.
  794. RESET (RSET)
  795. This command specifies that the current mail transaction is
  796. to be aborted. Any stored sender, recipients, and mail data
  797. must be discarded, and all buffers and state tables cleared.
  798. The receiver must send an OK reply.
  799. VERIFY (VRFY)
  800. This command asks the receiver to confirm that the argument
  801. identifies a user. If it is a user name, the full name of
  802. the user (if known) and the fully specified mailbox are
  803. returned.
  804. This command has no effect on any of the reverse-path
  805. buffer, the forward-path buffer, or the mail data buffer.
  806. EXPAND (EXPN)
  807. This command asks the receiver to confirm that the argument
  808. identifies a mailing list, and if so, to return the
  809. membership of that list. The full name of the users (if
  810. known) and the fully specified mailboxes are returned in a
  811. multiline reply.
  812. This command has no effect on any of the reverse-path
  813. buffer, the forward-path buffer, or the mail data buffer.
  814. HELP (HELP)
  815. This command causes the receiver to send helpful information
  816. to the sender of the HELP command. The command may take an
  817. argument (e.g., any command name) and return more specific
  818. information as a response.
  819. This command has no effect on any of the reverse-path
  820. buffer, the forward-path buffer, or the mail data buffer.
  821. Postel [Page 25]
  822. August 1982 RFC 821
  823. Simple Mail Transfer Protocol
  824. NOOP (NOOP)
  825. This command does not affect any parameters or previously
  826. entered commands. It specifies no action other than that
  827. the receiver send an OK reply.
  828. This command has no effect on any of the reverse-path
  829. buffer, the forward-path buffer, or the mail data buffer.
  830. QUIT (QUIT)
  831. This command specifies that the receiver must send an OK
  832. reply, and then close the transmission channel.
  833. The receiver should not close the transmission channel until
  834. it receives and replies to a QUIT command (even if there was
  835. an error). The sender should not close the transmission
  836. channel until it send a QUIT command and receives the reply
  837. (even if there was an error response to a previous command).
  838. If the connection is closed prematurely the receiver should
  839. act as if a RSET command had been received (canceling any
  840. pending transaction, but not undoing any previously
  841. completed transaction), the sender should act as if the
  842. command or transaction in progress had received a temporary
  843. error (4xx).
  844. TURN (TURN)
  845. This command specifies that the receiver must either (1)
  846. send an OK reply and then take on the role of the
  847. sender-SMTP, or (2) send a refusal reply and retain the role
  848. of the receiver-SMTP.
  849. If program-A is currently the sender-SMTP and it sends the
  850. TURN command and receives an OK reply (250) then program-A
  851. becomes the receiver-SMTP. Program-A is then in the initial
  852. state as if the transmission channel just opened, and it
  853. then sends the 220 service ready greeting.
  854. If program-B is currently the receiver-SMTP and it receives
  855. the TURN command and sends an OK reply (250) then program-B
  856. becomes the sender-SMTP. Program-B is then in the initial
  857. state as if the transmission channel just opened, and it
  858. then expects to receive the 220 service ready greeting.
  859. To refuse to change roles the receiver sends the 502 reply.
  860. [Page 26] Postel
  861. RFC 821 August 1982
  862. Simple Mail Transfer Protocol
  863. There are restrictions on the order in which these command may
  864. be used.
  865. The first command in a session must be the HELO command.
  866. The HELO command may be used later in a session as well. If
  867. the HELO command argument is not acceptable a 501 failure
  868. reply must be returned and the receiver-SMTP must stay in
  869. the same state.
  870. The NOOP, HELP, EXPN, and VRFY commands can be used at any
  871. time during a session.
  872. The MAIL, SEND, SOML, or SAML commands begin a mail
  873. transaction. Once started a mail transaction consists of
  874. one of the transaction beginning commands, one or more RCPT
  875. commands, and a DATA command, in that order. A mail
  876. transaction may be aborted by the RSET command. There may
  877. be zero or more transactions in a session.
  878. If the transaction beginning command argument is not
  879. acceptable a 501 failure reply must be returned and the
  880. receiver-SMTP must stay in the same state. If the commands
  881. in a transaction are out of order a 503 failure reply must
  882. be returned and the receiver-SMTP must stay in the same
  883. state.
  884. The last command in a session must be the QUIT command. The
  885. QUIT command can not be used at any other time in a session.
  886. 4.1.2. COMMAND SYNTAX
  887. The commands consist of a command code followed by an argument
  888. field. Command codes are four alphabetic characters. Upper
  889. and lower case alphabetic characters are to be treated
  890. identically. Thus, any of the following may represent the mail
  891. command:
  892. MAIL Mail mail MaIl mAIl
  893. This also applies to any symbols representing parameter values,
  894. such as "TO" or "to" for the forward-path. Command codes and
  895. the argument fields are separated by one or more spaces.
  896. However, within the reverse-path and forward-path arguments
  897. case is important. In particular, in some hosts the user
  898. "smith" is different from the user "Smith".
  899. Postel [Page 27]
  900. August 1982 RFC 821
  901. Simple Mail Transfer Protocol
  902. The argument field consists of a variable length character
  903. string ending with the character sequence <CRLF>. The receiver
  904. is to take no action until this sequence is received.
  905. Square brackets denote an optional argument field. If the
  906. option is not taken, the appropriate default is implied.
  907. [Page 28] Postel
  908. RFC 821 August 1982
  909. Simple Mail Transfer Protocol
  910. The following are the SMTP commands:
  911. HELO <SP> <domain> <CRLF>
  912. MAIL <SP> FROM:<reverse-path> <CRLF>
  913. RCPT <SP> TO:<forward-path> <CRLF>
  914. DATA <CRLF>
  915. RSET <CRLF>
  916. SEND <SP> FROM:<reverse-path> <CRLF>
  917. SOML <SP> FROM:<reverse-path> <CRLF>
  918. SAML <SP> FROM:<reverse-path> <CRLF>
  919. VRFY <SP> <string> <CRLF>
  920. EXPN <SP> <string> <CRLF>
  921. HELP [<SP> <string>] <CRLF>
  922. NOOP <CRLF>
  923. QUIT <CRLF>
  924. TURN <CRLF>
  925. Postel [Page 29]
  926. August 1982 RFC 821
  927. Simple Mail Transfer Protocol
  928. The syntax of the above argument fields (using BNF notation
  929. where applicable) is given below. The "..." notation indicates
  930. that a field may be repeated one or more times.
  931. <reverse-path> ::= <path>
  932. <forward-path> ::= <path>
  933. <path> ::= "<" [ <a-d-l> ":" ] <mailbox> ">"
  934. <a-d-l> ::= <at-domain> | <at-domain> "," <a-d-l>
  935. <at-domain> ::= "@" <domain>
  936. <domain> ::= <element> | <element> "." <domain>
  937. <element> ::= <name> | "#" <number> | "[" <dotnum> "]"
  938. <mailbox> ::= <local-part> "@" <domain>
  939. <local-part> ::= <dot-string> | <quoted-string>
  940. <name> ::= <a> <ldh-str> <let-dig>
  941. <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
  942. <let-dig> ::= <a> | <d>
  943. <let-dig-hyp> ::= <a> | <d> | "-"
  944. <dot-string> ::= <string> | <string> "." <dot-string>
  945. <string> ::= <char> | <char> <string>
  946. <quoted-string> ::= """ <qtext> """
  947. <qtext> ::= "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
  948. <char> ::= <c> | "\" <x>
  949. <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
  950. <number> ::= <d> | <d> <number>
  951. <CRLF> ::= <CR> <LF>
  952. [Page 30] Postel
  953. RFC 821 August 1982
  954. Simple Mail Transfer Protocol
  955. <CR> ::= the carriage return character (ASCII code 13)
  956. <LF> ::= the line feed character (ASCII code 10)
  957. <SP> ::= the space character (ASCII code 32)
  958. <snum> ::= one, two, or three digits representing a decimal
  959. integer value in the range 0 through 255
  960. <a> ::= any one of the 52 alphabetic characters A through Z
  961. in upper case and a through z in lower case
  962. <c> ::= any one of the 128 ASCII characters, but not any
  963. <special> or <SP>
  964. <d> ::= any one of the ten digits 0 through 9
  965. <q> ::= any one of the 128 ASCII characters except <CR>,
  966. <LF>, quote ("), or backslash (\)
  967. <x> ::= any one of the 128 ASCII characters (no exceptions)
  968. <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
  969. | "," | ";" | ":" | "@" """ | the control
  970. characters (ASCII codes 0 through 31 inclusive and
  971. 127)
  972. Note that the backslash, "\", is a quote character, which is
  973. used to indicate that the next character is to be used
  974. literally (instead of its normal interpretation). For example,
  975. "Joe\,Smith" could be used to indicate a single nine character
  976. user field with comma being the fourth character of the field.
  977. Hosts are generally known by names which are translated to
  978. addresses in each host. Note that the name elements of domains
  979. are the official names -- no use of nicknames or aliases is
  980. allowed.
  981. Sometimes a host is not known to the translation function and
  982. communication is blocked. To bypass this barrier two numeric
  983. forms are also allowed for host "names". One form is a decimal
  984. integer prefixed by a pound sign, "#", which indicates the
  985. number is the address of the host. Another form is four small
  986. decimal integers separated by dots and enclosed by brackets,
  987. e.g., "[123.255.37.2]", which indicates a 32-bit ARPA Internet
  988. Address in four 8-bit fields.
  989. Postel [Page 31]
  990. August 1982 RFC 821
  991. Simple Mail Transfer Protocol
  992. The time stamp line and the return path line are formally
  993. defined as follows:
  994. <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>
  995. <time-stamp-line> ::= "Received:" <SP> <stamp> <CRLF>
  996. <stamp> ::= <from-domain> <by-domain> <opt-info> ";"
  997. <daytime>
  998. <from-domain> ::= "FROM" <SP> <domain> <SP>
  999. <by-domain> ::= "BY" <SP> <domain> <SP>
  1000. <opt-info> ::= [<via>] [<with>] [<id>] [<for>]
  1001. <via> ::= "VIA" <SP> <link> <SP>
  1002. <with> ::= "WITH" <SP> <protocol> <SP>
  1003. <id> ::= "ID" <SP> <string> <SP>
  1004. <for> ::= "FOR" <SP> <path> <SP>
  1005. <link> ::= The standard names for links are registered with
  1006. the Network Information Center.
  1007. <protocol> ::= The standard names for protocols are
  1008. registered with the Network Information Center.
  1009. <daytime> ::= <SP> <date> <SP> <time>
  1010. <date> ::= <dd> <SP> <mon> <SP> <yy>
  1011. <time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone>
  1012. <dd> ::= the one or two decimal integer day of the month in
  1013. the range 1 to 31.
  1014. <mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
  1015. "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
  1016. <yy> ::= the two decimal integer year of the century in the
  1017. range 00 to 99.
  1018. [Page 32] Postel
  1019. RFC 821 August 1982
  1020. Simple Mail Transfer Protocol
  1021. <hh> ::= the two decimal integer hour of the day in the
  1022. range 00 to 24.
  1023. <mm> ::= the two decimal integer minute of the hour in the
  1024. range 00 to 59.
  1025. <ss> ::= the two decimal integer second of the minute in the
  1026. range 00 to 59.
  1027. <zone> ::= "UT" for Universal Time (the default) or other
  1028. time zone designator (as in [2]).
  1029. -------------------------------------------------------------
  1030. Return Path Example
  1031. Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:JOE@ABLE.ARPA>
  1032. Example 9
  1033. -------------------------------------------------------------
  1034. -------------------------------------------------------------
  1035. Time Stamp Line Example
  1036. Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 09:23:59 PDT
  1037. Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25
  1038. id M12345 for Smith@PDQ.ARPA ; 22 OCT 81 09:23:59 PDT
  1039. Example 10
  1040. -------------------------------------------------------------
  1041. Postel [Page 33]
  1042. August 1982 RFC 821
  1043. Simple Mail Transfer Protocol
  1044. 4.2. SMTP REPLIES
  1045. Replies to SMTP commands are devised to ensure the synchronization
  1046. of requests and actions in the process of mail transfer, and to
  1047. guarantee that the sender-SMTP always knows the state of the
  1048. receiver-SMTP. Every command must generate exactly one reply.
  1049. The details of the command-reply sequence are made explicit in
  1050. Section 5.3 on Sequencing and Section 5.4 State Diagrams.
  1051. An SMTP reply consists of a three digit number (transmitted as
  1052. three alphanumeric characters) followed by some text. The number
  1053. is intended for use by automata to determine what state to enter
  1054. next; the text is meant for the human user. It is intended that
  1055. the three digits contain enough encoded information that the
  1056. sender-SMTP need not examine the text and may either discard it or
  1057. pass it on to the user, as appropriate. In particular, the text
  1058. may be receiver-dependent and context dependent, so there are
  1059. likely to be varying texts for each reply code. A discussion of
  1060. the theory of reply codes is given in Appendix E. Formally, a
  1061. reply is defined to be the sequence: a three-digit code, <SP>,
  1062. one line of text, and <CRLF>, or a multiline reply (as defined in
  1063. Appendix E). Only the EXPN and HELP commands are expected to
  1064. result in multiline replies in normal circumstances, however
  1065. multiline replies are allowed for any command.
  1066. [Page 34] Postel
  1067. RFC 821 August 1982
  1068. Simple Mail Transfer Protocol
  1069. 4.2.1. REPLY CODES BY FUNCTION GROUPS
  1070. 500 Syntax error, command unrecognized
  1071. [This may include errors such as command line too long]
  1072. 501 Syntax error in parameters or arguments
  1073. 502 Command not implemented
  1074. 503 Bad sequence of commands
  1075. 504 Command parameter not implemented
  1076. 211 System status, or system help reply
  1077. 214 Help message
  1078. [Information on how to use the receiver or the meaning of a
  1079. particular non-standard command; this reply is useful only
  1080. to the human user]
  1081. 220 <domain> Service ready
  1082. 221 <domain> Service closing transmission channel
  1083. 421 <domain> Service not available,
  1084. closing transmission channel
  1085. [This may be a reply to any command if the service knows it
  1086. must shut down]
  1087. 250 Requested mail action okay, completed
  1088. 251 User not local; will forward to <forward-path>
  1089. 450 Requested mail action not taken: mailbox unavailable
  1090. [E.g., mailbox busy]
  1091. 550 Requested action not taken: mailbox unavailable
  1092. [E.g., mailbox not found, no access]
  1093. 451 Requested action aborted: error in processing
  1094. 551 User not local; please try <forward-path>
  1095. 452 Requested action not taken: insufficient system storage
  1096. 552 Requested mail action aborted: exceeded storage allocation
  1097. 553 Requested action not taken: mailbox name not allowed
  1098. [E.g., mailbox syntax incorrect]
  1099. 354 Start mail input; end with <CRLF>.<CRLF>
  1100. 554 Transaction failed
  1101. Postel [Page 35]
  1102. August 1982 RFC 821
  1103. Simple Mail Transfer Protocol
  1104. 4.2.2. NUMERIC ORDER LIST OF REPLY CODES
  1105. 211 System status, or system help reply
  1106. 214 Help message
  1107. [Information on how to use the receiver or the meaning of a
  1108. particular non-standard command; this reply is useful only
  1109. to the human user]
  1110. 220 <domain> Service ready
  1111. 221 <domain> Service closing transmission channel
  1112. 250 Requested mail action okay, completed
  1113. 251 User not local; will forward to <forward-path>
  1114. 354 Start mail input; end with <CRLF>.<CRLF>
  1115. 421 <domain> Service not available,
  1116. closing transmission channel
  1117. [This may be a reply to any command if the service knows it
  1118. must shut down]
  1119. 450 Requested mail action not taken: mailbox unavailable
  1120. [E.g., mailbox busy]
  1121. 451 Requested action aborted: local error in processing
  1122. 452 Requested action not taken: insufficient system storage
  1123. 500 Syntax error, command unrecognized
  1124. [This may include errors such as command line too long]
  1125. 501 Syntax error in parameters or arguments
  1126. 502 Command not implemented
  1127. 503 Bad sequence of commands
  1128. 504 Command parameter not implemented
  1129. 550 Requested action not taken: mailbox unavailable
  1130. [E.g., mailbox not found, no access]
  1131. 551 User not local; please try <forward-path>
  1132. 552 Requested mail action aborted: exceeded storage allocation
  1133. 553 Requested action not taken: mailbox name not allowed
  1134. [E.g., mailbox syntax incorrect]
  1135. 554 Transaction failed
  1136. [Page 36] Postel
  1137. RFC 821 August 1982
  1138. Simple Mail Transfer Protocol
  1139. 4.3. SEQUENCING OF COMMANDS AND REPLIES
  1140. The communication between the sender and receiver is intended to
  1141. be an alternating dialogue, controlled by the sender. As such,
  1142. the sender issues a command and the receiver responds with a
  1143. reply. The sender must wait for this response before sending
  1144. further commands.
  1145. One important reply is the connection greeting. Normally, a
  1146. receiver will send a 220 "Service ready" reply when the connection
  1147. is completed. The sender should wait for this greeting message
  1148. before sending any commands.
  1149. Note: all the greeting type replies have the official name of
  1150. the server host as the first word following the reply code.
  1151. For example,
  1152. 220 <SP> USC-ISIF.ARPA <SP> Service ready <CRLF>
  1153. The table below lists alternative success and failure replies for
  1154. each command. These must be strictly adhered to; a receiver may
  1155. substitute text in the replies, but the meaning and action implied
  1156. by the code numbers and by the specific command reply sequence
  1157. cannot be altered.
  1158. COMMAND-REPLY SEQUENCES
  1159. Each command is listed with its possible replies. The prefixes
  1160. used before the possible replies are "P" for preliminary (not
  1161. used in SMTP), "I" for intermediate, "S" for success, "F" for
  1162. failure, and "E" for error. The 421 reply (service not
  1163. available, closing transmission channel) may be given to any
  1164. command if the SMTP-receiver knows it must shut down. This
  1165. listing forms the basis for the State Diagrams in Section 4.4.
  1166. CONNECTION ESTABLISHMENT
  1167. S: 220
  1168. F: 421
  1169. HELO
  1170. S: 250
  1171. E: 500, 501, 504, 421
  1172. MAIL
  1173. S: 250
  1174. F: 552, 451, 452
  1175. E: 500, 501, 421
  1176. Postel [Page 37]
  1177. August 1982 RFC 821
  1178. Simple Mail Transfer Protocol
  1179. RCPT
  1180. S: 250, 251
  1181. F: 550, 551, 552, 553, 450, 451, 452
  1182. E: 500, 501, 503, 421
  1183. DATA
  1184. I: 354 -> data -> S: 250
  1185. F: 552, 554, 451, 452
  1186. F: 451, 554
  1187. E: 500, 501, 503, 421
  1188. RSET
  1189. S: 250
  1190. E: 500, 501, 504, 421
  1191. SEND
  1192. S: 250
  1193. F: 552, 451, 452
  1194. E: 500, 501, 502, 421
  1195. SOML
  1196. S: 250
  1197. F: 552, 451, 452
  1198. E: 500, 501, 502, 421
  1199. SAML
  1200. S: 250
  1201. F: 552, 451, 452
  1202. E: 500, 501, 502, 421
  1203. VRFY
  1204. S: 250, 251
  1205. F: 550, 551, 553
  1206. E: 500, 501, 502, 504, 421
  1207. EXPN
  1208. S: 250
  1209. F: 550
  1210. E: 500, 501, 502, 504, 421
  1211. HELP
  1212. S: 211, 214
  1213. E: 500, 501, 502, 504, 421
  1214. NOOP
  1215. S: 250
  1216. E: 500, 421
  1217. QUIT
  1218. S: 221
  1219. E: 500
  1220. TURN
  1221. S: 250
  1222. F: 502
  1223. E: 500, 503
  1224. [Page 38] Postel
  1225. RFC 821 August 1982
  1226. Simple Mail Transfer Protocol
  1227. 4.4. STATE DIAGRAMS
  1228. Following are state diagrams for a simple-minded SMTP
  1229. implementation. Only the first digit of the reply codes is used.
  1230. There is one state diagram for each group of SMTP commands. The
  1231. command groupings were determined by constructing a model for each
  1232. command and then collecting together the commands with
  1233. structurally identical models.
  1234. For each command there are three possible outcomes: "success"
  1235. (S), "failure" (F), and "error" (E). In the state diagrams below
  1236. we use the symbol B for "begin", and the symbol W for "wait for
  1237. reply".
  1238. First, the diagram that represents most of the SMTP commands:
  1239. 1,3 +---+
  1240. ----------->| E |
  1241. | +---+
  1242. |
  1243. +---+ cmd +---+ 2 +---+
  1244. | B |---------->| W |---------->| S |
  1245. +---+ +---+ +---+
  1246. |
  1247. | 4,5 +---+
  1248. ----------->| F |
  1249. +---+
  1250. This diagram models the commands:
  1251. HELO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN, HELP,
  1252. NOOP, QUIT, TURN.
  1253. Postel [Page 39]
  1254. August 1982 RFC 821
  1255. Simple Mail Transfer Protocol
  1256. A more complex diagram models the DATA command:
  1257. +---+ DATA +---+ 1,2 +---+
  1258. | B |---------->| W |-------------------->| E |
  1259. +---+ +---+ ------------>+---+
  1260. 3| |4,5 |
  1261. | | |
  1262. -------------- ----- |
  1263. | | | +---+
  1264. | ---------- -------->| S |
  1265. | | | | +---+
  1266. | | ------------
  1267. | | | |
  1268. V 1,3| |2 |
  1269. +---+ data +---+ --------------->+---+
  1270. | |---------->| W | | F |
  1271. +---+ +---+-------------------->+---+
  1272. 4,5
  1273. Note that the "data" here is a series of lines sent from the
  1274. sender to the receiver with no response expected until the last
  1275. line is sent.
  1276. [Page 40] Postel
  1277. RFC 821 August 1982
  1278. Simple Mail Transfer Protocol
  1279. 4.5. DETAILS
  1280. 4.5.1. MINIMUM IMPLEMENTATION
  1281. In order to make SMTP workable, the following minimum
  1282. implementation is required for all receivers:
  1283. COMMANDS -- HELO
  1284. MAIL
  1285. RCPT
  1286. DATA
  1287. RSET
  1288. NOOP
  1289. QUIT
  1290. 4.5.2. TRANSPARENCY
  1291. Without some provision for data transparency the character
  1292. sequence "<CRLF>.<CRLF>" ends the mail text and cannot be sent
  1293. by the user. In general, users are not aware of such
  1294. "forbidden" sequences. To allow all user composed text to be
  1295. transmitted transparently the following procedures are used.
  1296. 1. Before sending a line of mail text the sender-SMTP checks
  1297. the first character of the line. If it is a period, one
  1298. additional period is inserted at the beginning of the line.
  1299. 2. When a line of mail text is received by the receiver-SMTP
  1300. it checks the line. If the line is composed of a single
  1301. period it is the end of mail. If the first character is a
  1302. period and there are other characters on the line, the first
  1303. character is deleted.
  1304. The mail data may contain any of the 128 ASCII characters. All
  1305. characters are to be delivered to the recipient's mailbox
  1306. including format effectors and other control characters. If
  1307. the transmission channel provides an 8-bit byte (octets) data
  1308. stream, the 7-bit ASCII codes are transmitted right justified
  1309. in the octets with the high order bits cleared to zero.
  1310. In some systems it may be necessary to transform the data as
  1311. it is received and stored. This may be necessary for hosts
  1312. that use a different character set than ASCII as their local
  1313. character set, or that store data in records rather than
  1314. Postel [Page 41]
  1315. August 1982 RFC 821
  1316. Simple Mail Transfer Protocol
  1317. strings. If such transforms are necessary, they must be
  1318. reversible -- especially if such transforms are applied to
  1319. mail being relayed.
  1320. 4.5.3. SIZES
  1321. There are several objects that have required minimum maximum
  1322. sizes. That is, every implementation must be able to receive
  1323. objects of at least these sizes, but must not send objects
  1324. larger than these sizes.
  1325. ****************************************************
  1326. * *
  1327. * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
  1328. * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  1329. * OF THESE OBJECTS SHOULD BE USED. *
  1330. * *
  1331. ****************************************************
  1332. user
  1333. The maximum total length of a user name is 64 characters.
  1334. domain
  1335. The maximum total length of a domain name or number is 64
  1336. characters.
  1337. path
  1338. The maximum total length of a reverse-path or
  1339. forward-path is 256 characters (including the punctuation
  1340. and element separators).
  1341. command line
  1342. The maximum total length of a command line including the
  1343. command word and the <CRLF> is 512 characters.
  1344. reply line
  1345. The maximum total length of a reply line including the
  1346. reply code and the <CRLF> is 512 characters.
  1347. [Page 42] Postel
  1348. RFC 821 August 1982
  1349. Simple Mail Transfer Protocol
  1350. text line
  1351. The maximum total length of a text line including the
  1352. <CRLF> is 1000 characters (but not counting the leading
  1353. dot duplicated for transparency).
  1354. recipients buffer
  1355. The maximum total number of recipients that must be
  1356. buffered is 100 recipients.
  1357. ****************************************************
  1358. * *
  1359. * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
  1360. * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  1361. * OF THESE OBJECTS SHOULD BE USED. *
  1362. * *
  1363. ****************************************************
  1364. Errors due to exceeding these limits may be reported by using
  1365. the reply codes, for example:
  1366. 500 Line too long.
  1367. 501 Path too long
  1368. 552 Too many recipients.
  1369. 552 Too much mail data.
  1370. Postel [Page 43]
  1371. August 1982 RFC 821
  1372. Simple Mail Transfer Protocol
  1373. APPENDIX A
  1374. TCP Transport service
  1375. The Transmission Control Protocol [3] is used in the ARPA
  1376. Internet, and in any network following the US DoD standards for
  1377. internetwork protocols.
  1378. Connection Establishment
  1379. The SMTP transmission channel is a TCP connection established
  1380. between the sender process port U and the receiver process port
  1381. L. This single full duplex connection is used as the
  1382. transmission channel. This protocol is assigned the service
  1383. port 25 (31 octal), that is L=25.
  1384. Data Transfer
  1385. The TCP connection supports the transmission of 8-bit bytes.
  1386. The SMTP data is 7-bit ASCII characters. Each character is
  1387. transmitted as an 8-bit byte with the high-order bit cleared to
  1388. zero.
  1389. [Page 44] Postel
  1390. RFC 821 August 1982
  1391. Simple Mail Transfer Protocol
  1392. APPENDIX B
  1393. NCP Transport service
  1394. The ARPANET Host-to-Host Protocol [4] (implemented by the Network
  1395. Control Program) may be used in the ARPANET.
  1396. Connection Establishment
  1397. The SMTP transmission channel is established via NCP between
  1398. the sender process socket U and receiver process socket L. The
  1399. Initial Connection Protocol [5] is followed resulting in a pair
  1400. of simplex connections. This pair of connections is used as
  1401. the transmission channel. This protocol is assigned the
  1402. contact socket 25 (31 octal), that is L=25.
  1403. Data Transfer
  1404. The NCP data connections are established in 8-bit byte mode.
  1405. The SMTP data is 7-bit ASCII characters. Each character is
  1406. transmitted as an 8-bit byte with the high-order bit cleared to
  1407. zero.
  1408. Postel [Page 45]
  1409. August 1982 RFC 821
  1410. Simple Mail Transfer Protocol
  1411. APPENDIX C
  1412. NITS
  1413. The Network Independent Transport Service [6] may be used.
  1414. Connection Establishment
  1415. The SMTP transmission channel is established via NITS between
  1416. the sender process and receiver process. The sender process
  1417. executes the CONNECT primitive, and the waiting receiver
  1418. process executes the ACCEPT primitive.
  1419. Data Transfer
  1420. The NITS connection supports the transmission of 8-bit bytes.
  1421. The SMTP data is 7-bit ASCII characters. Each character is
  1422. transmitted as an 8-bit byte with the high-order bit cleared to
  1423. zero.
  1424. [Page 46] Postel
  1425. RFC 821 August 1982
  1426. Simple Mail Transfer Protocol
  1427. APPENDIX D
  1428. X.25 Transport service
  1429. It may be possible to use the X.25 service [7] as provided by the
  1430. Public Data Networks directly, however, it is suggested that a
  1431. reliable end-to-end protocol such as TCP be used on top of X.25
  1432. connections.
  1433. Postel [Page 47]
  1434. August 1982 RFC 821
  1435. Simple Mail Transfer Protocol
  1436. APPENDIX E
  1437. Theory of Reply Codes
  1438. The three digits of the reply each have a special significance.
  1439. The first digit denotes whether the response is good, bad or
  1440. incomplete. An unsophisticated sender-SMTP will be able to
  1441. determine its next action (proceed as planned, redo, retrench,
  1442. etc.) by simply examining this first digit. A sender-SMTP that
  1443. wants to know approximately what kind of error occurred (e.g.,
  1444. mail system error, command syntax error) may examine the second
  1445. digit, reserving the third digit for the finest gradation of
  1446. information.
  1447. There are five values for the first digit of the reply code:
  1448. 1yz Positive Preliminary reply
  1449. The command has been accepted, but the requested action
  1450. is being held in abeyance, pending confirmation of the
  1451. information in this reply. The sender-SMTP should send
  1452. another command specifying whether to continue or abort
  1453. the action.
  1454. [Note: SMTP does not have any commands that allow this
  1455. type of reply, and so does not have the continue or
  1456. abort commands.]
  1457. 2yz Positive Completion reply
  1458. The requested action has been successfully completed. A
  1459. new request may be initiated.
  1460. 3yz Positive Intermediate reply
  1461. The command has been accepted, but the requested action
  1462. is being held in abeyance, pending receipt of further
  1463. information. The sender-SMTP should send another command
  1464. specifying this information. This reply is used in
  1465. command sequence groups.
  1466. 4yz Transient Negative Completion reply
  1467. The command was not accepted and the requested action did
  1468. not occur. However, the error condition is temporary and
  1469. the action may be requested again. The sender should
  1470. [Page 48] Postel
  1471. RFC 821 August 1982
  1472. Simple Mail Transfer Protocol
  1473. return to the beginning of the command sequence (if any).
  1474. It is difficult to assign a meaning to "transient" when
  1475. two different sites (receiver- and sender- SMTPs) must
  1476. agree on the interpretation. Each reply in this category
  1477. might have a different time value, but the sender-SMTP is
  1478. encouraged to try again. A rule of thumb to determine if
  1479. a reply fits into the 4yz or the 5yz category (see below)
  1480. is that replies are 4yz if they can be repeated without
  1481. any change in command form or in properties of the sender
  1482. or receiver. (E.g., the command is repeated identically
  1483. and the receiver does not put up a new implementation.)
  1484. 5yz Permanent Negative Completion reply
  1485. The command was not accepted and the requested action did
  1486. not occur. The sender-SMTP is discouraged from repeating
  1487. the exact request (in the same sequence). Even some
  1488. "permanent" error conditions can be corrected, so the
  1489. human user may want to direct the sender-SMTP to
  1490. reinitiate the command sequence by direct action at some
  1491. point in the future (e.g., after the spelling has been
  1492. changed, or the user has altered the account status).
  1493. The second digit encodes responses in specific categories:
  1494. x0z Syntax -- These replies refer to syntax errors,
  1495. syntactically correct commands that don't fit any
  1496. functional category, and unimplemented or superfluous
  1497. commands.
  1498. x1z Information -- These are replies to requests for
  1499. information, such as status or help.
  1500. x2z Connections -- These are replies referring to the
  1501. transmission channel.
  1502. x3z Unspecified as yet.
  1503. x4z Unspecified as yet.
  1504. x5z Mail system -- These replies indicate the status of
  1505. the receiver mail system vis-a-vis the requested
  1506. transfer or other mail system action.
  1507. The third digit gives a finer gradation of meaning in each
  1508. category specified by the second digit. The list of replies
  1509. Postel [Page 49]
  1510. August 1982 RFC 821
  1511. Simple Mail Transfer Protocol
  1512. illustrates this. Each reply text is recommended rather than
  1513. mandatory, and may even change according to the command with
  1514. which it is associated. On the other hand, the reply codes
  1515. must strictly follow the specifications in this section.
  1516. Receiver implementations should not invent new codes for
  1517. slightly different situations from the ones described here, but
  1518. rather adapt codes already defined.
  1519. For example, a command such as NOOP whose successful execution
  1520. does not offer the sender-SMTP any new information will return
  1521. a 250 reply. The response is 502 when the command requests an
  1522. unimplemented non-site-specific action. A refinement of that
  1523. is the 504 reply for a command that is implemented, but that
  1524. requests an unimplemented parameter.
  1525. The reply text may be longer than a single line; in these cases
  1526. the complete text must be marked so the sender-SMTP knows when it
  1527. can stop reading the reply. This requires a special format to
  1528. indicate a multiple line reply.
  1529. The format for multiline replies requires that every line,
  1530. except the last, begin with the reply code, followed
  1531. immediately by a hyphen, "-" (also known as minus), followed by
  1532. text. The last line will begin with the reply code, followed
  1533. immediately by <SP>, optionally some text, and <CRLF>.
  1534. For example:
  1535. 123-First line
  1536. 123-Second line
  1537. 123-234 text beginning with numbers
  1538. 123 The last line
  1539. In many cases the sender-SMTP then simply needs to search for
  1540. the reply code followed by <SP> at the beginning of a line, and
  1541. ignore all preceding lines. In a few cases, there is important
  1542. data for the sender in the reply "text". The sender will know
  1543. these cases from the current context.
  1544. [Page 50] Postel
  1545. RFC 821 August 1982
  1546. Simple Mail Transfer Protocol
  1547. APPENDIX F
  1548. Scenarios
  1549. This section presents complete scenarios of several types of SMTP
  1550. sessions.
  1551. A Typical SMTP Transaction Scenario
  1552. This SMTP example shows mail sent by Smith at host USC-ISIF, to
  1553. Jones, Green, and Brown at host BBN-UNIX. Here we assume that
  1554. host USC-ISIF contacts host BBN-UNIX directly. The mail is
  1555. accepted for Jones and Brown. Green does not have a mailbox at
  1556. host BBN-UNIX.
  1557. -------------------------------------------------------------
  1558. R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
  1559. S: HELO USC-ISIF.ARPA
  1560. R: 250 BBN-UNIX.ARPA
  1561. S: MAIL FROM:<Smith@USC-ISIF.ARPA>
  1562. R: 250 OK
  1563. S: RCPT TO:<Jones@BBN-UNIX.ARPA>
  1564. R: 250 OK
  1565. S: RCPT TO:<Green@BBN-UNIX.ARPA>
  1566. R: 550 No such user here
  1567. S: RCPT TO:<Brown@BBN-UNIX.ARPA>
  1568. R: 250 OK
  1569. S: DATA
  1570. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1571. S: Blah blah blah...
  1572. S: ...etc. etc. etc.
  1573. S: .
  1574. R: 250 OK
  1575. S: QUIT
  1576. R: 221 BBN-UNIX.ARPA Service closing transmission channel
  1577. Scenario 1
  1578. -------------------------------------------------------------
  1579. Postel [Page 51]
  1580. August 1982 RFC 821
  1581. Simple Mail Transfer Protocol
  1582. Aborted SMTP Transaction Scenario
  1583. -------------------------------------------------------------
  1584. R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready
  1585. S: HELO ISI-VAXA.ARPA
  1586. R: 250 MIT-Multics.ARPA
  1587. S: MAIL FROM:<Smith@ISI-VAXA.ARPA>
  1588. R: 250 OK
  1589. S: RCPT TO:<Jones@MIT-Multics.ARPA>
  1590. R: 250 OK
  1591. S: RCPT TO:<Green@MIT-Multics.ARPA>
  1592. R: 550 No such user here
  1593. S: RSET
  1594. R: 250 OK
  1595. S: QUIT
  1596. R: 221 MIT-Multics.ARPA Service closing transmission channel
  1597. Scenario 2
  1598. -------------------------------------------------------------
  1599. [Page 52] Postel
  1600. RFC 821 August 1982
  1601. Simple Mail Transfer Protocol
  1602. Relayed Mail Scenario
  1603. -------------------------------------------------------------
  1604. Step 1 -- Source Host to Relay Host
  1605. R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
  1606. S: HELO MIT-AI.ARPA
  1607. R: 250 USC-ISIE.ARPA
  1608. S: MAIL FROM:<JQP@MIT-AI.ARPA>
  1609. R: 250 OK
  1610. S: RCPT TO:<@USC-ISIE.ARPA:Jones@BBN-VAX.ARPA>
  1611. R: 250 OK
  1612. S: DATA
  1613. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1614. S: Date: 2 Nov 81 22:33:44
  1615. S: From: John Q. Public <JQP@MIT-AI.ARPA>
  1616. S: Subject: The Next Meeting of the Board
  1617. S: To: Jones@BBN-Vax.ARPA
  1618. S:
  1619. S: Bill:
  1620. S: The next meeting of the board of directors will be
  1621. S: on Tuesday.
  1622. S: John.
  1623. S: .
  1624. R: 250 OK
  1625. S: QUIT
  1626. R: 221 USC-ISIE.ARPA Service closing transmission channel
  1627. Postel [Page 53]
  1628. August 1982 RFC 821
  1629. Simple Mail Transfer Protocol
  1630. Step 2 -- Relay Host to Destination Host
  1631. R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready
  1632. S: HELO USC-ISIE.ARPA
  1633. R: 250 BBN-VAX.ARPA
  1634. S: MAIL FROM:<@USC-ISIE.ARPA:JQP@MIT-AI.ARPA>
  1635. R: 250 OK
  1636. S: RCPT TO:<Jones@BBN-VAX.ARPA>
  1637. R: 250 OK
  1638. S: DATA
  1639. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1640. S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ;
  1641. 2 Nov 81 22:40:10 UT
  1642. S: Date: 2 Nov 81 22:33:44
  1643. S: From: John Q. Public <JQP@MIT-AI.ARPA>
  1644. S: Subject: The Next Meeting of the Board
  1645. S: To: Jones@BBN-Vax.ARPA
  1646. S:
  1647. S: Bill:
  1648. S: The next meeting of the board of directors will be
  1649. S: on Tuesday.
  1650. S: John.
  1651. S: .
  1652. R: 250 OK
  1653. S: QUIT
  1654. R: 221 USC-ISIE.ARPA Service closing transmission channel
  1655. Scenario 3
  1656. -------------------------------------------------------------
  1657. [Page 54] Postel
  1658. RFC 821 August 1982
  1659. Simple Mail Transfer Protocol
  1660. Verifying and Sending Scenario
  1661. -------------------------------------------------------------
  1662. R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
  1663. S: HELO MIT-MC.ARPA
  1664. R: 250 SU-SCORE.ARPA
  1665. S: VRFY Crispin
  1666. R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
  1667. S: SEND FROM:<EAK@MIT-MC.ARPA>
  1668. R: 250 OK
  1669. S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
  1670. R: 250 OK
  1671. S: DATA
  1672. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1673. S: Blah blah blah...
  1674. S: ...etc. etc. etc.
  1675. S: .
  1676. R: 250 OK
  1677. S: QUIT
  1678. R: 221 SU-SCORE.ARPA Service closing transmission channel
  1679. Scenario 4
  1680. -------------------------------------------------------------
  1681. Postel [Page 55]
  1682. August 1982 RFC 821
  1683. Simple Mail Transfer Protocol
  1684. Sending and Mailing Scenarios
  1685. First the user's name is verified, then an attempt is made to
  1686. send to the user's terminal. When that fails, the messages is
  1687. mailed to the user's mailbox.
  1688. -------------------------------------------------------------
  1689. R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
  1690. S: HELO MIT-MC.ARPA
  1691. R: 250 SU-SCORE.ARPA
  1692. S: VRFY Crispin
  1693. R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
  1694. S: SEND FROM:<EAK@MIT-MC.ARPA>
  1695. R: 250 OK
  1696. S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
  1697. R: 450 User not active now
  1698. S: RSET
  1699. R: 250 OK
  1700. S: MAIL FROM:<EAK@MIT-MC.ARPA>
  1701. R: 250 OK
  1702. S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
  1703. R: 250 OK
  1704. S: DATA
  1705. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1706. S: Blah blah blah...
  1707. S: ...etc. etc. etc.
  1708. S: .
  1709. R: 250 OK
  1710. S: QUIT
  1711. R: 221 SU-SCORE.ARPA Service closing transmission channel
  1712. Scenario 5
  1713. -------------------------------------------------------------
  1714. [Page 56] Postel
  1715. RFC 821 August 1982
  1716. Simple Mail Transfer Protocol
  1717. Doing the preceding scenario more efficiently.
  1718. -------------------------------------------------------------
  1719. R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
  1720. S: HELO MIT-MC.ARPA
  1721. R: 250 SU-SCORE.ARPA
  1722. S: VRFY Crispin
  1723. R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
  1724. S: SOML FROM:<EAK@MIT-MC.ARPA>
  1725. R: 250 OK
  1726. S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
  1727. R: 250 User not active now, so will do mail.
  1728. S: DATA
  1729. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1730. S: Blah blah blah...
  1731. S: ...etc. etc. etc.
  1732. S: .
  1733. R: 250 OK
  1734. S: QUIT
  1735. R: 221 SU-SCORE.ARPA Service closing transmission channel
  1736. Scenario 6
  1737. -------------------------------------------------------------
  1738. Postel [Page 57]
  1739. August 1982 RFC 821
  1740. Simple Mail Transfer Protocol
  1741. Mailing List Scenario
  1742. First each of two mailing lists are expanded in separate sessions
  1743. with different hosts. Then the message is sent to everyone that
  1744. appeared on either list (but no duplicates) via a relay host.
  1745. -------------------------------------------------------------
  1746. Step 1 -- Expanding the First List
  1747. R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready
  1748. S: HELO SU-SCORE.ARPA
  1749. R: 250 MIT-AI.ARPA
  1750. S: EXPN Example-People
  1751. R: 250-<ABC@MIT-MC.ARPA>
  1752. R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
  1753. R: 250-Xenon Y. Zither <XYZ@MIT-AI.ARPA>
  1754. R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  1755. R: 250-<joe@foo-unix.ARPA>
  1756. R: 250 <xyz@bar-unix.ARPA>
  1757. S: QUIT
  1758. R: 221 MIT-AI.ARPA Service closing transmission channel
  1759. [Page 58] Postel
  1760. RFC 821 August 1982
  1761. Simple Mail Transfer Protocol
  1762. Step 2 -- Expanding the Second List
  1763. R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready
  1764. S: HELO SU-SCORE.ARPA
  1765. R: 250 MIT-MC.ARPA
  1766. S: EXPN Interested-Parties
  1767. R: 250-Al Calico <ABC@MIT-MC.ARPA>
  1768. R: 250-<XYZ@MIT-AI.ARPA>
  1769. R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  1770. R: 250-<fred@BBN-UNIX.ARPA>
  1771. R: 250 <xyz@bar-unix.ARPA>
  1772. S: QUIT
  1773. R: 221 MIT-MC.ARPA Service closing transmission channel
  1774. Postel [Page 59]
  1775. August 1982 RFC 821
  1776. Simple Mail Transfer Protocol
  1777. Step 3 -- Mailing to All via a Relay Host
  1778. R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
  1779. S: HELO SU-SCORE.ARPA
  1780. R: 250 USC-ISIE.ARPA
  1781. S: MAIL FROM:<Account.Person@SU-SCORE.ARPA>
  1782. R: 250 OK
  1783. S: RCPT TO:<@USC-ISIE.ARPA:ABC@MIT-MC.ARPA>
  1784. R: 250 OK
  1785. S: RCPT TO:<@USC-ISIE.ARPA:Fonebone@USC-ISIQA.ARPA>
  1786. R: 250 OK
  1787. S: RCPT TO:<@USC-ISIE.ARPA:XYZ@MIT-AI.ARPA>
  1788. R: 250 OK
  1789. S: RCPT
  1790. TO:<@USC-ISIE.ARPA,@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  1791. R: 250 OK
  1792. S: RCPT TO:<@USC-ISIE.ARPA:joe@FOO-UNIX.ARPA>
  1793. R: 250 OK
  1794. S: RCPT TO:<@USC-ISIE.ARPA:xyz@BAR-UNIX.ARPA>
  1795. R: 250 OK
  1796. S: RCPT TO:<@USC-ISIE.ARPA:fred@BBN-UNIX.ARPA>
  1797. R: 250 OK
  1798. S: DATA
  1799. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1800. S: Blah blah blah...
  1801. S: ...etc. etc. etc.
  1802. S: .
  1803. R: 250 OK
  1804. S: QUIT
  1805. R: 221 USC-ISIE.ARPA Service closing transmission channel
  1806. Scenario 7
  1807. -------------------------------------------------------------
  1808. [Page 60] Postel
  1809. RFC 821 August 1982
  1810. Simple Mail Transfer Protocol
  1811. Forwarding Scenarios
  1812. -------------------------------------------------------------
  1813. R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready
  1814. S: HELO LBL-UNIX.ARPA
  1815. R: 250 USC-ISIF.ARPA
  1816. S: MAIL FROM:<mo@LBL-UNIX.ARPA>
  1817. R: 250 OK
  1818. S: RCPT TO:<fred@USC-ISIF.ARPA>
  1819. R: 251 User not local; will forward to <Jones@USC-ISI.ARPA>
  1820. S: DATA
  1821. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1822. S: Blah blah blah...
  1823. S: ...etc. etc. etc.
  1824. S: .
  1825. R: 250 OK
  1826. S: QUIT
  1827. R: 221 USC-ISIF.ARPA Service closing transmission channel
  1828. Scenario 8
  1829. -------------------------------------------------------------
  1830. Postel [Page 61]
  1831. August 1982 RFC 821
  1832. Simple Mail Transfer Protocol
  1833. -------------------------------------------------------------
  1834. Step 1 -- Trying the Mailbox at the First Host
  1835. R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready
  1836. S: HELO LBL-UNIX.ARPA
  1837. R: 250 USC-ISIF.ARPA
  1838. S: MAIL FROM:<mo@LBL-UNIX.ARPA>
  1839. R: 250 OK
  1840. S: RCPT TO:<fred@USC-ISIF.ARPA>
  1841. R: 251 User not local; will forward to <Jones@USC-ISI.ARPA>
  1842. S: RSET
  1843. R: 250 OK
  1844. S: QUIT
  1845. R: 221 USC-ISIF.ARPA Service closing transmission channel
  1846. Step 2 -- Delivering the Mail at the Second Host
  1847. R: 220 USC-ISI.ARPA Simple Mail Transfer Service Ready
  1848. S: HELO LBL-UNIX.ARPA
  1849. R: 250 USC-ISI.ARPA
  1850. S: MAIL FROM:<mo@LBL-UNIX.ARPA>
  1851. R: 250 OK
  1852. S: RCPT TO:<Jones@USC-ISI.ARPA>
  1853. R: OK
  1854. S: DATA
  1855. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1856. S: Blah blah blah...
  1857. S: ...etc. etc. etc.
  1858. S: .
  1859. R: 250 OK
  1860. S: QUIT
  1861. R: 221 USC-ISI.ARPA Service closing transmission channel
  1862. Scenario 9
  1863. -------------------------------------------------------------
  1864. [Page 62] Postel
  1865. RFC 821 August 1982
  1866. Simple Mail Transfer Protocol
  1867. Too Many Recipients Scenario
  1868. -------------------------------------------------------------
  1869. R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready
  1870. S: HELO USC-ISIF.ARPA
  1871. R: 250 BERKELEY.ARPA
  1872. S: MAIL FROM:<Postel@USC-ISIF.ARPA>
  1873. R: 250 OK
  1874. S: RCPT TO:<fabry@BERKELEY.ARPA>
  1875. R: 250 OK
  1876. S: RCPT TO:<eric@BERKELEY.ARPA>
  1877. R: 552 Recipient storage full, try again in another transaction
  1878. S: DATA
  1879. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1880. S: Blah blah blah...
  1881. S: ...etc. etc. etc.
  1882. S: .
  1883. R: 250 OK
  1884. S: MAIL FROM:<Postel@USC-ISIF.ARPA>
  1885. R: 250 OK
  1886. S: RCPT TO:<eric@BERKELEY.ARPA>
  1887. R: 250 OK
  1888. S: DATA
  1889. R: 354 Start mail input; end with <CRLF>.<CRLF>
  1890. S: Blah blah blah...
  1891. S: ...etc. etc. etc.
  1892. S: .
  1893. R: 250 OK
  1894. S: QUIT
  1895. R: 221 BERKELEY.ARPA Service closing transmission channel
  1896. Scenario 10
  1897. -------------------------------------------------------------
  1898. Note that a real implementation must handle many recipients as
  1899. specified in Section 4.5.3.
  1900. Postel [Page 63]
  1901. August 1982 RFC 821
  1902. Simple Mail Transfer Protocol
  1903. GLOSSARY
  1904. ASCII
  1905. American Standard Code for Information Interchange [1].
  1906. command
  1907. A request for a mail service action sent by the sender-SMTP to the
  1908. receiver-SMTP.
  1909. domain
  1910. The hierarchially structured global character string address of a
  1911. host computer in the mail system.
  1912. end of mail data indication
  1913. A special sequence of characters that indicates the end of the
  1914. mail data. In particular, the five characters carriage return,
  1915. line feed, period, carriage return, line feed, in that order.
  1916. host
  1917. A computer in the internetwork environment on which mailboxes or
  1918. SMTP processes reside.
  1919. line
  1920. A a sequence of ASCII characters ending with a <CRLF>.
  1921. mail data
  1922. A sequence of ASCII characters of arbitrary length, which conforms
  1923. to the standard set in the Standard for the Format of ARPA
  1924. Internet Text Messages (RFC 822 [2]).
  1925. mailbox
  1926. A character string (address) which identifies a user to whom mail
  1927. is to be sent. Mailbox normally consists of the host and user
  1928. specifications. The standard mailbox naming convention is defined
  1929. to be "user@domain". Additionally, the "container" in which mail
  1930. is stored.
  1931. [Page 64] Postel
  1932. RFC 821 August 1982
  1933. Simple Mail Transfer Protocol
  1934. receiver-SMTP process
  1935. A process which transfers mail in cooperation with a sender-SMTP
  1936. process. It waits for a connection to be established via the
  1937. transport service. It receives SMTP commands from the
  1938. sender-SMTP, sends replies, and performs the specified operations.
  1939. reply
  1940. A reply is an acknowledgment (positive or negative) sent from
  1941. receiver to sender via the transmission channel in response to a
  1942. command. The general form of a reply is a completion code
  1943. (including error codes) followed by a text string. The codes are
  1944. for use by programs and the text is usually intended for human
  1945. users.
  1946. sender-SMTP process
  1947. A process which transfers mail in cooperation with a receiver-SMTP
  1948. process. A local language may be used in the user interface
  1949. command/reply dialogue. The sender-SMTP initiates the transport
  1950. service connection. It initiates SMTP commands, receives replies,
  1951. and governs the transfer of mail.
  1952. session
  1953. The set of exchanges that occur while the transmission channel is
  1954. open.
  1955. transaction
  1956. The set of exchanges required for one message to be transmitted
  1957. for one or more recipients.
  1958. transmission channel
  1959. A full-duplex communication path between a sender-SMTP and a
  1960. receiver-SMTP for the exchange of commands, replies, and mail
  1961. text.
  1962. transport service
  1963. Any reliable stream-oriented data communication services. For
  1964. example, NCP, TCP, NITS.
  1965. Postel [Page 65]
  1966. August 1982 RFC 821
  1967. Simple Mail Transfer Protocol
  1968. user
  1969. A human being (or a process on behalf of a human being) wishing to
  1970. obtain mail transfer service. In addition, a recipient of
  1971. computer mail.
  1972. word
  1973. A sequence of printing characters.
  1974. <CRLF>
  1975. The characters carriage return and line feed (in that order).
  1976. <SP>
  1977. The space character.
  1978. [Page 66] Postel
  1979. RFC 821 August 1982
  1980. Simple Mail Transfer Protocol
  1981. REFERENCES
  1982. [1] ASCII
  1983. ASCII, "USA Code for Information Interchange", United States of
  1984. America Standards Institute, X3.4, 1968. Also in: Feinler, E.
  1985. and J. Postel, eds., "ARPANET Protocol Handbook", NIC 7104, for
  1986. the Defense Communications Agency by SRI International, Menlo
  1987. Park, California, Revised January 1978.
  1988. [2] RFC 822
  1989. Crocker, D., "Standard for the Format of ARPA Internet Text
  1990. Messages," RFC 822, Department of Electrical Engineering,
  1991. University of Delaware, August 1982.
  1992. [3] TCP
  1993. Postel, J., ed., "Transmission Control Protocol - DARPA Internet
  1994. Program Protocol Specification", RFC 793, USC/Information Sciences
  1995. Institute, NTIS AD Number A111091, September 1981. Also in:
  1996. Feinler, E. and J. Postel, eds., "Internet Protocol Transition
  1997. Workbook", SRI International, Menlo Park, California, March 1982.
  1998. [4] NCP
  1999. McKenzie,A., "Host/Host Protocol for the ARPA Network", NIC 8246,
  2000. January 1972. Also in: Feinler, E. and J. Postel, eds., "ARPANET
  2001. Protocol Handbook", NIC 7104, for the Defense Communications
  2002. Agency by SRI International, Menlo Park, California, Revised
  2003. January 1978.
  2004. [5] Initial Connection Protocol
  2005. Postel, J., "Official Initial Connection Protocol", NIC 7101,
  2006. 11 June 1971. Also in: Feinler, E. and J. Postel, eds., "ARPANET
  2007. Protocol Handbook", NIC 7104, for the Defense Communications
  2008. Agency by SRI International, Menlo Park, California, Revised
  2009. January 1978.
  2010. [6] NITS
  2011. PSS/SG3, "A Network Independent Transport Service", Study Group 3,
  2012. The Post Office PSS Users Group, February 1980. Available from
  2013. the DCPU, National Physical Laboratory, Teddington, UK.
  2014. Postel [Page 67]
  2015. August 1982 RFC 821
  2016. Simple Mail Transfer Protocol
  2017. [7] X.25
  2018. CCITT, "Recommendation X.25 - Interface Between Data Terminal
  2019. Equipment (DTE) and Data Circuit-terminating Equipment (DCE) for
  2020. Terminals Operating in the Packet Mode on Public Data Networks,"
  2021. CCITT Orange Book, Vol. VIII.2, International Telephone and
  2022. Telegraph Consultative Committee, Geneva, 1976.
  2023. [Page 68] Postel