Debian Codegraph @

rfc821.html

raw
1 <pre> <a href="./rfc821">RFC 821</a>
2
3
4
5
6
7 SIMPLE MAIL TRANSFER PROTOCOL
8
9
10
11 Jonathan B. Postel
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 August 1982
42
43
44
45 Information Sciences Institute
46 University of Southern California
47 4676 Admiralty Way
48 Marina del Rey, California 90291
49
50 (213) 822-1511</pre>
51 <hr class='noprint'/><!--NewPage--><pre class='newpage'></pre>
52 <hr class='noprint'/><!--NewPage--><pre class='newpage'><a href="./rfc821">RFC 821</a> August 1982
53 Simple Mail Transfer Protocol
54
55
56
57 TABLE OF CONTENTS
58
59 <a href="#section-1">1</a>. INTRODUCTION .................................................. <a href="#page-1">1</a>
60
61 <a href="#section-2">2</a>. THE SMTP MODEL ................................................ <a href="#page-2">2</a>
62
63 <a href="#section-3">3</a>. THE SMTP PROCEDURE ............................................ <a href="#page-4">4</a>
64
65 <a href="#section-3.1">3.1</a>. Mail ..................................................... <a href="#page-4">4</a>
66 <a href="#section-3.2">3.2</a>. Forwarding ............................................... <a href="#page-7">7</a>
67 <a href="#section-3.3">3.3</a>. Verifying and Expanding .................................. <a href="#page-8">8</a>
68 <a href="#section-3.4">3.4</a>. Sending and Mailing ..................................... <a href="#page-11">11</a>
69 <a href="#section-3.5">3.5</a>. Opening and Closing ..................................... <a href="#page-13">13</a>
70 <a href="#section-3.6">3.6</a>. Relaying ................................................ <a href="#page-14">14</a>
71 <a href="#section-3.7">3.7</a>. Domains ................................................. <a href="#page-17">17</a>
72 <a href="#section-3.8">3.8</a>. Changing Roles .......................................... <a href="#page-18">18</a>
73
74 <a href="#section-4">4</a>. THE SMTP SPECIFICATIONS ...................................... <a href="#page-19">19</a>
75
76 <a href="#section-4.1">4.1</a>. SMTP Commands ........................................... <a href="#page-19">19</a>
77 <a href="#section-4.1.1">4.1.1</a>. Command Semantics ..................................... <a href="#page-19">19</a>
78 <a href="#section-4.1.2">4.1.2</a>. Command Syntax ........................................ <a href="#page-27">27</a>
79 <a href="#section-4.2">4.2</a>. SMTP Replies ............................................ <a href="#page-34">34</a>
80 <a href="#section-4.2.1">4.2.1</a>. Reply Codes by Function Group ......................... <a href="#page-35">35</a>
81 <a href="#section-4.2.2">4.2.2</a>. Reply Codes in Numeric Order .......................... <a href="#page-36">36</a>
82 <a href="#section-4.3">4.3</a>. Sequencing of Commands and Replies ...................... <a href="#page-37">37</a>
83 <a href="#section-4.4">4.4</a>. State Diagrams .......................................... <a href="#page-39">39</a>
84 <a href="#section-4.5">4.5</a>. Details ................................................. <a href="#page-41">41</a>
85 <a href="#section-4.5.1">4.5.1</a>. Minimum Implementation ................................ <a href="#page-41">41</a>
86 <a href="#section-4.5.2">4.5.2</a>. Transparency .......................................... <a href="#page-41">41</a>
87 <a href="#section-4.5.3">4.5.3</a>. Sizes ................................................. <a href="#page-42">42</a>
88
89 APPENDIX A: TCP ................................................. <a href="#page-44">44</a>
90 APPENDIX B: NCP ................................................. <a href="#page-45">45</a>
91 APPENDIX C: NITS ................................................ <a href="#page-46">46</a>
92 APPENDIX D: X.25 ................................................ <a href="#page-47">47</a>
93 APPENDIX E: Theory of Reply Codes ............................... <a href="#page-48">48</a>
94 APPENDIX F: Scenarios ........................................... <a href="#page-51">51</a>
95
96 GLOSSARY ......................................................... <a href="#page-64">64</a>
97
98 REFERENCES ....................................................... <a href="#page-67">67</a></pre>
99 <hr class='noprint'/><!--NewPage--><pre class='newpage'></pre>
100 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-1" ></span>
101 Network Working Group J. Postel
102 Request for Comments: DRAFT ISI
103 Replaces: <a href="./rfc788">RFC 788</a>, 780, 772 August 1982
104
105 SIMPLE MAIL TRANSFER PROTOCOL
106
107
108 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. INTRODUCTION</span>
109
110 The objective of Simple Mail Transfer Protocol (SMTP) is to transfer
111 mail reliably and efficiently.
112
113 SMTP is independent of the particular transmission subsystem and
114 requires only a reliable ordered data stream channel. Appendices A,
115 B, C, and D describe the use of SMTP with various transport services.
116 A Glossary provides the definitions of terms as used in this
117 document.
118
119 An important feature of SMTP is its capability to relay mail across
120 transport service environments. A transport service provides an
121 interprocess communication environment (IPCE). An IPCE may cover one
122 network, several networks, or a subset of a network. It is important
123 to realize that transport systems (or IPCEs) are not one-to-one with
124 networks. A process can communicate directly with another process
125 through any mutually known IPCE. Mail is an application or use of
126 interprocess communication. Mail can be communicated between
127 processes in different IPCEs by relaying through a process connected
128 to two (or more) IPCEs. More specifically, mail can be relayed
129 between hosts on different transport systems by a host on both
130 transport systems.
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155 <span class="grey">Postel [Page 1]</span></pre>
156 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
157 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
158 Simple Mail Transfer Protocol
159
160
161
162 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. THE SMTP MODEL</span>
163
164 The SMTP design is based on the following model of communication: as
165 the result of a user mail request, the sender-SMTP establishes a
166 two-way transmission channel to a receiver-SMTP. The receiver-SMTP
167 may be either the ultimate destination or an intermediate. SMTP
168 commands are generated by the sender-SMTP and sent to the
169 receiver-SMTP. SMTP replies are sent from the receiver-SMTP to the
170 sender-SMTP in response to the commands.
171
172 Once the transmission channel is established, the SMTP-sender sends a
173 MAIL command indicating the sender of the mail. If the SMTP-receiver
174 can accept mail it responds with an OK reply. The SMTP-sender then
175 sends a RCPT command identifying a recipient of the mail. If the
176 SMTP-receiver can accept mail for that recipient it responds with an
177 OK reply; if not, it responds with a reply rejecting that recipient
178 (but not the whole mail transaction). The SMTP-sender and
179 SMTP-receiver may negotiate several recipients. When the recipients
180 have been negotiated the SMTP-sender sends the mail data, terminating
181 with a special sequence. If the SMTP-receiver successfully processes
182 the mail data it responds with an OK reply. The dialog is purposely
183 lock-step, one-at-a-time.
184
185 -------------------------------------------------------------
186
187
188 +----------+ +----------+
189 +------+ | | | |
190 | User |&lt;--&gt;| | SMTP | |
191 +------+ | Sender- |Commands/Replies| Receiver-|
192 +------+ | SMTP |&lt;--------------&gt;| SMTP | +------+
193 | File |&lt;--&gt;| | and Mail | |&lt;--&gt;| File |
194 |System| | | | | |System|
195 +------+ +----------+ +----------+ +------+
196
197
198 Sender-SMTP Receiver-SMTP
199
200 Model for SMTP Use
201
202 Figure 1
203
204 -------------------------------------------------------------
205
206 The SMTP provides mechanisms for the transmission of mail; directly
207 from the sending user's host to the receiving user's host when the
208
209
210
211 [Page 2] Postel</pre>
212 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
213 <a href="./rfc821">RFC 821</a> August 1982
214 Simple Mail Transfer Protocol
215
216
217
218 two host are connected to the same transport service, or via one or
219 more relay SMTP-servers when the source and destination hosts are not
220 connected to the same transport service.
221
222 To be able to provide the relay capability the SMTP-server must be
223 supplied with the name of the ultimate destination host as well as
224 the destination mailbox name.
225
226 The argument to the MAIL command is a reverse-path, which specifies
227 who the mail is from. The argument to the RCPT command is a
228 forward-path, which specifies who the mail is to. The forward-path
229 is a source route, while the reverse-path is a return route (which
230 may be used to return a message to the sender when an error occurs
231 with a relayed message).
232
233 When the same message is sent to multiple recipients the SMTP
234 encourages the transmission of only one copy of the data for all the
235 recipients at the same destination host.
236
237 The mail commands and replies have a rigid syntax. Replies also have
238 a numeric code. In the following, examples appear which use actual
239 commands and replies. The complete lists of commands and replies
240 appears in <a href="#section-4">Section 4</a> on specifications.
241
242 Commands and replies are not case sensitive. That is, a command or
243 reply word may be upper case, lower case, or any mixture of upper and
244 lower case. Note that this is not true of mailbox user names. For
245 some hosts the user name is case sensitive, and SMTP implementations
246 must take case to preserve the case of user names as they appear in
247 mailbox arguments. Host names are not case sensitive.
248
249 Commands and replies are composed of characters from the ASCII
250 character set [<a href="#ref-1">1</a>]. When the transport service provides an 8-bit byte
251 (octet) transmission channel, each 7-bit character is transmitted
252 right justified in an octet with the high order bit cleared to zero.
253
254 When specifying the general form of a command or reply, an argument
255 (or special symbol) will be denoted by a meta-linguistic variable (or
256 constant), for example, "&lt;string&gt;" or "&lt;reverse-path&gt;". Here the
257 angle brackets indicate these are meta-linguistic variables.
258 However, some arguments use the angle brackets literally. For
259 example, an actual reverse-path is enclosed in angle brackets, i.e.,
260 "&lt;[email protected]&gt;" is an instance of &lt;reverse-path&gt; (the
261 angle brackets are actually transmitted in the command or reply).
262
263
264
265
266
267 <span class="grey">Postel [Page 3]</span></pre>
268 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
269 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
270 Simple Mail Transfer Protocol
271
272
273
274 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. THE SMTP PROCEDURES</span>
275
276 This section presents the procedures used in SMTP in several parts.
277 First comes the basic mail procedure defined as a mail transaction.
278 Following this are descriptions of forwarding mail, verifying mailbox
279 names and expanding mailing lists, sending to terminals instead of or
280 in combination with mailboxes, and the opening and closing exchanges.
281 At the end of this section are comments on relaying, a note on mail
282 domains, and a discussion of changing roles. Throughout this section
283 are examples of partial command and reply sequences, several complete
284 scenarios are presented in <a href="#appendix-F">Appendix F</a>.
285
286 3.1. MAIL
287
288 There are three steps to SMTP mail transactions. The transaction
289 is started with a MAIL command which gives the sender
290 identification. A series of one or more RCPT commands follows
291 giving the receiver information. Then a DATA command gives the
292 mail data. And finally, the end of mail data indicator confirms
293 the transaction.
294
295 The first step in the procedure is the MAIL command. The
296 &lt;reverse-path&gt; contains the source mailbox.
297
298 MAIL &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
299
300 This command tells the SMTP-receiver that a new mail
301 transaction is starting and to reset all its state tables and
302 buffers, including any recipients or mail data. It gives the
303 reverse-path which can be used to report errors. If accepted,
304 the receiver-SMTP returns a 250 OK reply.
305
306 The &lt;reverse-path&gt; can contain more than just a mailbox. The
307 &lt;reverse-path&gt; is a reverse source routing list of hosts and
308 source mailbox. The first host in the &lt;reverse-path&gt; should be
309 the host sending this command.
310
311 The second step in the procedure is the RCPT command.
312
313 RCPT &lt;SP&gt; TO:&lt;forward-path&gt; &lt;CRLF&gt;
314
315 This command gives a forward-path identifying one recipient.
316 If accepted, the receiver-SMTP returns a 250 OK reply, and
317 stores the forward-path. If the recipient is unknown the
318 receiver-SMTP returns a 550 Failure reply. This second step of
319 the procedure can be repeated any number of times.
320
321
322
323 [Page 4] Postel</pre>
324 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
325 <a href="./rfc821">RFC 821</a> August 1982
326 Simple Mail Transfer Protocol
327
328
329
330 The &lt;forward-path&gt; can contain more than just a mailbox. The
331 &lt;forward-path&gt; is a source routing list of hosts and the
332 destination mailbox. The first host in the &lt;forward-path&gt;
333 should be the host receiving this command.
334
335 The third step in the procedure is the DATA command.
336
337 DATA &lt;CRLF&gt;
338
339 If accepted, the receiver-SMTP returns a 354 Intermediate reply
340 and considers all succeeding lines to be the message text.
341 When the end of text is received and stored the SMTP-receiver
342 sends a 250 OK reply.
343
344 Since the mail data is sent on the transmission channel the end
345 of the mail data must be indicated so that the command and
346 reply dialog can be resumed. SMTP indicates the end of the
347 mail data by sending a line containing only a period. A
348 transparency procedure is used to prevent this from interfering
349 with the user's text (see <a href="#section-4.5.2">Section 4.5.2</a>).
350
351 Please note that the mail data includes the memo header
352 items such as Date, Subject, To, Cc, From [<a href="#ref-2">2</a>].
353
354 The end of mail data indicator also confirms the mail
355 transaction and tells the receiver-SMTP to now process the
356 stored recipients and mail data. If accepted, the
357 receiver-SMTP returns a 250 OK reply. The DATA command should
358 fail only if the mail transaction was incomplete (for example,
359 no recipients), or if resources are not available.
360
361 The above procedure is an example of a mail transaction. These
362 commands must be used only in the order discussed above.
363 Example 1 (below) illustrates the use of these commands in a mail
364 transaction.
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379 <span class="grey">Postel [Page 5]</span></pre>
380 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
381 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
382 Simple Mail Transfer Protocol
383
384
385
386 -------------------------------------------------------------
387
388 Example of the SMTP Procedure
389
390 This SMTP example shows mail sent by Smith at host Alpha.ARPA,
391 to Jones, Green, and Brown at host Beta.ARPA. Here we assume
392 that host Alpha contacts host Beta directly.
393
394 S: MAIL FROM:&lt;[email protected]&gt;
395 R: 250 OK
396
397 S: RCPT TO:&lt;[email protected]&gt;
398 R: 250 OK
399
400 S: RCPT TO:&lt;[email protected]&gt;
401 R: 550 No such user here
402
403 S: RCPT TO:&lt;[email protected]&gt;
404 R: 250 OK
405
406 S: DATA
407 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
408 S: Blah blah blah...
409 S: ...etc. etc. etc.
410 S: &lt;CRLF&gt;.&lt;CRLF&gt;
411 R: 250 OK
412
413 The mail has now been accepted for Jones and Brown. Green did
414 not have a mailbox at host Beta.
415
416 Example 1
417
418 -------------------------------------------------------------
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435 [Page 6] Postel</pre>
436 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
437 <a href="./rfc821">RFC 821</a> August 1982
438 Simple Mail Transfer Protocol
439
440
441
442 3.2. FORWARDING
443
444 There are some cases where the destination information in the
445 &lt;forward-path&gt; is incorrect, but the receiver-SMTP knows the
446 correct destination. In such cases, one of the following replies
447 should be used to allow the sender to contact the correct
448 destination.
449
450 251 User not local; will forward to &lt;forward-path&gt;
451
452 This reply indicates that the receiver-SMTP knows the user's
453 mailbox is on another host and indicates the correct
454 forward-path to use in the future. Note that either the
455 host or user or both may be different. The receiver takes
456 responsibility for delivering the message.
457
458 551 User not local; please try &lt;forward-path&gt;
459
460 This reply indicates that the receiver-SMTP knows the user's
461 mailbox is on another host and indicates the correct
462 forward-path to use. Note that either the host or user or
463 both may be different. The receiver refuses to accept mail
464 for this user, and the sender must either redirect the mail
465 according to the information provided or return an error
466 response to the originating user.
467
468 Example 2 illustrates the use of these responses.
469
470 -------------------------------------------------------------
471
472 Example of Forwarding
473
474 Either
475
476 S: RCPT TO:&lt;[email protected]&gt;
477 R: 251 User not local; will forward to &lt;[email protected]&gt;
478
479 Or
480
481 S: RCPT TO:&lt;[email protected]&gt;
482 R: 551 User not local; please try &lt;[email protected]&gt;
483
484 Example 2
485
486 -------------------------------------------------------------
487
488
489
490
491 <span class="grey">Postel [Page 7]</span></pre>
492 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
493 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
494 Simple Mail Transfer Protocol
495
496
497
498 3.3. VERIFYING AND EXPANDING
499
500 SMTP provides as additional features, commands to verify a user
501 name or expand a mailing list. This is done with the VRFY and
502 EXPN commands, which have character string arguments. For the
503 VRFY command, the string is a user name, and the response may
504 include the full name of the user and must include the mailbox of
505 the user. For the EXPN command, the string identifies a mailing
506 list, and the multiline response may include the full name of the
507 users and must give the mailboxes on the mailing list.
508
509 "User name" is a fuzzy term and used purposely. If a host
510 implements the VRFY or EXPN commands then at least local mailboxes
511 must be recognized as "user names". If a host chooses to
512 recognize other strings as "user names" that is allowed.
513
514 In some hosts the distinction between a mailing list and an alias
515 for a single mailbox is a bit fuzzy, since a common data structure
516 may hold both types of entries, and it is possible to have mailing
517 lists of one mailbox. If a request is made to verify a mailing
518 list a positive response can be given if on receipt of a message
519 so addressed it will be delivered to everyone on the list,
520 otherwise an error should be reported (e.g., "550 That is a
521 mailing list, not a user"). If a request is made to expand a user
522 name a positive response can be formed by returning a list
523 containing one name, or an error can be reported (e.g., "550 That
524 is a user name, not a mailing list").
525
526 In the case of a multiline reply (normal for EXPN) exactly one
527 mailbox is to be specified on each line of the reply. In the case
528 of an ambiguous request, for example, "VRFY Smith", where there
529 are two Smith's the response must be "553 User ambiguous".
530
531 The case of verifying a user name is straightforward as shown in
532 example 3.
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547 [Page 8] Postel</pre>
548 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
549 <a href="./rfc821">RFC 821</a> August 1982
550 Simple Mail Transfer Protocol
551
552
553
554 -------------------------------------------------------------
555
556 Example of Verifying a User Name
557
558 Either
559
560 S: VRFY Smith
561 R: 250 Fred Smith &lt;[email protected]&gt;
562
563 Or
564
565 S: VRFY Smith
566 R: 251 User not local; will forward to &lt;[email protected]&gt;
567
568 Or
569
570 S: VRFY Jones
571 R: 550 String does not match anything.
572
573 Or
574
575 S: VRFY Jones
576 R: 551 User not local; please try &lt;[email protected]&gt;
577
578 Or
579
580 S: VRFY Gourzenkyinplatz
581 R: 553 User ambiguous.
582
583 Example 3
584
585 -------------------------------------------------------------
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603 <span class="grey">Postel [Page 9]</span></pre>
604 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
605 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
606 Simple Mail Transfer Protocol
607
608
609
610 The case of expanding a mailbox list requires a multiline reply as
611 shown in example 4.
612
613 -------------------------------------------------------------
614
615 Example of Expanding a Mailing List
616
617 Either
618
619 S: EXPN Example-People
620 R: 250-Jon Postel &lt;[email protected]&gt;
621 R: 250-Fred Fonebone &lt;[email protected]&gt;
622 R: 250-Sam Q. Smith &lt;[email protected]&gt;
623 R: 250-Quincy Smith &lt;@USC-ISIF.ARPA:[email protected]&gt;
624 R: 250-&lt;[email protected]&gt;
625 R: 250 &lt;[email protected]&gt;
626
627 Or
628
629 S: EXPN Executive-Washroom-List
630 R: 550 Access Denied to You.
631
632 Example 4
633
634 -------------------------------------------------------------
635
636 The character string arguments of the VRFY and EXPN commands
637 cannot be further restricted due to the variety of implementations
638 of the user name and mailbox list concepts. On some systems it
639 may be appropriate for the argument of the EXPN command to be a
640 file name for a file containing a mailing list, but again there is
641 a variety of file naming conventions in the Internet.
642
643 The VRFY and EXPN commands are not included in the minimum
644 implementation (<a href="#section-4.5.1">Section 4.5.1</a>), and are not required to work
645 across relays when they are implemented.
646
647
648
649
650
651
652
653
654
655
656
657
658
659 [Page 10] Postel</pre>
660 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
661 <a href="./rfc821">RFC 821</a> August 1982
662 Simple Mail Transfer Protocol
663
664
665
666 3.4. SENDING AND MAILING
667
668 The main purpose of SMTP is to deliver messages to user's
669 mailboxes. A very similar service provided by some hosts is to
670 deliver messages to user's terminals (provided the user is active
671 on the host). The delivery to the user's mailbox is called
672 "mailing", the delivery to the user's terminal is called
673 "sending". Because in many hosts the implementation of sending is
674 nearly identical to the implementation of mailing these two
675 functions are combined in SMTP. However the sending commands are
676 not included in the required minimum implementation
677 (<a href="#section-4.5.1">Section 4.5.1</a>). Users should have the ability to control the
678 writing of messages on their terminals. Most hosts permit the
679 users to accept or refuse such messages.
680
681 The following three command are defined to support the sending
682 options. These are used in the mail transaction instead of the
683 MAIL command and inform the receiver-SMTP of the special semantics
684 of this transaction:
685
686 SEND &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
687
688 The SEND command requires that the mail data be delivered to
689 the user's terminal. If the user is not active (or not
690 accepting terminal messages) on the host a 450 reply may
691 returned to a RCPT command. The mail transaction is
692 successful if the message is delivered the terminal.
693
694 SOML &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
695
696 The Send Or MaiL command requires that the mail data be
697 delivered to the user's terminal if the user is active (and
698 accepting terminal messages) on the host. If the user is
699 not active (or not accepting terminal messages) then the
700 mail data is entered into the user's mailbox. The mail
701 transaction is successful if the message is delivered either
702 to the terminal or the mailbox.
703
704 SAML &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
705
706 The Send And MaiL command requires that the mail data be
707 delivered to the user's terminal if the user is active (and
708 accepting terminal messages) on the host. In any case the
709 mail data is entered into the user's mailbox. The mail
710 transaction is successful if the message is delivered the
711 mailbox.
712
713
714
715 <span class="grey">Postel [Page 11]</span></pre>
716 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
717 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
718 Simple Mail Transfer Protocol
719
720
721
722 The same reply codes that are used for the MAIL commands are used
723 for these commands.
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771 [Page 12] Postel</pre>
772 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
773 <a href="./rfc821">RFC 821</a> August 1982
774 Simple Mail Transfer Protocol
775
776
777
778 3.5. OPENING AND CLOSING
779
780 At the time the transmission channel is opened there is an
781 exchange to ensure that the hosts are communicating with the hosts
782 they think they are.
783
784 The following two commands are used in transmission channel
785 opening and closing:
786
787 HELO &lt;SP&gt; &lt;domain&gt; &lt;CRLF&gt;
788
789 QUIT &lt;CRLF&gt;
790
791 In the HELO command the host sending the command identifies
792 itself; the command may be interpreted as saying "Hello, I am
793 &lt;domain&gt;".
794
795 -------------------------------------------------------------
796
797 Example of Connection Opening
798
799 R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
800 S: HELO USC-ISIF.ARPA
801 R: 250 BBN-UNIX.ARPA
802
803 Example 5
804
805 -------------------------------------------------------------
806
807 -------------------------------------------------------------
808
809 Example of Connection Closing
810
811 S: QUIT
812 R: 221 BBN-UNIX.ARPA Service closing transmission channel
813
814 Example 6
815
816 -------------------------------------------------------------
817
818
819
820
821
822
823
824
825
826
827 <span class="grey">Postel [Page 13]</span></pre>
828 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
829 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
830 Simple Mail Transfer Protocol
831
832
833
834 3.6. RELAYING
835
836 The forward-path may be a source route of the form
837 "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE are hosts. This
838 form is used to emphasize the distinction between an address and a
839 route. The mailbox is an absolute address, and the route is
840 information about how to get there. The two concepts should not
841 be confused.
842
843 Conceptually the elements of the forward-path are moved to the
844 reverse-path as the message is relayed from one server-SMTP to
845 another. The reverse-path is a reverse source route, (i.e., a
846 source route from the current location of the message to the
847 originator of the message). When a server-SMTP deletes its
848 identifier from the forward-path and inserts it into the
849 reverse-path, it must use the name it is known by in the
850 environment it is sending into, not the environment the mail came
851 from, in case the server-SMTP is known by different names in
852 different environments.
853
854 If when the message arrives at an SMTP the first element of the
855 forward-path is not the identifier of that SMTP the element is not
856 deleted from the forward-path and is used to determine the next
857 SMTP to send the message to. In any case, the SMTP adds its own
858 identifier to the reverse-path.
859
860 Using source routing the receiver-SMTP receives mail to be relayed
861 to another server-SMTP The receiver-SMTP may accept or reject the
862 task of relaying the mail in the same way it accepts or rejects
863 mail for a local user. The receiver-SMTP transforms the command
864 arguments by moving its own identifier from the forward-path to
865 the beginning of the reverse-path. The receiver-SMTP then becomes
866 a sender-SMTP, establishes a transmission channel to the next SMTP
867 in the forward-path, and sends it the mail.
868
869 The first host in the reverse-path should be the host sending the
870 SMTP commands, and the first host in the forward-path should be
871 the host receiving the SMTP commands.
872
873 Notice that the forward-path and reverse-path appear in the SMTP
874 commands and replies, but not necessarily in the message. That
875 is, there is no need for these paths and especially this syntax to
876 appear in the "To:" , "From:", "CC:", etc. fields of the message
877 header.
878
879 If a server-SMTP has accepted the task of relaying the mail and
880
881
882
883 [Page 14] Postel</pre>
884 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
885 <a href="./rfc821">RFC 821</a> August 1982
886 Simple Mail Transfer Protocol
887
888
889
890 later finds that the forward-path is incorrect or that the mail
891 cannot be delivered for whatever reason, then it must construct an
892 "undeliverable mail" notification message and send it to the
893 originator of the undeliverable mail (as indicated by the
894 reverse-path).
895
896 This notification message must be from the server-SMTP at this
897 host. Of course, server-SMTPs should not send notification
898 messages about problems with notification messages. One way to
899 prevent loops in error reporting is to specify a null reverse-path
900 in the MAIL command of a notification message. When such a
901 message is relayed it is permissible to leave the reverse-path
902 null. A MAIL command with a null reverse-path appears as follows:
903
904 MAIL FROM:&lt;&gt;
905
906 An undeliverable mail notification message is shown in example 7.
907 This notification is in response to a message originated by JOE at
908 HOSTW and sent via HOSTX to HOSTY with instructions to relay it on
909 to HOSTZ. What we see in the example is the transaction between
910 HOSTY and HOSTX, which is the first step in the return of the
911 notification message.
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939 <span class="grey">Postel [Page 15]</span></pre>
940 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
941 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
942 Simple Mail Transfer Protocol
943
944
945
946 -------------------------------------------------------------
947
948 Example Undeliverable Mail Notification Message
949
950 S: MAIL FROM:&lt;&gt;
951 R: 250 ok
952 S: RCPT TO:&lt;@HOSTX.ARPA:[email protected]&gt;
953 R: 250 ok
954 S: DATA
955 R: 354 send the mail data, end with .
956 S: Date: 23 Oct 81 11:22:33
957 S: From: [email protected]
958 S: To: [email protected]
959 S: Subject: Mail System Problem
960 S:
961 S: Sorry JOE, your message to [email protected] lost.
962 S: HOSTZ.ARPA said this:
963 S: "550 No Such User"
964 S: .
965 R: 250 ok
966
967 Example 7
968
969 -------------------------------------------------------------
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995 [Page 16] Postel</pre>
996 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
997 <a href="./rfc821">RFC 821</a> August 1982
998 Simple Mail Transfer Protocol
999
1000
1001
1002 3.7. DOMAINS
1003
1004 Domains are a recently introduced concept in the ARPA Internet
1005 mail system. The use of domains changes the address space from a
1006 flat global space of simple character string host names to a
1007 hierarchically structured rooted tree of global addresses. The
1008 host name is replaced by a domain and host designator which is a
1009 sequence of domain element strings separated by periods with the
1010 understanding that the domain elements are ordered from the most
1011 specific to the most general.
1012
1013 For example, "USC-ISIF.ARPA", "Fred.Cambridge.UK", and
1014 "PC7.LCS.MIT.ARPA" might be host-and-domain identifiers.
1015
1016 Whenever domain names are used in SMTP only the official names are
1017 used, the use of nicknames or aliases is not allowed.
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051 <span class="grey">Postel [Page 17]</span></pre>
1052 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
1053 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1054 Simple Mail Transfer Protocol
1055
1056
1057
1058 3.8. CHANGING ROLES
1059
1060 The TURN command may be used to reverse the roles of the two
1061 programs communicating over the transmission channel.
1062
1063 If program-A is currently the sender-SMTP and it sends the TURN
1064 command and receives an ok reply (250) then program-A becomes the
1065 receiver-SMTP.
1066
1067 If program-B is currently the receiver-SMTP and it receives the
1068 TURN command and sends an ok reply (250) then program-B becomes
1069 the sender-SMTP.
1070
1071 To refuse to change roles the receiver sends the 502 reply.
1072
1073 Please note that this command is optional. It would not normally
1074 be used in situations where the transmission channel is TCP.
1075 However, when the cost of establishing the transmission channel is
1076 high, this command may be quite useful. For example, this command
1077 may be useful in supporting be mail exchange using the public
1078 switched telephone system as a transmission channel, especially if
1079 some hosts poll other hosts for mail exchanges.
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107 [Page 18] Postel</pre>
1108 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
1109 <a href="./rfc821">RFC 821</a> August 1982
1110 Simple Mail Transfer Protocol
1111
1112
1113
1114 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. THE SMTP SPECIFICATIONS</span>
1115
1116 4.1. SMTP COMMANDS
1117
1118 4.1.1. COMMAND SEMANTICS
1119
1120 The SMTP commands define the mail transfer or the mail system
1121 function requested by the user. SMTP commands are character
1122 strings terminated by &lt;CRLF&gt;. The command codes themselves are
1123 alphabetic characters terminated by &lt;SP&gt; if parameters follow
1124 and &lt;CRLF&gt; otherwise. The syntax of mailboxes must conform to
1125 receiver site conventions. The SMTP commands are discussed
1126 below. The SMTP replies are discussed in the <a href="#section-4.2">Section 4.2</a>.
1127
1128 A mail transaction involves several data objects which are
1129 communicated as arguments to different commands. The
1130 reverse-path is the argument of the MAIL command, the
1131 forward-path is the argument of the RCPT command, and the mail
1132 data is the argument of the DATA command. These arguments or
1133 data objects must be transmitted and held pending the
1134 confirmation communicated by the end of mail data indication
1135 which finalizes the transaction. The model for this is that
1136 distinct buffers are provided to hold the types of data
1137 objects, that is, there is a reverse-path buffer, a
1138 forward-path buffer, and a mail data buffer. Specific commands
1139 cause information to be appended to a specific buffer, or cause
1140 one or more buffers to be cleared.
1141
1142 HELLO (HELO)
1143
1144 This command is used to identify the sender-SMTP to the
1145 receiver-SMTP. The argument field contains the host name of
1146 the sender-SMTP.
1147
1148 The receiver-SMTP identifies itself to the sender-SMTP in
1149 the connection greeting reply, and in the response to this
1150 command.
1151
1152 This command and an OK reply to it confirm that both the
1153 sender-SMTP and the receiver-SMTP are in the initial state,
1154 that is, there is no transaction in progress and all state
1155 tables and buffers are cleared.
1156
1157
1158
1159
1160
1161
1162
1163 <span class="grey">Postel [Page 19]</span></pre>
1164 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
1165 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1166 Simple Mail Transfer Protocol
1167
1168
1169
1170 MAIL (MAIL)
1171
1172 This command is used to initiate a mail transaction in which
1173 the mail data is delivered to one or more mailboxes. The
1174 argument field contains a reverse-path.
1175
1176 The reverse-path consists of an optional list of hosts and
1177 the sender mailbox. When the list of hosts is present, it
1178 is a "reverse" source route and indicates that the mail was
1179 relayed through each host on the list (the first host in the
1180 list was the most recent relay). This list is used as a
1181 source route to return non-delivery notices to the sender.
1182 As each relay host adds itself to the beginning of the list,
1183 it must use its name as known in the IPCE to which it is
1184 relaying the mail rather than the IPCE from which the mail
1185 came (if they are different). In some types of error
1186 reporting messages (for example, undeliverable mail
1187 notifications) the reverse-path may be null (see Example 7).
1188
1189 This command clears the reverse-path buffer, the
1190 forward-path buffer, and the mail data buffer; and inserts
1191 the reverse-path information from this command into the
1192 reverse-path buffer.
1193
1194 RECIPIENT (RCPT)
1195
1196 This command is used to identify an individual recipient of
1197 the mail data; multiple recipients are specified by multiple
1198 use of this command.
1199
1200 The forward-path consists of an optional list of hosts and a
1201 required destination mailbox. When the list of hosts is
1202 present, it is a source route and indicates that the mail
1203 must be relayed to the next host on the list. If the
1204 receiver-SMTP does not implement the relay function it may
1205 user the same reply it would for an unknown local user
1206 (550).
1207
1208 When mail is relayed, the relay host must remove itself from
1209 the beginning forward-path and put itself at the beginning
1210 of the reverse-path. When mail reaches its ultimate
1211 destination (the forward-path contains only a destination
1212 mailbox), the receiver-SMTP inserts it into the destination
1213 mailbox in accordance with its host mail conventions.
1214
1215
1216
1217
1218
1219 [Page 20] Postel</pre>
1220 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
1221 <a href="./rfc821">RFC 821</a> August 1982
1222 Simple Mail Transfer Protocol
1223
1224
1225
1226 For example, mail received at relay host A with arguments
1227
1228 FROM:&lt;[email protected]&gt;
1229 TO:&lt;@HOSTA.ARPA,@HOSTB.ARPA:[email protected]&gt;
1230
1231 will be relayed on to host B with arguments
1232
1233 FROM:&lt;@HOSTA.ARPA:[email protected]&gt;
1234 TO:&lt;@HOSTB.ARPA:[email protected]&gt;.
1235
1236 This command causes its forward-path argument to be appended
1237 to the forward-path buffer.
1238
1239 DATA (DATA)
1240
1241 The receiver treats the lines following the command as mail
1242 data from the sender. This command causes the mail data
1243 from this command to be appended to the mail data buffer.
1244 The mail data may contain any of the 128 ASCII character
1245 codes.
1246
1247 The mail data is terminated by a line containing only a
1248 period, that is the character sequence "&lt;CRLF&gt;.&lt;CRLF&gt;" (see
1249 <a href="#section-4.5.2">Section 4.5.2</a> on Transparency). This is the end of mail
1250 data indication.
1251
1252 The end of mail data indication requires that the receiver
1253 must now process the stored mail transaction information.
1254 This processing consumes the information in the reverse-path
1255 buffer, the forward-path buffer, and the mail data buffer,
1256 and on the completion of this command these buffers are
1257 cleared. If the processing is successful the receiver must
1258 send an OK reply. If the processing fails completely the
1259 receiver must send a failure reply.
1260
1261 When the receiver-SMTP accepts a message either for relaying
1262 or for final delivery it inserts at the beginning of the
1263 mail data a time stamp line. The time stamp line indicates
1264 the identity of the host that sent the message, and the
1265 identity of the host that received the message (and is
1266 inserting this time stamp), and the date and time the
1267 message was received. Relayed messages will have multiple
1268 time stamp lines.
1269
1270 When the receiver-SMTP makes the "final delivery" of a
1271 message it inserts at the beginning of the mail data a
1272
1273
1274
1275 <span class="grey">Postel [Page 21]</span></pre>
1276 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
1277 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1278 Simple Mail Transfer Protocol
1279
1280
1281
1282 return path line. The return path line preserves the
1283 information in the &lt;reverse-path&gt; from the MAIL command.
1284 Here, final delivery means the message leaves the SMTP
1285 world. Normally, this would mean it has been delivered to
1286 the destination user, but in some cases it may be further
1287 processed and transmitted by another mail system.
1288
1289 It is possible for the mailbox in the return path be
1290 different from the actual sender's mailbox, for example,
1291 if error responses are to be delivered a special error
1292 handling mailbox rather than the message senders.
1293
1294 The preceding two paragraphs imply that the final mail data
1295 will begin with a return path line, followed by one or more
1296 time stamp lines. These lines will be followed by the mail
1297 data header and body [<a href="#ref-2">2</a>]. See Example 8.
1298
1299 Special mention is needed of the response and further action
1300 required when the processing following the end of mail data
1301 indication is partially successful. This could arise if
1302 after accepting several recipients and the mail data, the
1303 receiver-SMTP finds that the mail data can be successfully
1304 delivered to some of the recipients, but it cannot be to
1305 others (for example, due to mailbox space allocation
1306 problems). In such a situation, the response to the DATA
1307 command must be an OK reply. But, the receiver-SMTP must
1308 compose and send an "undeliverable mail" notification
1309 message to the originator of the message. Either a single
1310 notification which lists all of the recipients that failed
1311 to get the message, or separate notification messages must
1312 be sent for each failed recipient (see Example 7). All
1313 undeliverable mail notification messages are sent using the
1314 MAIL command (even if they result from processing a SEND,
1315 SOML, or SAML command).
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331 [Page 22] Postel</pre>
1332 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
1333 <a href="./rfc821">RFC 821</a> August 1982
1334 Simple Mail Transfer Protocol
1335
1336
1337
1338 -------------------------------------------------------------
1339
1340 Example of Return Path and Received Time Stamps
1341
1342 Return-Path: &lt;@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:[email protected]&gt;
1343 Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 PST
1344 Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 PST
1345 Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 PST
1346 Date: 27 Oct 81 15:01:01 PST
1347 From: [email protected]
1348 Subject: Improved Mailing System Installed
1349 To: [email protected]
1350
1351 This is to inform you that ...
1352
1353 Example 8
1354
1355 -------------------------------------------------------------
1356
1357 SEND (SEND)
1358
1359 This command is used to initiate a mail transaction in which
1360 the mail data is delivered to one or more terminals. The
1361 argument field contains a reverse-path. This command is
1362 successful if the message is delivered to a terminal.
1363
1364 The reverse-path consists of an optional list of hosts and
1365 the sender mailbox. When the list of hosts is present, it
1366 is a "reverse" source route and indicates that the mail was
1367 relayed through each host on the list (the first host in the
1368 list was the most recent relay). This list is used as a
1369 source route to return non-delivery notices to the sender.
1370 As each relay host adds itself to the beginning of the list,
1371 it must use its name as known in the IPCE to which it is
1372 relaying the mail rather than the IPCE from which the mail
1373 came (if they are different).
1374
1375 This command clears the reverse-path buffer, the
1376 forward-path buffer, and the mail data buffer; and inserts
1377 the reverse-path information from this command into the
1378 reverse-path buffer.
1379
1380 SEND OR MAIL (SOML)
1381
1382 This command is used to initiate a mail transaction in which
1383 the mail data is delivered to one or more terminals or
1384
1385
1386
1387 <span class="grey">Postel [Page 23]</span></pre>
1388 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
1389 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1390 Simple Mail Transfer Protocol
1391
1392
1393
1394 mailboxes. For each recipient the mail data is delivered to
1395 the recipient's terminal if the recipient is active on the
1396 host (and accepting terminal messages), otherwise to the
1397 recipient's mailbox. The argument field contains a
1398 reverse-path. This command is successful if the message is
1399 delivered to a terminal or the mailbox.
1400
1401 The reverse-path consists of an optional list of hosts and
1402 the sender mailbox. When the list of hosts is present, it
1403 is a "reverse" source route and indicates that the mail was
1404 relayed through each host on the list (the first host in the
1405 list was the most recent relay). This list is used as a
1406 source route to return non-delivery notices to the sender.
1407 As each relay host adds itself to the beginning of the list,
1408 it must use its name as known in the IPCE to which it is
1409 relaying the mail rather than the IPCE from which the mail
1410 came (if they are different).
1411
1412 This command clears the reverse-path buffer, the
1413 forward-path buffer, and the mail data buffer; and inserts
1414 the reverse-path information from this command into the
1415 reverse-path buffer.
1416
1417 SEND AND MAIL (SAML)
1418
1419 This command is used to initiate a mail transaction in which
1420 the mail data is delivered to one or more terminals and
1421 mailboxes. For each recipient the mail data is delivered to
1422 the recipient's terminal if the recipient is active on the
1423 host (and accepting terminal messages), and for all
1424 recipients to the recipient's mailbox. The argument field
1425 contains a reverse-path. This command is successful if the
1426 message is delivered to the mailbox.
1427
1428 The reverse-path consists of an optional list of hosts and
1429 the sender mailbox. When the list of hosts is present, it
1430 is a "reverse" source route and indicates that the mail was
1431 relayed through each host on the list (the first host in the
1432 list was the most recent relay). This list is used as a
1433 source route to return non-delivery notices to the sender.
1434 As each relay host adds itself to the beginning of the list,
1435 it must use its name as known in the IPCE to which it is
1436 relaying the mail rather than the IPCE from which the mail
1437 came (if they are different).
1438
1439 This command clears the reverse-path buffer, the
1440
1441
1442
1443 [Page 24] Postel</pre>
1444 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
1445 <a href="./rfc821">RFC 821</a> August 1982
1446 Simple Mail Transfer Protocol
1447
1448
1449
1450 forward-path buffer, and the mail data buffer; and inserts
1451 the reverse-path information from this command into the
1452 reverse-path buffer.
1453
1454 RESET (RSET)
1455
1456 This command specifies that the current mail transaction is
1457 to be aborted. Any stored sender, recipients, and mail data
1458 must be discarded, and all buffers and state tables cleared.
1459 The receiver must send an OK reply.
1460
1461 VERIFY (VRFY)
1462
1463 This command asks the receiver to confirm that the argument
1464 identifies a user. If it is a user name, the full name of
1465 the user (if known) and the fully specified mailbox are
1466 returned.
1467
1468 This command has no effect on any of the reverse-path
1469 buffer, the forward-path buffer, or the mail data buffer.
1470
1471 EXPAND (EXPN)
1472
1473 This command asks the receiver to confirm that the argument
1474 identifies a mailing list, and if so, to return the
1475 membership of that list. The full name of the users (if
1476 known) and the fully specified mailboxes are returned in a
1477 multiline reply.
1478
1479 This command has no effect on any of the reverse-path
1480 buffer, the forward-path buffer, or the mail data buffer.
1481
1482 HELP (HELP)
1483
1484 This command causes the receiver to send helpful information
1485 to the sender of the HELP command. The command may take an
1486 argument (e.g., any command name) and return more specific
1487 information as a response.
1488
1489 This command has no effect on any of the reverse-path
1490 buffer, the forward-path buffer, or the mail data buffer.
1491
1492
1493
1494
1495
1496
1497
1498
1499 <span class="grey">Postel [Page 25]</span></pre>
1500 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
1501 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1502 Simple Mail Transfer Protocol
1503
1504
1505
1506 NOOP (NOOP)
1507
1508 This command does not affect any parameters or previously
1509 entered commands. It specifies no action other than that
1510 the receiver send an OK reply.
1511
1512 This command has no effect on any of the reverse-path
1513 buffer, the forward-path buffer, or the mail data buffer.
1514
1515 QUIT (QUIT)
1516
1517 This command specifies that the receiver must send an OK
1518 reply, and then close the transmission channel.
1519
1520 The receiver should not close the transmission channel until
1521 it receives and replies to a QUIT command (even if there was
1522 an error). The sender should not close the transmission
1523 channel until it send a QUIT command and receives the reply
1524 (even if there was an error response to a previous command).
1525 If the connection is closed prematurely the receiver should
1526 act as if a RSET command had been received (canceling any
1527 pending transaction, but not undoing any previously
1528 completed transaction), the sender should act as if the
1529 command or transaction in progress had received a temporary
1530 error (4xx).
1531
1532 TURN (TURN)
1533
1534 This command specifies that the receiver must either (1)
1535 send an OK reply and then take on the role of the
1536 sender-SMTP, or (2) send a refusal reply and retain the role
1537 of the receiver-SMTP.
1538
1539 If program-A is currently the sender-SMTP and it sends the
1540 TURN command and receives an OK reply (250) then program-A
1541 becomes the receiver-SMTP. Program-A is then in the initial
1542 state as if the transmission channel just opened, and it
1543 then sends the 220 service ready greeting.
1544
1545 If program-B is currently the receiver-SMTP and it receives
1546 the TURN command and sends an OK reply (250) then program-B
1547 becomes the sender-SMTP. Program-B is then in the initial
1548 state as if the transmission channel just opened, and it
1549 then expects to receive the 220 service ready greeting.
1550
1551 To refuse to change roles the receiver sends the 502 reply.
1552
1553
1554
1555 [Page 26] Postel</pre>
1556 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
1557 <a href="./rfc821">RFC 821</a> August 1982
1558 Simple Mail Transfer Protocol
1559
1560
1561
1562 There are restrictions on the order in which these command may
1563 be used.
1564
1565 The first command in a session must be the HELO command.
1566 The HELO command may be used later in a session as well. If
1567 the HELO command argument is not acceptable a 501 failure
1568 reply must be returned and the receiver-SMTP must stay in
1569 the same state.
1570
1571 The NOOP, HELP, EXPN, and VRFY commands can be used at any
1572 time during a session.
1573
1574 The MAIL, SEND, SOML, or SAML commands begin a mail
1575 transaction. Once started a mail transaction consists of
1576 one of the transaction beginning commands, one or more RCPT
1577 commands, and a DATA command, in that order. A mail
1578 transaction may be aborted by the RSET command. There may
1579 be zero or more transactions in a session.
1580
1581 If the transaction beginning command argument is not
1582 acceptable a 501 failure reply must be returned and the
1583 receiver-SMTP must stay in the same state. If the commands
1584 in a transaction are out of order a 503 failure reply must
1585 be returned and the receiver-SMTP must stay in the same
1586 state.
1587
1588 The last command in a session must be the QUIT command. The
1589 QUIT command can not be used at any other time in a session.
1590
1591 4.1.2. COMMAND SYNTAX
1592
1593 The commands consist of a command code followed by an argument
1594 field. Command codes are four alphabetic characters. Upper
1595 and lower case alphabetic characters are to be treated
1596 identically. Thus, any of the following may represent the mail
1597 command:
1598
1599 MAIL Mail mail MaIl mAIl
1600
1601 This also applies to any symbols representing parameter values,
1602 such as "TO" or "to" for the forward-path. Command codes and
1603 the argument fields are separated by one or more spaces.
1604 However, within the reverse-path and forward-path arguments
1605 case is important. In particular, in some hosts the user
1606 "smith" is different from the user "Smith".
1607
1608
1609
1610
1611 <span class="grey">Postel [Page 27]</span></pre>
1612 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
1613 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1614 Simple Mail Transfer Protocol
1615
1616
1617
1618 The argument field consists of a variable length character
1619 string ending with the character sequence &lt;CRLF&gt;. The receiver
1620 is to take no action until this sequence is received.
1621
1622 Square brackets denote an optional argument field. If the
1623 option is not taken, the appropriate default is implied.
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667 [Page 28] Postel</pre>
1668 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
1669 <a href="./rfc821">RFC 821</a> August 1982
1670 Simple Mail Transfer Protocol
1671
1672
1673
1674 The following are the SMTP commands:
1675
1676 HELO &lt;SP&gt; &lt;domain&gt; &lt;CRLF&gt;
1677
1678 MAIL &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
1679
1680 RCPT &lt;SP&gt; TO:&lt;forward-path&gt; &lt;CRLF&gt;
1681
1682 DATA &lt;CRLF&gt;
1683
1684 RSET &lt;CRLF&gt;
1685
1686 SEND &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
1687
1688 SOML &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
1689
1690 SAML &lt;SP&gt; FROM:&lt;reverse-path&gt; &lt;CRLF&gt;
1691
1692 VRFY &lt;SP&gt; &lt;string&gt; &lt;CRLF&gt;
1693
1694 EXPN &lt;SP&gt; &lt;string&gt; &lt;CRLF&gt;
1695
1696 HELP [&lt;SP&gt; &lt;string&gt;] &lt;CRLF&gt;
1697
1698 NOOP &lt;CRLF&gt;
1699
1700 QUIT &lt;CRLF&gt;
1701
1702 TURN &lt;CRLF&gt;
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723 <span class="grey">Postel [Page 29]</span></pre>
1724 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
1725 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1726 Simple Mail Transfer Protocol
1727
1728
1729
1730 The syntax of the above argument fields (using BNF notation
1731 where applicable) is given below. The "..." notation indicates
1732 that a field may be repeated one or more times.
1733
1734 &lt;reverse-path&gt; ::= &lt;path&gt;
1735
1736 &lt;forward-path&gt; ::= &lt;path&gt;
1737
1738 &lt;path&gt; ::= "&lt;" [ &lt;a-d-l&gt; ":" ] &lt;mailbox&gt; "&gt;"
1739
1740 &lt;a-d-l&gt; ::= &lt;at-domain&gt; | &lt;at-domain&gt; "," &lt;a-d-l&gt;
1741
1742 &lt;at-domain&gt; ::= "@" &lt;domain&gt;
1743
1744 &lt;domain&gt; ::= &lt;element&gt; | &lt;element&gt; "." &lt;domain&gt;
1745
1746 &lt;element&gt; ::= &lt;name&gt; | "#" &lt;number&gt; | "[" &lt;dotnum&gt; "]"
1747
1748 &lt;mailbox&gt; ::= &lt;local-part&gt; "@" &lt;domain&gt;
1749
1750 &lt;local-part&gt; ::= &lt;dot-string&gt; | &lt;quoted-string&gt;
1751
1752 &lt;name&gt; ::= &lt;a&gt; &lt;ldh-str&gt; &lt;let-dig&gt;
1753
1754 &lt;ldh-str&gt; ::= &lt;let-dig-hyp&gt; | &lt;let-dig-hyp&gt; &lt;ldh-str&gt;
1755
1756 &lt;let-dig&gt; ::= &lt;a&gt; | &lt;d&gt;
1757
1758 &lt;let-dig-hyp&gt; ::= &lt;a&gt; | &lt;d&gt; | "-"
1759
1760 &lt;dot-string&gt; ::= &lt;string&gt; | &lt;string&gt; "." &lt;dot-string&gt;
1761
1762 &lt;string&gt; ::= &lt;char&gt; | &lt;char&gt; &lt;string&gt;
1763
1764 &lt;quoted-string&gt; ::= """ &lt;qtext&gt; """
1765
1766 &lt;qtext&gt; ::= "\" &lt;x&gt; | "\" &lt;x&gt; &lt;qtext&gt; | &lt;q&gt; | &lt;q&gt; &lt;qtext&gt;
1767
1768 &lt;char&gt; ::= &lt;c&gt; | "\" &lt;x&gt;
1769
1770 &lt;dotnum&gt; ::= &lt;snum&gt; "." &lt;snum&gt; "." &lt;snum&gt; "." &lt;snum&gt;
1771
1772 &lt;number&gt; ::= &lt;d&gt; | &lt;d&gt; &lt;number&gt;
1773
1774 &lt;CRLF&gt; ::= &lt;CR&gt; &lt;LF&gt;
1775
1776
1777
1778
1779 [Page 30] Postel</pre>
1780 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
1781 <a href="./rfc821">RFC 821</a> August 1982
1782 Simple Mail Transfer Protocol
1783
1784
1785
1786 &lt;CR&gt; ::= the carriage return character (ASCII code 13)
1787
1788 &lt;LF&gt; ::= the line feed character (ASCII code 10)
1789
1790 &lt;SP&gt; ::= the space character (ASCII code 32)
1791
1792 &lt;snum&gt; ::= one, two, or three digits representing a decimal
1793 integer value in the range 0 through 255
1794
1795 &lt;a&gt; ::= any one of the 52 alphabetic characters A through Z
1796 in upper case and a through z in lower case
1797
1798 &lt;c&gt; ::= any one of the 128 ASCII characters, but not any
1799 &lt;special&gt; or &lt;SP&gt;
1800
1801 &lt;d&gt; ::= any one of the ten digits 0 through 9
1802
1803 &lt;q&gt; ::= any one of the 128 ASCII characters except &lt;CR&gt;,
1804 &lt;LF&gt;, quote ("), or backslash (\)
1805
1806 &lt;x&gt; ::= any one of the 128 ASCII characters (no exceptions)
1807
1808 &lt;special&gt; ::= "&lt;" | "&gt;" | "(" | ")" | "[" | "]" | "\" | "."
1809 | "," | ";" | ":" | "@" """ | the control
1810 characters (ASCII codes 0 through 31 inclusive and
1811 127)
1812
1813 Note that the backslash, "\", is a quote character, which is
1814 used to indicate that the next character is to be used
1815 literally (instead of its normal interpretation). For example,
1816 "Joe\,Smith" could be used to indicate a single nine character
1817 user field with comma being the fourth character of the field.
1818
1819 Hosts are generally known by names which are translated to
1820 addresses in each host. Note that the name elements of domains
1821 are the official names -- no use of nicknames or aliases is
1822 allowed.
1823
1824 Sometimes a host is not known to the translation function and
1825 communication is blocked. To bypass this barrier two numeric
1826 forms are also allowed for host "names". One form is a decimal
1827 integer prefixed by a pound sign, "#", which indicates the
1828 number is the address of the host. Another form is four small
1829 decimal integers separated by dots and enclosed by brackets,
1830 e.g., "[123.255.37.2]", which indicates a 32-bit ARPA Internet
1831 Address in four 8-bit fields.
1832
1833
1834
1835 <span class="grey">Postel [Page 31]</span></pre>
1836 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
1837 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1838 Simple Mail Transfer Protocol
1839
1840
1841
1842 The time stamp line and the return path line are formally
1843 defined as follows:
1844
1845 &lt;return-path-line&gt; ::= "Return-Path:" &lt;SP&gt;&lt;reverse-path&gt;&lt;CRLF&gt;
1846
1847 &lt;time-stamp-line&gt; ::= "Received:" &lt;SP&gt; &lt;stamp&gt; &lt;CRLF&gt;
1848
1849 &lt;stamp&gt; ::= &lt;from-domain&gt; &lt;by-domain&gt; &lt;opt-info&gt; ";"
1850 &lt;daytime&gt;
1851
1852 &lt;from-domain&gt; ::= "FROM" &lt;SP&gt; &lt;domain&gt; &lt;SP&gt;
1853
1854 &lt;by-domain&gt; ::= "BY" &lt;SP&gt; &lt;domain&gt; &lt;SP&gt;
1855
1856 &lt;opt-info&gt; ::= [&lt;via&gt;] [&lt;with&gt;] [&lt;id&gt;] [&lt;for&gt;]
1857
1858 &lt;via&gt; ::= "VIA" &lt;SP&gt; &lt;link&gt; &lt;SP&gt;
1859
1860 &lt;with&gt; ::= "WITH" &lt;SP&gt; &lt;protocol&gt; &lt;SP&gt;
1861
1862 &lt;id&gt; ::= "ID" &lt;SP&gt; &lt;string&gt; &lt;SP&gt;
1863
1864 &lt;for&gt; ::= "FOR" &lt;SP&gt; &lt;path&gt; &lt;SP&gt;
1865
1866 &lt;link&gt; ::= The standard names for links are registered with
1867 the Network Information Center.
1868
1869 &lt;protocol&gt; ::= The standard names for protocols are
1870 registered with the Network Information Center.
1871
1872 &lt;daytime&gt; ::= &lt;SP&gt; &lt;date&gt; &lt;SP&gt; &lt;time&gt;
1873
1874 &lt;date&gt; ::= &lt;dd&gt; &lt;SP&gt; &lt;mon&gt; &lt;SP&gt; &lt;yy&gt;
1875
1876 &lt;time&gt; ::= &lt;hh&gt; ":" &lt;mm&gt; ":" &lt;ss&gt; &lt;SP&gt; &lt;zone&gt;
1877
1878 &lt;dd&gt; ::= the one or two decimal integer day of the month in
1879 the range 1 to 31.
1880
1881 &lt;mon&gt; ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
1882 "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
1883
1884 &lt;yy&gt; ::= the two decimal integer year of the century in the
1885 range 00 to 99.
1886
1887
1888
1889
1890
1891 [Page 32] Postel</pre>
1892 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
1893 <a href="./rfc821">RFC 821</a> August 1982
1894 Simple Mail Transfer Protocol
1895
1896
1897
1898 &lt;hh&gt; ::= the two decimal integer hour of the day in the
1899 range 00 to 24.
1900
1901 &lt;mm&gt; ::= the two decimal integer minute of the hour in the
1902 range 00 to 59.
1903
1904 &lt;ss&gt; ::= the two decimal integer second of the minute in the
1905 range 00 to 59.
1906
1907 &lt;zone&gt; ::= "UT" for Universal Time (the default) or other
1908 time zone designator (as in [<a href="#ref-2">2</a>]).
1909
1910
1911
1912 -------------------------------------------------------------
1913
1914 Return Path Example
1915
1916 Return-Path: &lt;@CHARLIE.ARPA,@BAKER.ARPA:[email protected]&gt;
1917
1918 Example 9
1919
1920 -------------------------------------------------------------
1921
1922 -------------------------------------------------------------
1923
1924 Time Stamp Line Example
1925
1926 Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 09:23:59 PDT
1927
1928 Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25
1929 id M12345 for [email protected] ; 22 OCT 81 09:23:59 PDT
1930
1931 Example 10
1932
1933 -------------------------------------------------------------
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947 <span class="grey">Postel [Page 33]</span></pre>
1948 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
1949 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
1950 Simple Mail Transfer Protocol
1951
1952
1953
1954 4.2. SMTP REPLIES
1955
1956 Replies to SMTP commands are devised to ensure the synchronization
1957 of requests and actions in the process of mail transfer, and to
1958 guarantee that the sender-SMTP always knows the state of the
1959 receiver-SMTP. Every command must generate exactly one reply.
1960
1961 The details of the command-reply sequence are made explicit in
1962 <a href="#section-5.3">Section 5.3</a> on Sequencing and <a href="#section-5.4">Section 5.4</a> State Diagrams.
1963
1964 An SMTP reply consists of a three digit number (transmitted as
1965 three alphanumeric characters) followed by some text. The number
1966 is intended for use by automata to determine what state to enter
1967 next; the text is meant for the human user. It is intended that
1968 the three digits contain enough encoded information that the
1969 sender-SMTP need not examine the text and may either discard it or
1970 pass it on to the user, as appropriate. In particular, the text
1971 may be receiver-dependent and context dependent, so there are
1972 likely to be varying texts for each reply code. A discussion of
1973 the theory of reply codes is given in <a href="#appendix-E">Appendix E</a>. Formally, a
1974 reply is defined to be the sequence: a three-digit code, &lt;SP&gt;,
1975 one line of text, and &lt;CRLF&gt;, or a multiline reply (as defined in
1976 <a href="#appendix-E">Appendix E</a>). Only the EXPN and HELP commands are expected to
1977 result in multiline replies in normal circumstances, however
1978 multiline replies are allowed for any command.
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003 [Page 34] Postel</pre>
2004 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
2005 <a href="./rfc821">RFC 821</a> August 1982
2006 Simple Mail Transfer Protocol
2007
2008
2009
2010 4.2.1. REPLY CODES BY FUNCTION GROUPS
2011
2012 500 Syntax error, command unrecognized
2013 [This may include errors such as command line too long]
2014 501 Syntax error in parameters or arguments
2015 502 Command not implemented
2016 503 Bad sequence of commands
2017 504 Command parameter not implemented
2018
2019 211 System status, or system help reply
2020 214 Help message
2021 [Information on how to use the receiver or the meaning of a
2022 particular non-standard command; this reply is useful only
2023 to the human user]
2024
2025 220 &lt;domain&gt; Service ready
2026 221 &lt;domain&gt; Service closing transmission channel
2027 421 &lt;domain&gt; Service not available,
2028 closing transmission channel
2029 [This may be a reply to any command if the service knows it
2030 must shut down]
2031
2032 250 Requested mail action okay, completed
2033 251 User not local; will forward to &lt;forward-path&gt;
2034 450 Requested mail action not taken: mailbox unavailable
2035 [E.g., mailbox busy]
2036 550 Requested action not taken: mailbox unavailable
2037 [E.g., mailbox not found, no access]
2038 451 Requested action aborted: error in processing
2039 551 User not local; please try &lt;forward-path&gt;
2040 452 Requested action not taken: insufficient system storage
2041 552 Requested mail action aborted: exceeded storage allocation
2042 553 Requested action not taken: mailbox name not allowed
2043 [E.g., mailbox syntax incorrect]
2044 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
2045 554 Transaction failed
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059 <span class="grey">Postel [Page 35]</span></pre>
2060 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
2061 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2062 Simple Mail Transfer Protocol
2063
2064
2065
2066 4.2.2. NUMERIC ORDER LIST OF REPLY CODES
2067
2068 211 System status, or system help reply
2069 214 Help message
2070 [Information on how to use the receiver or the meaning of a
2071 particular non-standard command; this reply is useful only
2072 to the human user]
2073 220 &lt;domain&gt; Service ready
2074 221 &lt;domain&gt; Service closing transmission channel
2075 250 Requested mail action okay, completed
2076 251 User not local; will forward to &lt;forward-path&gt;
2077
2078 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
2079
2080 421 &lt;domain&gt; Service not available,
2081 closing transmission channel
2082 [This may be a reply to any command if the service knows it
2083 must shut down]
2084 450 Requested mail action not taken: mailbox unavailable
2085 [E.g., mailbox busy]
2086 451 Requested action aborted: local error in processing
2087 452 Requested action not taken: insufficient system storage
2088
2089 500 Syntax error, command unrecognized
2090 [This may include errors such as command line too long]
2091 501 Syntax error in parameters or arguments
2092 502 Command not implemented
2093 503 Bad sequence of commands
2094 504 Command parameter not implemented
2095 550 Requested action not taken: mailbox unavailable
2096 [E.g., mailbox not found, no access]
2097 551 User not local; please try &lt;forward-path&gt;
2098 552 Requested mail action aborted: exceeded storage allocation
2099 553 Requested action not taken: mailbox name not allowed
2100 [E.g., mailbox syntax incorrect]
2101 554 Transaction failed
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115 [Page 36] Postel</pre>
2116 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
2117 <a href="./rfc821">RFC 821</a> August 1982
2118 Simple Mail Transfer Protocol
2119
2120
2121
2122 4.3. SEQUENCING OF COMMANDS AND REPLIES
2123
2124 The communication between the sender and receiver is intended to
2125 be an alternating dialogue, controlled by the sender. As such,
2126 the sender issues a command and the receiver responds with a
2127 reply. The sender must wait for this response before sending
2128 further commands.
2129
2130 One important reply is the connection greeting. Normally, a
2131 receiver will send a 220 "Service ready" reply when the connection
2132 is completed. The sender should wait for this greeting message
2133 before sending any commands.
2134
2135 Note: all the greeting type replies have the official name of
2136 the server host as the first word following the reply code.
2137
2138 For example,
2139
2140 220 &lt;SP&gt; USC-ISIF.ARPA &lt;SP&gt; Service ready &lt;CRLF&gt;
2141
2142 The table below lists alternative success and failure replies for
2143 each command. These must be strictly adhered to; a receiver may
2144 substitute text in the replies, but the meaning and action implied
2145 by the code numbers and by the specific command reply sequence
2146 cannot be altered.
2147
2148 COMMAND-REPLY SEQUENCES
2149
2150 Each command is listed with its possible replies. The prefixes
2151 used before the possible replies are "P" for preliminary (not
2152 used in SMTP), "I" for intermediate, "S" for success, "F" for
2153 failure, and "E" for error. The 421 reply (service not
2154 available, closing transmission channel) may be given to any
2155 command if the SMTP-receiver knows it must shut down. This
2156 listing forms the basis for the State Diagrams in <a href="#section-4.4">Section 4.4</a>.
2157
2158 CONNECTION ESTABLISHMENT
2159 S: 220
2160 F: 421
2161 HELO
2162 S: 250
2163 E: 500, 501, 504, 421
2164 MAIL
2165 S: 250
2166 F: 552, 451, 452
2167 E: 500, 501, 421
2168
2169
2170
2171 <span class="grey">Postel [Page 37]</span></pre>
2172 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
2173 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2174 Simple Mail Transfer Protocol
2175
2176
2177
2178 RCPT
2179 S: 250, 251
2180 F: 550, 551, 552, 553, 450, 451, 452
2181 E: 500, 501, 503, 421
2182 DATA
2183 I: 354 -&gt; data -&gt; S: 250
2184 F: 552, 554, 451, 452
2185 F: 451, 554
2186 E: 500, 501, 503, 421
2187 RSET
2188 S: 250
2189 E: 500, 501, 504, 421
2190 SEND
2191 S: 250
2192 F: 552, 451, 452
2193 E: 500, 501, 502, 421
2194 SOML
2195 S: 250
2196 F: 552, 451, 452
2197 E: 500, 501, 502, 421
2198 SAML
2199 S: 250
2200 F: 552, 451, 452
2201 E: 500, 501, 502, 421
2202 VRFY
2203 S: 250, 251
2204 F: 550, 551, 553
2205 E: 500, 501, 502, 504, 421
2206 EXPN
2207 S: 250
2208 F: 550
2209 E: 500, 501, 502, 504, 421
2210 HELP
2211 S: 211, 214
2212 E: 500, 501, 502, 504, 421
2213 NOOP
2214 S: 250
2215 E: 500, 421
2216 QUIT
2217 S: 221
2218 E: 500
2219 TURN
2220 S: 250
2221 F: 502
2222 E: 500, 503
2223
2224
2225
2226
2227 [Page 38] Postel</pre>
2228 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
2229 <a href="./rfc821">RFC 821</a> August 1982
2230 Simple Mail Transfer Protocol
2231
2232
2233
2234 4.4. STATE DIAGRAMS
2235
2236 Following are state diagrams for a simple-minded SMTP
2237 implementation. Only the first digit of the reply codes is used.
2238 There is one state diagram for each group of SMTP commands. The
2239 command groupings were determined by constructing a model for each
2240 command and then collecting together the commands with
2241 structurally identical models.
2242
2243 For each command there are three possible outcomes: "success"
2244 (S), "failure" (F), and "error" (E). In the state diagrams below
2245 we use the symbol B for "begin", and the symbol W for "wait for
2246 reply".
2247
2248 First, the diagram that represents most of the SMTP commands:
2249
2250
2251 1,3 +---+
2252 -----------&gt;| E |
2253 | +---+
2254 |
2255 +---+ cmd +---+ 2 +---+
2256 | B |----------&gt;| W |----------&gt;| S |
2257 +---+ +---+ +---+
2258 |
2259 | 4,5 +---+
2260 -----------&gt;| F |
2261 +---+
2262
2263
2264 This diagram models the commands:
2265
2266 HELO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN, HELP,
2267 NOOP, QUIT, TURN.
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283 <span class="grey">Postel [Page 39]</span></pre>
2284 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
2285 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2286 Simple Mail Transfer Protocol
2287
2288
2289
2290 A more complex diagram models the DATA command:
2291
2292
2293 +---+ DATA +---+ 1,2 +---+
2294 | B |----------&gt;| W |--------------------&gt;| E |
2295 +---+ +---+ ------------&gt;+---+
2296 3| |4,5 |
2297 | | |
2298 -------------- ----- |
2299 | | | +---+
2300 | ---------- --------&gt;| S |
2301 | | | | +---+
2302 | | ------------
2303 | | | |
2304 V 1,3| |2 |
2305 +---+ data +---+ ---------------&gt;+---+
2306 | |----------&gt;| W | | F |
2307 +---+ +---+--------------------&gt;+---+
2308 4,5
2309
2310
2311 Note that the "data" here is a series of lines sent from the
2312 sender to the receiver with no response expected until the last
2313 line is sent.
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339 [Page 40] Postel</pre>
2340 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
2341 <a href="./rfc821">RFC 821</a> August 1982
2342 Simple Mail Transfer Protocol
2343
2344
2345
2346 4.5. DETAILS
2347
2348 4.5.1. MINIMUM IMPLEMENTATION
2349
2350 In order to make SMTP workable, the following minimum
2351 implementation is required for all receivers:
2352
2353 COMMANDS -- HELO
2354 MAIL
2355 RCPT
2356 DATA
2357 RSET
2358 NOOP
2359 QUIT
2360
2361 4.5.2. TRANSPARENCY
2362
2363 Without some provision for data transparency the character
2364 sequence "&lt;CRLF&gt;.&lt;CRLF&gt;" ends the mail text and cannot be sent
2365 by the user. In general, users are not aware of such
2366 "forbidden" sequences. To allow all user composed text to be
2367 transmitted transparently the following procedures are used.
2368
2369 1. Before sending a line of mail text the sender-SMTP checks
2370 the first character of the line. If it is a period, one
2371 additional period is inserted at the beginning of the line.
2372
2373 2. When a line of mail text is received by the receiver-SMTP
2374 it checks the line. If the line is composed of a single
2375 period it is the end of mail. If the first character is a
2376 period and there are other characters on the line, the first
2377 character is deleted.
2378
2379 The mail data may contain any of the 128 ASCII characters. All
2380 characters are to be delivered to the recipient's mailbox
2381 including format effectors and other control characters. If
2382 the transmission channel provides an 8-bit byte (octets) data
2383 stream, the 7-bit ASCII codes are transmitted right justified
2384 in the octets with the high order bits cleared to zero.
2385
2386 In some systems it may be necessary to transform the data as
2387 it is received and stored. This may be necessary for hosts
2388 that use a different character set than ASCII as their local
2389 character set, or that store data in records rather than
2390
2391
2392
2393
2394
2395 <span class="grey">Postel [Page 41]</span></pre>
2396 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
2397 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2398 Simple Mail Transfer Protocol
2399
2400
2401
2402 strings. If such transforms are necessary, they must be
2403 reversible -- especially if such transforms are applied to
2404 mail being relayed.
2405
2406 4.5.3. SIZES
2407
2408 There are several objects that have required minimum maximum
2409 sizes. That is, every implementation must be able to receive
2410 objects of at least these sizes, but must not send objects
2411 larger than these sizes.
2412
2413
2414 ****************************************************
2415 * *
2416 * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
2417 * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
2418 * OF THESE OBJECTS SHOULD BE USED. *
2419 * *
2420 ****************************************************
2421
2422 user
2423
2424 The maximum total length of a user name is 64 characters.
2425
2426 domain
2427
2428 The maximum total length of a domain name or number is 64
2429 characters.
2430
2431 path
2432
2433 The maximum total length of a reverse-path or
2434 forward-path is 256 characters (including the punctuation
2435 and element separators).
2436
2437 command line
2438
2439 The maximum total length of a command line including the
2440 command word and the &lt;CRLF&gt; is 512 characters.
2441
2442 reply line
2443
2444 The maximum total length of a reply line including the
2445 reply code and the &lt;CRLF&gt; is 512 characters.
2446
2447
2448
2449
2450
2451 [Page 42] Postel</pre>
2452 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
2453 <a href="./rfc821">RFC 821</a> August 1982
2454 Simple Mail Transfer Protocol
2455
2456
2457
2458 text line
2459
2460 The maximum total length of a text line including the
2461 &lt;CRLF&gt; is 1000 characters (but not counting the leading
2462 dot duplicated for transparency).
2463
2464 recipients buffer
2465
2466 The maximum total number of recipients that must be
2467 buffered is 100 recipients.
2468
2469
2470 ****************************************************
2471 * *
2472 * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
2473 * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
2474 * OF THESE OBJECTS SHOULD BE USED. *
2475 * *
2476 ****************************************************
2477
2478 Errors due to exceeding these limits may be reported by using
2479 the reply codes, for example:
2480
2481 500 Line too long.
2482
2483 501 Path too long
2484
2485 552 Too many recipients.
2486
2487 552 Too much mail data.
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507 <span class="grey">Postel [Page 43]</span></pre>
2508 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
2509 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2510 Simple Mail Transfer Protocol
2511
2512
2513
2514 APPENDIX A
2515
2516 TCP Transport service
2517
2518 The Transmission Control Protocol [<a href="#ref-3">3</a>] is used in the ARPA
2519 Internet, and in any network following the US DoD standards for
2520 internetwork protocols.
2521
2522 Connection Establishment
2523
2524 The SMTP transmission channel is a TCP connection established
2525 between the sender process port U and the receiver process port
2526 L. This single full duplex connection is used as the
2527 transmission channel. This protocol is assigned the service
2528 port 25 (31 octal), that is L=25.
2529
2530 Data Transfer
2531
2532 The TCP connection supports the transmission of 8-bit bytes.
2533 The SMTP data is 7-bit ASCII characters. Each character is
2534 transmitted as an 8-bit byte with the high-order bit cleared to
2535 zero.
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563 [Page 44] Postel</pre>
2564 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
2565 <a href="./rfc821">RFC 821</a> August 1982
2566 Simple Mail Transfer Protocol
2567
2568
2569
2570 APPENDIX B
2571
2572 NCP Transport service
2573
2574 The ARPANET Host-to-Host Protocol [<a href="#ref-4">4</a>] (implemented by the Network
2575 Control Program) may be used in the ARPANET.
2576
2577 Connection Establishment
2578
2579 The SMTP transmission channel is established via NCP between
2580 the sender process socket U and receiver process socket L. The
2581 Initial Connection Protocol [<a href="#ref-5">5</a>] is followed resulting in a pair
2582 of simplex connections. This pair of connections is used as
2583 the transmission channel. This protocol is assigned the
2584 contact socket 25 (31 octal), that is L=25.
2585
2586 Data Transfer
2587
2588 The NCP data connections are established in 8-bit byte mode.
2589 The SMTP data is 7-bit ASCII characters. Each character is
2590 transmitted as an 8-bit byte with the high-order bit cleared to
2591 zero.
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619 <span class="grey">Postel [Page 45]</span></pre>
2620 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
2621 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2622 Simple Mail Transfer Protocol
2623
2624
2625
2626 APPENDIX C
2627
2628 NITS
2629
2630 The Network Independent Transport Service [<a href="#ref-6">6</a>] may be used.
2631
2632 Connection Establishment
2633
2634 The SMTP transmission channel is established via NITS between
2635 the sender process and receiver process. The sender process
2636 executes the CONNECT primitive, and the waiting receiver
2637 process executes the ACCEPT primitive.
2638
2639 Data Transfer
2640
2641 The NITS connection supports the transmission of 8-bit bytes.
2642 The SMTP data is 7-bit ASCII characters. Each character is
2643 transmitted as an 8-bit byte with the high-order bit cleared to
2644 zero.
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675 [Page 46] Postel</pre>
2676 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
2677 <a href="./rfc821">RFC 821</a> August 1982
2678 Simple Mail Transfer Protocol
2679
2680
2681
2682 APPENDIX D
2683
2684 X.25 Transport service
2685
2686 It may be possible to use the X.25 service [<a href="#ref-7">7</a>] as provided by the
2687 Public Data Networks directly, however, it is suggested that a
2688 reliable end-to-end protocol such as TCP be used on top of X.25
2689 connections.
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731 <span class="grey">Postel [Page 47]</span></pre>
2732 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
2733 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2734 Simple Mail Transfer Protocol
2735
2736
2737
2738 APPENDIX E
2739
2740 Theory of Reply Codes
2741
2742 The three digits of the reply each have a special significance.
2743 The first digit denotes whether the response is good, bad or
2744 incomplete. An unsophisticated sender-SMTP will be able to
2745 determine its next action (proceed as planned, redo, retrench,
2746 etc.) by simply examining this first digit. A sender-SMTP that
2747 wants to know approximately what kind of error occurred (e.g.,
2748 mail system error, command syntax error) may examine the second
2749 digit, reserving the third digit for the finest gradation of
2750 information.
2751
2752 There are five values for the first digit of the reply code:
2753
2754 1yz Positive Preliminary reply
2755
2756 The command has been accepted, but the requested action
2757 is being held in abeyance, pending confirmation of the
2758 information in this reply. The sender-SMTP should send
2759 another command specifying whether to continue or abort
2760 the action.
2761
2762 [Note: SMTP does not have any commands that allow this
2763 type of reply, and so does not have the continue or
2764 abort commands.]
2765
2766 2yz Positive Completion reply
2767
2768 The requested action has been successfully completed. A
2769 new request may be initiated.
2770
2771 3yz Positive Intermediate reply
2772
2773 The command has been accepted, but the requested action
2774 is being held in abeyance, pending receipt of further
2775 information. The sender-SMTP should send another command
2776 specifying this information. This reply is used in
2777 command sequence groups.
2778
2779 4yz Transient Negative Completion reply
2780
2781 The command was not accepted and the requested action did
2782 not occur. However, the error condition is temporary and
2783 the action may be requested again. The sender should
2784
2785
2786
2787 [Page 48] Postel</pre>
2788 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
2789 <a href="./rfc821">RFC 821</a> August 1982
2790 Simple Mail Transfer Protocol
2791
2792
2793
2794 return to the beginning of the command sequence (if any).
2795 It is difficult to assign a meaning to "transient" when
2796 two different sites (receiver- and sender- SMTPs) must
2797 agree on the interpretation. Each reply in this category
2798 might have a different time value, but the sender-SMTP is
2799 encouraged to try again. A rule of thumb to determine if
2800 a reply fits into the 4yz or the 5yz category (see below)
2801 is that replies are 4yz if they can be repeated without
2802 any change in command form or in properties of the sender
2803 or receiver. (E.g., the command is repeated identically
2804 and the receiver does not put up a new implementation.)
2805
2806 5yz Permanent Negative Completion reply
2807
2808 The command was not accepted and the requested action did
2809 not occur. The sender-SMTP is discouraged from repeating
2810 the exact request (in the same sequence). Even some
2811 "permanent" error conditions can be corrected, so the
2812 human user may want to direct the sender-SMTP to
2813 reinitiate the command sequence by direct action at some
2814 point in the future (e.g., after the spelling has been
2815 changed, or the user has altered the account status).
2816
2817 The second digit encodes responses in specific categories:
2818
2819 x0z Syntax -- These replies refer to syntax errors,
2820 syntactically correct commands that don't fit any
2821 functional category, and unimplemented or superfluous
2822 commands.
2823
2824 x1z Information -- These are replies to requests for
2825 information, such as status or help.
2826
2827 x2z Connections -- These are replies referring to the
2828 transmission channel.
2829
2830 x3z Unspecified as yet.
2831
2832 x4z Unspecified as yet.
2833
2834 x5z Mail system -- These replies indicate the status of
2835 the receiver mail system vis-a-vis the requested
2836 transfer or other mail system action.
2837
2838 The third digit gives a finer gradation of meaning in each
2839 category specified by the second digit. The list of replies
2840
2841
2842
2843 <span class="grey">Postel [Page 49]</span></pre>
2844 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
2845 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2846 Simple Mail Transfer Protocol
2847
2848
2849
2850 illustrates this. Each reply text is recommended rather than
2851 mandatory, and may even change according to the command with
2852 which it is associated. On the other hand, the reply codes
2853 must strictly follow the specifications in this section.
2854 Receiver implementations should not invent new codes for
2855 slightly different situations from the ones described here, but
2856 rather adapt codes already defined.
2857
2858 For example, a command such as NOOP whose successful execution
2859 does not offer the sender-SMTP any new information will return
2860 a 250 reply. The response is 502 when the command requests an
2861 unimplemented non-site-specific action. A refinement of that
2862 is the 504 reply for a command that is implemented, but that
2863 requests an unimplemented parameter.
2864
2865 The reply text may be longer than a single line; in these cases
2866 the complete text must be marked so the sender-SMTP knows when it
2867 can stop reading the reply. This requires a special format to
2868 indicate a multiple line reply.
2869
2870 The format for multiline replies requires that every line,
2871 except the last, begin with the reply code, followed
2872 immediately by a hyphen, "-" (also known as minus), followed by
2873 text. The last line will begin with the reply code, followed
2874 immediately by &lt;SP&gt;, optionally some text, and &lt;CRLF&gt;.
2875
2876 For example:
2877 123-First line
2878 123-Second line
2879 123-234 text beginning with numbers
2880 123 The last line
2881
2882 In many cases the sender-SMTP then simply needs to search for
2883 the reply code followed by &lt;SP&gt; at the beginning of a line, and
2884 ignore all preceding lines. In a few cases, there is important
2885 data for the sender in the reply "text". The sender will know
2886 these cases from the current context.
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899 [Page 50] Postel</pre>
2900 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
2901 <a href="./rfc821">RFC 821</a> August 1982
2902 Simple Mail Transfer Protocol
2903
2904
2905
2906 APPENDIX F
2907
2908 Scenarios
2909
2910 This section presents complete scenarios of several types of SMTP
2911 sessions.
2912
2913 A Typical SMTP Transaction Scenario
2914
2915 This SMTP example shows mail sent by Smith at host USC-ISIF, to
2916 Jones, Green, and Brown at host BBN-UNIX. Here we assume that
2917 host USC-ISIF contacts host BBN-UNIX directly. The mail is
2918 accepted for Jones and Brown. Green does not have a mailbox at
2919 host BBN-UNIX.
2920
2921 -------------------------------------------------------------
2922
2923 R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
2924 S: HELO USC-ISIF.ARPA
2925 R: 250 BBN-UNIX.ARPA
2926
2927 S: MAIL FROM:&lt;[email protected]&gt;
2928 R: 250 OK
2929
2930 S: RCPT TO:&lt;[email protected]&gt;
2931 R: 250 OK
2932
2933 S: RCPT TO:&lt;[email protected]&gt;
2934 R: 550 No such user here
2935
2936 S: RCPT TO:&lt;[email protected]&gt;
2937 R: 250 OK
2938
2939 S: DATA
2940 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
2941 S: Blah blah blah...
2942 S: ...etc. etc. etc.
2943 S: .
2944 R: 250 OK
2945
2946 S: QUIT
2947 R: 221 BBN-UNIX.ARPA Service closing transmission channel
2948
2949 Scenario 1
2950
2951 -------------------------------------------------------------
2952
2953
2954
2955 <span class="grey">Postel [Page 51]</span></pre>
2956 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
2957 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
2958 Simple Mail Transfer Protocol
2959
2960
2961
2962 Aborted SMTP Transaction Scenario
2963
2964 -------------------------------------------------------------
2965
2966 R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready
2967 S: HELO ISI-VAXA.ARPA
2968 R: 250 MIT-Multics.ARPA
2969
2970 S: MAIL FROM:&lt;[email protected]&gt;
2971 R: 250 OK
2972
2973 S: RCPT TO:&lt;[email protected]&gt;
2974 R: 250 OK
2975
2976 S: RCPT TO:&lt;[email protected]&gt;
2977 R: 550 No such user here
2978
2979 S: RSET
2980 R: 250 OK
2981
2982 S: QUIT
2983 R: 221 MIT-Multics.ARPA Service closing transmission channel
2984
2985 Scenario 2
2986
2987 -------------------------------------------------------------
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011 [Page 52] Postel</pre>
3012 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
3013 <a href="./rfc821">RFC 821</a> August 1982
3014 Simple Mail Transfer Protocol
3015
3016
3017
3018 Relayed Mail Scenario
3019
3020 -------------------------------------------------------------
3021
3022 Step 1 -- Source Host to Relay Host
3023
3024 R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
3025 S: HELO MIT-AI.ARPA
3026 R: 250 USC-ISIE.ARPA
3027
3028 S: MAIL FROM:&lt;[email protected]&gt;
3029 R: 250 OK
3030
3031 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3032 R: 250 OK
3033
3034 S: DATA
3035 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3036 S: Date: 2 Nov 81 22:33:44
3037 S: From: John Q. Public &lt;[email protected]&gt;
3038 S: Subject: The Next Meeting of the Board
3039 S: To: [email protected]
3040 S:
3041 S: Bill:
3042 S: The next meeting of the board of directors will be
3043 S: on Tuesday.
3044 S: John.
3045 S: .
3046 R: 250 OK
3047
3048 S: QUIT
3049 R: 221 USC-ISIE.ARPA Service closing transmission channel
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067 <span class="grey">Postel [Page 53]</span></pre>
3068 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
3069 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3070 Simple Mail Transfer Protocol
3071
3072
3073
3074 Step 2 -- Relay Host to Destination Host
3075
3076 R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready
3077 S: HELO USC-ISIE.ARPA
3078 R: 250 BBN-VAX.ARPA
3079
3080 S: MAIL FROM:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3081 R: 250 OK
3082
3083 S: RCPT TO:&lt;[email protected]&gt;
3084 R: 250 OK
3085
3086 S: DATA
3087 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3088 S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ;
3089 2 Nov 81 22:40:10 UT
3090 S: Date: 2 Nov 81 22:33:44
3091 S: From: John Q. Public &lt;[email protected]&gt;
3092 S: Subject: The Next Meeting of the Board
3093 S: To: [email protected]
3094 S:
3095 S: Bill:
3096 S: The next meeting of the board of directors will be
3097 S: on Tuesday.
3098 S: John.
3099 S: .
3100 R: 250 OK
3101
3102 S: QUIT
3103 R: 221 USC-ISIE.ARPA Service closing transmission channel
3104
3105 Scenario 3
3106
3107 -------------------------------------------------------------
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123 [Page 54] Postel</pre>
3124 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
3125 <a href="./rfc821">RFC 821</a> August 1982
3126 Simple Mail Transfer Protocol
3127
3128
3129
3130 Verifying and Sending Scenario
3131
3132 -------------------------------------------------------------
3133
3134 R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
3135 S: HELO MIT-MC.ARPA
3136 R: 250 SU-SCORE.ARPA
3137
3138 S: VRFY Crispin
3139 R: 250 Mark Crispin &lt;[email protected]&gt;
3140
3141 S: SEND FROM:&lt;[email protected]&gt;
3142 R: 250 OK
3143
3144 S: RCPT TO:&lt;[email protected]&gt;
3145 R: 250 OK
3146
3147 S: DATA
3148 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3149 S: Blah blah blah...
3150 S: ...etc. etc. etc.
3151 S: .
3152 R: 250 OK
3153
3154 S: QUIT
3155 R: 221 SU-SCORE.ARPA Service closing transmission channel
3156
3157 Scenario 4
3158
3159 -------------------------------------------------------------
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179 <span class="grey">Postel [Page 55]</span></pre>
3180 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
3181 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3182 Simple Mail Transfer Protocol
3183
3184
3185
3186 Sending and Mailing Scenarios
3187
3188 First the user's name is verified, then an attempt is made to
3189 send to the user's terminal. When that fails, the messages is
3190 mailed to the user's mailbox.
3191
3192 -------------------------------------------------------------
3193
3194 R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
3195 S: HELO MIT-MC.ARPA
3196 R: 250 SU-SCORE.ARPA
3197
3198 S: VRFY Crispin
3199 R: 250 Mark Crispin &lt;[email protected]&gt;
3200
3201 S: SEND FROM:&lt;[email protected]&gt;
3202 R: 250 OK
3203
3204 S: RCPT TO:&lt;[email protected]&gt;
3205 R: 450 User not active now
3206
3207 S: RSET
3208 R: 250 OK
3209
3210 S: MAIL FROM:&lt;[email protected]&gt;
3211 R: 250 OK
3212
3213 S: RCPT TO:&lt;[email protected]&gt;
3214 R: 250 OK
3215
3216 S: DATA
3217 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3218 S: Blah blah blah...
3219 S: ...etc. etc. etc.
3220 S: .
3221 R: 250 OK
3222
3223 S: QUIT
3224 R: 221 SU-SCORE.ARPA Service closing transmission channel
3225
3226 Scenario 5
3227
3228 -------------------------------------------------------------
3229
3230
3231
3232
3233
3234
3235 [Page 56] Postel</pre>
3236 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
3237 <a href="./rfc821">RFC 821</a> August 1982
3238 Simple Mail Transfer Protocol
3239
3240
3241
3242 Doing the preceding scenario more efficiently.
3243
3244 -------------------------------------------------------------
3245
3246 R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
3247 S: HELO MIT-MC.ARPA
3248 R: 250 SU-SCORE.ARPA
3249
3250 S: VRFY Crispin
3251 R: 250 Mark Crispin &lt;[email protected]&gt;
3252
3253 S: SOML FROM:&lt;[email protected]&gt;
3254 R: 250 OK
3255
3256 S: RCPT TO:&lt;[email protected]&gt;
3257 R: 250 User not active now, so will do mail.
3258
3259 S: DATA
3260 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3261 S: Blah blah blah...
3262 S: ...etc. etc. etc.
3263 S: .
3264 R: 250 OK
3265
3266 S: QUIT
3267 R: 221 SU-SCORE.ARPA Service closing transmission channel
3268
3269 Scenario 6
3270
3271 -------------------------------------------------------------
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291 <span class="grey">Postel [Page 57]</span></pre>
3292 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
3293 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3294 Simple Mail Transfer Protocol
3295
3296
3297
3298 Mailing List Scenario
3299
3300 First each of two mailing lists are expanded in separate sessions
3301 with different hosts. Then the message is sent to everyone that
3302 appeared on either list (but no duplicates) via a relay host.
3303
3304 -------------------------------------------------------------
3305
3306 Step 1 -- Expanding the First List
3307
3308 R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready
3309 S: HELO SU-SCORE.ARPA
3310 R: 250 MIT-AI.ARPA
3311
3312 S: EXPN Example-People
3313 R: 250-&lt;[email protected]&gt;
3314 R: 250-Fred Fonebone &lt;[email protected]&gt;
3315 R: 250-Xenon Y. Zither &lt;[email protected]&gt;
3316 R: 250-Quincy Smith &lt;@USC-ISIF.ARPA:[email protected]&gt;
3317 R: 250-&lt;[email protected]&gt;
3318 R: 250 &lt;[email protected]&gt;
3319
3320 S: QUIT
3321 R: 221 MIT-AI.ARPA Service closing transmission channel
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347 [Page 58] Postel</pre>
3348 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
3349 <a href="./rfc821">RFC 821</a> August 1982
3350 Simple Mail Transfer Protocol
3351
3352
3353
3354 Step 2 -- Expanding the Second List
3355
3356 R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready
3357 S: HELO SU-SCORE.ARPA
3358 R: 250 MIT-MC.ARPA
3359
3360 S: EXPN Interested-Parties
3361 R: 250-Al Calico &lt;[email protected]&gt;
3362 R: 250-&lt;[email protected]&gt;
3363 R: 250-Quincy Smith &lt;@USC-ISIF.ARPA:[email protected]&gt;
3364 R: 250-&lt;[email protected]&gt;
3365 R: 250 &lt;[email protected]&gt;
3366
3367 S: QUIT
3368 R: 221 MIT-MC.ARPA Service closing transmission channel
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403 <span class="grey">Postel [Page 59]</span></pre>
3404 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
3405 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3406 Simple Mail Transfer Protocol
3407
3408
3409
3410 Step 3 -- Mailing to All via a Relay Host
3411
3412 R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
3413 S: HELO SU-SCORE.ARPA
3414 R: 250 USC-ISIE.ARPA
3415
3416 S: MAIL FROM:&lt;[email protected]&gt;
3417 R: 250 OK
3418 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3419 R: 250 OK
3420 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3421 R: 250 OK
3422 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3423 R: 250 OK
3424 S: RCPT
3425 TO:&lt;@USC-ISIE.ARPA,@USC-ISIF.ARPA:[email protected]&gt;
3426 R: 250 OK
3427 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3428 R: 250 OK
3429 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3430 R: 250 OK
3431 S: RCPT TO:&lt;@USC-ISIE.ARPA:[email protected]&gt;
3432 R: 250 OK
3433
3434 S: DATA
3435 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3436 S: Blah blah blah...
3437 S: ...etc. etc. etc.
3438 S: .
3439 R: 250 OK
3440
3441 S: QUIT
3442 R: 221 USC-ISIE.ARPA Service closing transmission channel
3443
3444 Scenario 7
3445
3446 -------------------------------------------------------------
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459 [Page 60] Postel</pre>
3460 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
3461 <a href="./rfc821">RFC 821</a> August 1982
3462 Simple Mail Transfer Protocol
3463
3464
3465
3466 Forwarding Scenarios
3467
3468 -------------------------------------------------------------
3469
3470 R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready
3471 S: HELO LBL-UNIX.ARPA
3472 R: 250 USC-ISIF.ARPA
3473
3474 S: MAIL FROM:&lt;[email protected]&gt;
3475 R: 250 OK
3476
3477 S: RCPT TO:&lt;[email protected]&gt;
3478 R: 251 User not local; will forward to &lt;[email protected]&gt;
3479
3480 S: DATA
3481 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3482 S: Blah blah blah...
3483 S: ...etc. etc. etc.
3484 S: .
3485 R: 250 OK
3486
3487 S: QUIT
3488 R: 221 USC-ISIF.ARPA Service closing transmission channel
3489
3490 Scenario 8
3491
3492 -------------------------------------------------------------
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515 <span class="grey">Postel [Page 61]</span></pre>
3516 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
3517 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3518 Simple Mail Transfer Protocol
3519
3520
3521
3522 -------------------------------------------------------------
3523
3524 Step 1 -- Trying the Mailbox at the First Host
3525
3526 R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready
3527 S: HELO LBL-UNIX.ARPA
3528 R: 250 USC-ISIF.ARPA
3529
3530 S: MAIL FROM:&lt;[email protected]&gt;
3531 R: 250 OK
3532
3533 S: RCPT TO:&lt;[email protected]&gt;
3534 R: 251 User not local; will forward to &lt;[email protected]&gt;
3535
3536 S: RSET
3537 R: 250 OK
3538
3539 S: QUIT
3540 R: 221 USC-ISIF.ARPA Service closing transmission channel
3541
3542 Step 2 -- Delivering the Mail at the Second Host
3543
3544 R: 220 USC-ISI.ARPA Simple Mail Transfer Service Ready
3545 S: HELO LBL-UNIX.ARPA
3546 R: 250 USC-ISI.ARPA
3547
3548 S: MAIL FROM:&lt;[email protected]&gt;
3549 R: 250 OK
3550
3551 S: RCPT TO:&lt;[email protected]&gt;
3552 R: OK
3553
3554 S: DATA
3555 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3556 S: Blah blah blah...
3557 S: ...etc. etc. etc.
3558 S: .
3559 R: 250 OK
3560
3561 S: QUIT
3562 R: 221 USC-ISI.ARPA Service closing transmission channel
3563
3564 Scenario 9
3565
3566 -------------------------------------------------------------
3567
3568
3569
3570
3571 [Page 62] Postel</pre>
3572 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
3573 <a href="./rfc821">RFC 821</a> August 1982
3574 Simple Mail Transfer Protocol
3575
3576
3577
3578 Too Many Recipients Scenario
3579
3580 -------------------------------------------------------------
3581
3582 R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready
3583 S: HELO USC-ISIF.ARPA
3584 R: 250 BERKELEY.ARPA
3585
3586 S: MAIL FROM:&lt;[email protected]&gt;
3587 R: 250 OK
3588
3589 S: RCPT TO:&lt;[email protected]&gt;
3590 R: 250 OK
3591
3592 S: RCPT TO:&lt;[email protected]&gt;
3593 R: 552 Recipient storage full, try again in another transaction
3594
3595 S: DATA
3596 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3597 S: Blah blah blah...
3598 S: ...etc. etc. etc.
3599 S: .
3600 R: 250 OK
3601
3602 S: MAIL FROM:&lt;[email protected]&gt;
3603 R: 250 OK
3604
3605 S: RCPT TO:&lt;[email protected]&gt;
3606 R: 250 OK
3607
3608 S: DATA
3609 R: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
3610 S: Blah blah blah...
3611 S: ...etc. etc. etc.
3612 S: .
3613 R: 250 OK
3614
3615 S: QUIT
3616 R: 221 BERKELEY.ARPA Service closing transmission channel
3617
3618 Scenario 10
3619
3620 -------------------------------------------------------------
3621
3622 Note that a real implementation must handle many recipients as
3623 specified in <a href="#section-4.5.3">Section 4.5.3</a>.
3624
3625
3626
3627 <span class="grey">Postel [Page 63]</span></pre>
3628 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
3629 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3630 Simple Mail Transfer Protocol
3631
3632
3633
3634 GLOSSARY
3635
3636 ASCII
3637
3638 American Standard Code for Information Interchange [<a href="#ref-1">1</a>].
3639
3640 command
3641
3642 A request for a mail service action sent by the sender-SMTP to the
3643 receiver-SMTP.
3644
3645 domain
3646
3647 The hierarchially structured global character string address of a
3648 host computer in the mail system.
3649
3650 end of mail data indication
3651
3652 A special sequence of characters that indicates the end of the
3653 mail data. In particular, the five characters carriage return,
3654 line feed, period, carriage return, line feed, in that order.
3655
3656 host
3657
3658 A computer in the internetwork environment on which mailboxes or
3659 SMTP processes reside.
3660
3661 line
3662
3663 A a sequence of ASCII characters ending with a &lt;CRLF&gt;.
3664
3665 mail data
3666
3667 A sequence of ASCII characters of arbitrary length, which conforms
3668 to the standard set in the Standard for the Format of ARPA
3669 Internet Text Messages (<a href="./rfc822">RFC 822</a> [<a href="#ref-2">2</a>]).
3670
3671 mailbox
3672
3673 A character string (address) which identifies a user to whom mail
3674 is to be sent. Mailbox normally consists of the host and user
3675 specifications. The standard mailbox naming convention is defined
3676 to be "user@domain". Additionally, the "container" in which mail
3677 is stored.
3678
3679
3680
3681
3682
3683 [Page 64] Postel</pre>
3684 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
3685 <a href="./rfc821">RFC 821</a> August 1982
3686 Simple Mail Transfer Protocol
3687
3688
3689
3690 receiver-SMTP process
3691
3692 A process which transfers mail in cooperation with a sender-SMTP
3693 process. It waits for a connection to be established via the
3694 transport service. It receives SMTP commands from the
3695 sender-SMTP, sends replies, and performs the specified operations.
3696
3697 reply
3698
3699 A reply is an acknowledgment (positive or negative) sent from
3700 receiver to sender via the transmission channel in response to a
3701 command. The general form of a reply is a completion code
3702 (including error codes) followed by a text string. The codes are
3703 for use by programs and the text is usually intended for human
3704 users.
3705
3706 sender-SMTP process
3707
3708 A process which transfers mail in cooperation with a receiver-SMTP
3709 process. A local language may be used in the user interface
3710 command/reply dialogue. The sender-SMTP initiates the transport
3711 service connection. It initiates SMTP commands, receives replies,
3712 and governs the transfer of mail.
3713
3714 session
3715
3716 The set of exchanges that occur while the transmission channel is
3717 open.
3718
3719 transaction
3720
3721 The set of exchanges required for one message to be transmitted
3722 for one or more recipients.
3723
3724 transmission channel
3725
3726 A full-duplex communication path between a sender-SMTP and a
3727 receiver-SMTP for the exchange of commands, replies, and mail
3728 text.
3729
3730 transport service
3731
3732 Any reliable stream-oriented data communication services. For
3733 example, NCP, TCP, NITS.
3734
3735
3736
3737
3738
3739 <span class="grey">Postel [Page 65]</span></pre>
3740 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
3741 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3742 Simple Mail Transfer Protocol
3743
3744
3745
3746 user
3747
3748 A human being (or a process on behalf of a human being) wishing to
3749 obtain mail transfer service. In addition, a recipient of
3750 computer mail.
3751
3752 word
3753
3754 A sequence of printing characters.
3755
3756 &lt;CRLF&gt;
3757
3758 The characters carriage return and line feed (in that order).
3759
3760 &lt;SP&gt;
3761
3762 The space character.
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795 [Page 66] Postel</pre>
3796 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
3797 <a href="./rfc821">RFC 821</a> August 1982
3798 Simple Mail Transfer Protocol
3799
3800
3801
3802 REFERENCES
3803
3804 [<a id="ref-1">1</a>] ASCII
3805
3806 ASCII, "USA Code for Information Interchange", United States of
3807 America Standards Institute, X3.4, 1968. Also in: Feinler, E.
3808 and J. Postel, eds., "ARPANET Protocol Handbook", NIC 7104, for
3809 the Defense Communications Agency by SRI International, Menlo
3810 Park, California, Revised January 1978.
3811
3812 [<a id="ref-2">2</a>] <a href="./rfc822">RFC 822</a>
3813
3814 Crocker, D., "Standard for the Format of ARPA Internet Text
3815 Messages," <a href="./rfc822">RFC 822</a>, Department of Electrical Engineering,
3816 University of Delaware, August 1982.
3817
3818 [<a id="ref-3">3</a>] TCP
3819
3820 Postel, J., ed., "Transmission Control Protocol - DARPA Internet
3821 Program Protocol Specification", <a href="./rfc793">RFC 793</a>, USC/Information Sciences
3822 Institute, NTIS AD Number A111091, September 1981. Also in:
3823 Feinler, E. and J. Postel, eds., "Internet Protocol Transition
3824 Workbook", SRI International, Menlo Park, California, March 1982.
3825
3826 [<a id="ref-4">4</a>] NCP
3827
3828 McKenzie,A., "Host/Host Protocol for the ARPA Network", NIC 8246,
3829 January 1972. Also in: Feinler, E. and J. Postel, eds., "ARPANET
3830 Protocol Handbook", NIC 7104, for the Defense Communications
3831 Agency by SRI International, Menlo Park, California, Revised
3832 January 1978.
3833
3834 [<a id="ref-5">5</a>] Initial Connection Protocol
3835
3836 Postel, J., "Official Initial Connection Protocol", NIC 7101,
3837 11 June 1971. Also in: Feinler, E. and J. Postel, eds., "ARPANET
3838 Protocol Handbook", NIC 7104, for the Defense Communications
3839 Agency by SRI International, Menlo Park, California, Revised
3840 January 1978.
3841
3842 [<a id="ref-6">6</a>] NITS
3843
3844 PSS/SG3, "A Network Independent Transport Service", Study Group 3,
3845 The Post Office PSS Users Group, February 1980. Available from
3846 the DCPU, National Physical Laboratory, Teddington, UK.
3847
3848
3849
3850
3851 <span class="grey">Postel [Page 67]</span></pre>
3852 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
3853 <span class="grey">August 1982 <a href="./rfc821">RFC 821</a></span>
3854 Simple Mail Transfer Protocol
3855
3856
3857
3858 [<a id="ref-7">7</a>] X.25
3859
3860 CCITT, "Recommendation X.25 - Interface Between Data Terminal
3861 Equipment (DTE) and Data Circuit-terminating Equipment (DCE) for
3862 Terminals Operating in the Packet Mode on Public Data Networks,"
3863 CCITT Orange Book, Vol. VIII.2, International Telephone and
3864 Telegraph Consultative Committee, Geneva, 1976.
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907 [Page 68] Postel
3908 </pre>