aboutsummaryrefslogtreecommitdiffstats
path: root/docs/RFC 2821 - Simple Mail Transfer Protocol.html
blob: 19f2bbccd8f04138aca16f6c33a9d0277dac0109 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
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
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
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
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
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
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
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
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
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
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
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
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
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
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
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
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
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
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
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
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
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
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
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
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
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
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
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
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
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
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
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
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
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
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
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
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head profile="http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="robots" content="index,follow">
    <meta name="creator" content="rfcmarkup version 1.109">
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.Relation.Replaces" content="rfc821">
<meta name="DC.Relation.Replaces" content="rfc974">
<meta name="DC.Relation.Replaces" content="rfc1869">
<meta name="DC.Identifier" content="urn:ietf:rfc:2821">
<meta name="DC.Date.Issued" content="April, 2001">
<meta name="DC.Creator" content="John C. Klensin &lt;klensin@research.att.com&gt;">
<meta name="DC.Description.Abstract" content="This document is a self-contained specification of the basic protocol
for the Internet electronic mail transport. [STANDARDS-TRACK]">
<meta name="DC.Title" content="Simple Mail Transfer Protocol">

    <link rel="icon" href="index_files/rfc.png" type="image/png">
    <link rel="shortcut icon" href="index_files/rfc.png" type="image/png">
    <title>RFC 2821 - Simple Mail Transfer Protocol</title>
    
    
    <style type="text/css"><!--
/* Effective stylesheet produced by snapshot save */
body { margin: 0px 8px; font-size: 1em; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { line-height: 0pt; display: inline; white-space: pre; font-family: monospace; font-size: 1em; font-weight: bold; }
pre { font-size: 1em; margin-top: 0px; margin-bottom: 0px; }
.pre { white-space: pre; font-family: monospace; }
.newpage { page-break-before: always; }
.invisible { text-decoration: none; color: white; }
a.selflink { color: black; text-decoration: none; }
@media print {
  body { font-family: monospace; font-size: 10.5pt; }
  h1, h2, h3, h4, h5, h6 { font-size: 1em; }
  a:link, a:visited { color: inherit; text-decoration: none; }
  .noprint { display: none; }
}
@media screen {
  .grey, .grey a:link, .grey a:visited { color: rgb(119, 119, 119); }
  .docinfo { background-color: rgb(238, 238, 238); }
  .top { border-top: 7px solid rgb(238, 238, 238); }
  .bgbrown { background-color: rgb(136, 68, 0); }
  .legend { font-size: 90%; }
}
--></style>
    <!--[if IE]>
    <style>
    body {
       font-size: 13px;
       margin: 10px 10px;
    }
    </style>
    <![endif]-->

    <script type="text/javascript"><!--

/* Script removed by snapshot save */

--></script>
</head>
<body onload="">
   <div style="height: 13px;">
      <div onmouseover="" onclick="" onmouseout="" style="height: 6px; position: absolute;" class="pre noprint docinfo bgbrown" title="Click for colour legend.">                                                                        </div>
      <div id="legend" class="docinfo noprint pre legend" style="position:absolute; top: 4px; left: 4ex; visibility:hidden; background-color: white; padding: 4px 9px 5px 7px; border: solid #345 1px; " onmouseover="" onmouseout="">
      </div>
   </div>
<span class="pre noprint docinfo top">[<a href="http://tools.ietf.org/html/" title="Document search and retrieval page">Docs</a>] [<a href="http://tools.ietf.org/rfc/rfc2821.txt" title="Plaintext version of this document">txt</a>|<a href="http://tools.ietf.org/pdf/rfc2821" title="PDF version of this document">pdf</a>] [<a href="http://tools.ietf.org/html/draft-ietf-drums-smtpupd" title="draft-ietf-drums-smtpupd">draft-ietf-drums-...</a>] [<a href="http://tools.ietf.org/rfcdiff?difftype=--hwdiff&amp;url2=rfc2821" title="Inline diff (wdiff)">Diff1</a>] [<a href="http://tools.ietf.org/rfcdiff?url2=rfc2821" title="Side-by-side diff">Diff2</a>] [<a href="https://www.rfc-editor.org/errata_search.php?rfc=2821">Errata</a>]        </span><br>
<span class="pre noprint docinfo">                                                                        </span><br>
<span class="pre noprint docinfo">Obsoleted by: <a href="http://tools.ietf.org/html/rfc5321">5321</a>                                     PROPOSED STANDARD</span><br>
<span class="pre noprint docinfo">Updated by: <a href="http://tools.ietf.org/html/rfc5336">5336</a>                                            <span style="color: #C00;">Errata Exist</span></span><br>
<pre>Network Working Group                                 J. Klensin, Editor
Request for Comments: 2821                             AT&amp;T Laboratories
Obsoletes: <a href="http://tools.ietf.org/html/rfc821">821</a>, <a href="http://tools.ietf.org/html/rfc974">974</a>, <a href="http://tools.ietf.org/html/rfc1869">1869</a>                                     April 2001
Updates: <a href="http://tools.ietf.org/html/rfc1123">1123</a>
Category: Standards Track


                     <span class="h1"><h1>Simple Mail Transfer Protocol</h1></span>

Status of this Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright Notice

   Copyright (C) The Internet Society (2001).  All Rights Reserved.

Abstract

   This document is a self-contained specification of the basic protocol
   for the Internet electronic mail transport.  It consolidates, updates
   and clarifies, but doesn't add new or change existing functionality
   of the following:

   -  the original SMTP (Simple Mail Transfer Protocol) specification of
      <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> [<a href="#ref-30" title='"Simple Mail Transfer Protocol"'>30</a>],

   -  domain name system requirements and implications for mail
      transport from <a href="http://tools.ietf.org/html/rfc1035">RFC 1035</a> [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>] and <a href="http://tools.ietf.org/html/rfc974">RFC 974</a> [<a href="#ref-27" title='"Mail routing and the domain system"'>27</a>],

   -  the clarifications and applicability statements in <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a> [<a href="#ref-2" title='"Requirements for Internet hosts - application and support"'>2</a>],
      and

   -  material drawn from the SMTP Extension mechanisms [<a href="#ref-19" title='"SMTP Service Extensions"'>19</a>].

   It obsoletes <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>, <a href="http://tools.ietf.org/html/rfc974">RFC 974</a>, and updates <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a> (replaces the
   mail transport materials of <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a>).  However, <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> specifies
   some features that were not in significant use in the Internet by the
   mid-1990s and (in appendices) some additional transport models.
   Those sections are omitted here in the interest of clarity and
   brevity; readers needing them should refer to <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>.






<span class="grey">Klensin                     Standards Track                     [Page 1]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-2" id="page-2" href="#page-2" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   It also includes some additional material from <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a> that required
   amplification.  This material has been identified in multiple ways,
   mostly by tracking flaming on various lists and newsgroups and
   problems of unusual readings or interpretations that have appeared as
   the SMTP extensions have been deployed.  Where this specification
   moves beyond consolidation and actually differs from earlier
   documents, it supersedes them technically as well as textually.

   Although SMTP was designed as a mail transport and delivery protocol,
   this specification also contains information that is important to its
   use as a 'mail submission' protocol, as recommended for POP [<a href="#ref-3" title='"Post Office Protocol - version 2"'>3</a>, <a href="#ref-26" title='"Post Office Protocol - Version 3"'>26</a>]
   and IMAP [<a href="#ref-6" title='"Internet Message Access Protocol - Version 4"'>6</a>].  Additional submission issues are discussed in <a href="http://tools.ietf.org/html/rfc2476">RFC 2476</a>
   [<a href="#ref-15" title='"Message Submission"'>15</a>].

   <a href="#section-2.3">Section 2.3</a> provides definitions of terms specific to this document.
   Except when the historical terminology is necessary for clarity, this
   document uses the current 'client' and 'server' terminology to
   identify the sending and receiving SMTP processes, respectively.

   A companion document [<a href="#ref-32" title='"Internet Message Format"'>32</a>] discusses message headers, message bodies
   and formats and structures for them, and their relationship.

Table of Contents

   <a href="#section-1">1</a>. Introduction ..................................................  <a href="#page-4">4</a>
   <a href="#section-2">2</a>. The SMTP Model ................................................  <a href="#page-5">5</a>
   <a href="#section-2.1">2.1</a> Basic Structure ..............................................  <a href="#page-5">5</a>
   <a href="#section-2.2">2.2</a> The Extension Model ..........................................  <a href="#page-7">7</a>
   <a href="#section-2.2.1">2.2.1</a> Background .................................................  <a href="#page-7">7</a>
   <a href="#section-2.2.2">2.2.2</a> Definition and Registration of Extensions ..................  <a href="#page-8">8</a>
   <a href="#section-2.3">2.3</a> Terminology ..................................................  <a href="#page-9">9</a>
   <a href="#section-2.3.1">2.3.1</a> Mail Objects ............................................... <a href="#page-10">10</a>
   <a href="#section-2.3.2">2.3.2</a> Senders and Receivers ...................................... <a href="#page-10">10</a>
   <a href="#section-2.3.3">2.3.3</a> Mail Agents and Message Stores ............................. <a href="#page-10">10</a>
   <a href="#section-2.3.4">2.3.4</a> Host ....................................................... <a href="#page-11">11</a>
   <a href="#section-2.3.5">2.3.5</a> Domain ..................................................... <a href="#page-11">11</a>
   <a href="#section-2.3.6">2.3.6</a> Buffer and State Table ..................................... <a href="#page-11">11</a>
   <a href="#section-2.3.7">2.3.7</a> Lines ...................................................... <a href="#page-12">12</a>
   <a href="#section-2.3.8">2.3.8</a> Originator, Delivery, Relay, and Gateway Systems ........... <a href="#page-12">12</a>
   <a href="#section-2.3.9">2.3.9</a> Message Content and Mail Data .............................. <a href="#page-13">13</a>
   <a href="#section-2.3.10">2.3.10</a> Mailbox and Address ....................................... <a href="#page-13">13</a>
   <a href="#section-2.3.11">2.3.11</a> Reply ..................................................... <a href="#page-13">13</a>
   <a href="#section-2.4">2.4</a> General Syntax Principles and Transaction Model .............. <a href="#page-13">13</a>
   <a href="#section-3">3</a>. The SMTP Procedures: An Overview .............................. <a href="#page-15">15</a>
   <a href="#section-3.1">3.1</a> Session Initiation ........................................... <a href="#page-15">15</a>
   <a href="#section-3.2">3.2</a> Client Initiation ............................................ <a href="#page-16">16</a>
   <a href="#section-3.3">3.3</a> Mail Transactions ............................................ <a href="#page-16">16</a>
   <a href="#section-3.4">3.4</a> Forwarding for Address Correction or Updating ................ <a href="#page-19">19</a>



<span class="grey">Klensin                     Standards Track                     [Page 2]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-3" id="page-3" href="#page-3" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   <a href="#section-3.5">3.5</a> Commands for Debugging Addresses ............................. <a href="#page-20">20</a>
   <a href="#section-3.5.1">3.5.1</a> Overview ................................................... <a href="#page-20">20</a>
   <a href="#section-3.5.2">3.5.2</a> VRFY Normal Response ....................................... <a href="#page-22">22</a>
   <a href="#section-3.5.3">3.5.3</a> Meaning of VRFY or EXPN Success Response ................... <a href="#page-22">22</a>
   <a href="#section-3.5.4">3.5.4</a> Semantics and Applications of EXPN ......................... <a href="#page-23">23</a>
   <a href="#section-3.6">3.6</a> Domains ...................................................... <a href="#page-23">23</a>
   <a href="#section-3.7">3.7</a> Relaying ..................................................... <a href="#page-24">24</a>
   <a href="#section-3.8">3.8</a> Mail Gatewaying .............................................. <a href="#page-25">25</a>
   <a href="#section-3.8.1">3.8.1</a> Header Fields in Gatewaying ................................ <a href="#page-26">26</a>
   <a href="#section-3.8.2">3.8.2</a> Received Lines in Gatewaying ............................... <a href="#page-26">26</a>
   <a href="#section-3.8.3">3.8.3</a> Addresses in Gatewaying .................................... <a href="#page-26">26</a>
   <a href="#section-3.8.4">3.8.4</a> Other Header Fields in Gatewaying .......................... <a href="#page-27">27</a>
   <a href="#section-3.8.5">3.8.5</a> Envelopes in Gatewaying .................................... <a href="#page-27">27</a>
   <a href="#section-3.9">3.9</a> Terminating Sessions and Connections ......................... <a href="#page-27">27</a>
   <a href="#section-3.10">3.10</a> Mailing Lists and Aliases ................................... <a href="#page-28">28</a>
   <a href="#section-3.10.1">3.10.1</a> Alias ..................................................... <a href="#page-28">28</a>
   <a href="#section-3.10.2">3.10.2</a> List ...................................................... <a href="#page-28">28</a>
   <a href="#section-4">4</a>. The SMTP Specifications ....................................... <a href="#page-29">29</a>
   <a href="#section-4.1">4.1</a> SMTP Commands ................................................ <a href="#page-29">29</a>
   <a href="#section-4.1.1">4.1.1</a> Command Semantics and Syntax ............................... <a href="#page-29">29</a>
   <a href="#section-4.1.1.1">4.1.1.1</a>  Extended HELLO (EHLO) or HELLO (HELO) ................... <a href="#page-29">29</a>
   <a href="#section-4.1.1.2">4.1.1.2</a> MAIL (MAIL) .............................................. <a href="#page-31">31</a>
   <a href="#section-4.1.1.3">4.1.1.3</a> RECIPIENT (RCPT) ......................................... <a href="#page-31">31</a>
   <a href="#section-4.1.1.4">4.1.1.4</a> DATA (DATA) .............................................. <a href="#page-33">33</a>
   <a href="#section-4.1.1.5">4.1.1.5</a> RESET (RSET) ............................................. <a href="#page-34">34</a>
   <a href="#section-4.1.1.6">4.1.1.6</a> VERIFY (VRFY) ............................................ <a href="#page-35">35</a>
   <a href="#section-4.1.1.7">4.1.1.7</a> EXPAND (EXPN) ............................................ <a href="#page-35">35</a>
   <a href="#section-4.1.1.8">4.1.1.8</a> HELP (HELP) .............................................. <a href="#page-35">35</a>
   <a href="#section-4.1.1.9">4.1.1.9</a> NOOP (NOOP) .............................................. <a href="#page-35">35</a>
   <a href="#section-4.1.1.10">4.1.1.10</a> QUIT (QUIT) ............................................. <a href="#page-36">36</a>
   <a href="#section-4.1.2">4.1.2</a> Command Argument Syntax .................................... <a href="#page-36">36</a>
   <a href="#section-4.1.3">4.1.3</a> Address Literals ........................................... <a href="#page-38">38</a>
   <a href="#section-4.1.4">4.1.4</a> Order of Commands .......................................... <a href="#page-39">39</a>
   <a href="#section-4.1.5">4.1.5</a> Private-use Commands ....................................... <a href="#page-40">40</a>
   <a href="#section-4.2">4.2</a>  SMTP Replies ................................................ <a href="#page-40">40</a>
   <a href="#section-4.2.1">4.2.1</a> Reply Code Severities and Theory ........................... <a href="#page-42">42</a>
   <a href="#section-4.2.2">4.2.2</a> Reply Codes by Function Groups ............................. <a href="#page-44">44</a>
   <a href="#section-4.2.3">4.2.3</a>  Reply Codes in Numeric Order .............................. <a href="#page-45">45</a>
   <a href="#section-4.2.4">4.2.4</a> Reply Code 502 ............................................. <a href="#page-46">46</a>
   <a href="#section-4.2.5">4.2.5</a> Reply Codes After DATA and the Subsequent &lt;CRLF&gt;.&lt;CRLF&gt; .... <a href="#page-46">46</a>
   <a href="#section-4.3">4.3</a> Sequencing of Commands and Replies ........................... <a href="#page-47">47</a>
   <a href="#section-4.3.1">4.3.1</a> Sequencing Overview ........................................ <a href="#page-47">47</a>
   <a href="#section-4.3.2">4.3.2</a> Command-Reply Sequences .................................... <a href="#page-48">48</a>
   <a href="#section-4.4">4.4</a> Trace Information ............................................ <a href="#page-49">49</a>
   <a href="#section-4.5">4.5</a> Additional Implementation Issues ............................. <a href="#page-53">53</a>
   <a href="#section-4.5.1">4.5.1</a> Minimum Implementation ..................................... <a href="#page-53">53</a>
   <a href="#section-4.5.2">4.5.2</a> Transparency ............................................... <a href="#page-53">53</a>
   <a href="#section-4.5.3">4.5.3</a> Sizes and Timeouts ......................................... <a href="#page-54">54</a>



<span class="grey">Klensin                     Standards Track                     [Page 3]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-4" id="page-4" href="#page-4" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   <a href="#section-4.5.3.1">4.5.3.1</a> Size limits and minimums ................................. <a href="#page-54">54</a>
   <a href="#section-4.5.3.2">4.5.3.2</a> Timeouts ................................................. <a href="#page-56">56</a>
   <a href="#section-4.5.4">4.5.4</a> Retry Strategies ........................................... <a href="#page-57">57</a>
   <a href="#section-4.5.4.1">4.5.4.1</a> Sending Strategy ......................................... <a href="#page-58">58</a>
   <a href="#section-4.5.4.2">4.5.4.2</a> Receiving Strategy ....................................... <a href="#page-59">59</a>
   <a href="#section-4.5.5">4.5.5</a> Messages with a null reverse-path .......................... <a href="#page-59">59</a>
   <a href="#section-5">5</a>. Address Resolution and Mail Handling .......................... <a href="#page-60">60</a>
   <a href="#section-6">6</a>. Problem Detection and Handling ................................ <a href="#page-62">62</a>
   <a href="#section-6.1">6.1</a> Reliable Delivery and Replies by Email ....................... <a href="#page-62">62</a>
   <a href="#section-6.2">6.2</a> Loop Detection ............................................... <a href="#page-63">63</a>
   <a href="#section-6.3">6.3</a> Compensating for Irregularities .............................. <a href="#page-63">63</a>
   <a href="#section-7">7</a>. Security Considerations ....................................... <a href="#page-64">64</a>
   <a href="#section-7.1">7.1</a> Mail Security and Spoofing ................................... <a href="#page-64">64</a>
   <a href="#section-7.2">7.2</a> "Blind" Copies ............................................... <a href="#page-65">65</a>
   <a href="#section-7.3">7.3</a> VRFY, EXPN, and Security ..................................... <a href="#page-65">65</a>
   <a href="#section-7.4">7.4</a> Information Disclosure in Announcements ...................... <a href="#page-66">66</a>
   <a href="#section-7.5">7.5</a> Information Disclosure in Trace Fields ....................... <a href="#page-66">66</a>
   <a href="#section-7.6">7.6</a> Information Disclosure in Message Forwarding ................. <a href="#page-67">67</a>
   <a href="#section-7.7">7.7</a> Scope of Operation of SMTP Servers ........................... <a href="#page-67">67</a>
   <a href="#section-8">8</a>. IANA Considerations ........................................... <a href="#page-67">67</a>
   <a href="#section-9">9</a>. References .................................................... <a href="#page-68">68</a>
   <a href="#section-10">10</a>. Editor's Address ............................................. <a href="#page-70">70</a>
   <a href="#section-11">11</a>. Acknowledgments .............................................. <a href="#page-70">70</a>
   Appendices ....................................................... <a href="#page-71">71</a>
   <a href="#appendix-A">A</a>. TCP Transport Service ......................................... <a href="#page-71">71</a>
   <a href="#appendix-B">B</a>. Generating SMTP Commands from <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> Headers ................. <a href="#page-71">71</a>
   <a href="#appendix-C">C</a>. Source Routes ................................................. <a href="#page-72">72</a>
   <a href="#appendix-D">D</a>. Scenarios ..................................................... <a href="#page-73">73</a>
   <a href="#appendix-E">E</a>. Other Gateway Issues .......................................... <a href="#page-76">76</a>
   <a href="#appendix-F">F</a>. Deprecated Features of <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> ................................ <a href="#page-76">76</a>
   Full Copyright Statement ......................................... <a href="#page-79">79</a>

<span class="h2"><h2><a class="selflink" name="section-1" href="#section-1">1</a>. Introduction</h2></span>

   The objective of the Simple Mail Transfer Protocol (SMTP) is to
   transfer mail reliably and efficiently.

   SMTP is independent of the particular transmission subsystem and
   requires only a reliable ordered data stream channel.  While this
   document specifically discusses transport over TCP, other transports
   are possible.  Appendices to <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> describe some of them.

   An important feature of SMTP is its capability to transport mail
   across networks, usually referred to as "SMTP mail relaying" (see
   <a href="#section-3.8">section 3.8</a>).  A network consists of the mutually-TCP-accessible
   hosts on the public Internet, the mutually-TCP-accessible hosts on a
   firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN
   environment utilizing a non-TCP transport-level protocol.  Using



<span class="grey">Klensin                     Standards Track                     [Page 4]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-5" id="page-5" href="#page-5" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   SMTP, a process can transfer mail to another process on the same
   network or to some other network via a relay or gateway process
   accessible to both networks.

   In this way, a mail message may pass through a number of intermediate
   relay or gateway hosts on its path from sender to ultimate recipient.
   The Mail eXchanger mechanisms of the domain name system [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>, <a href="#ref-27" title='"Mail routing and the domain system"'>27</a>] (and
   <a href="#section-5">section 5</a> of this document) are used to identify the appropriate
   next-hop destination for a message being transported.

<span class="h2"><h2><a class="selflink" name="section-2" href="#section-2">2</a>. The SMTP Model</h2></span>

<span class="h3"><h3><a class="selflink" name="section-2.1" href="#section-2.1">2.1</a> Basic Structure</h3></span>

   The SMTP design can be pictured as:

               +----------+                +----------+
   +------+    |          |                |          |
   | User |&lt;--&gt;|          |      SMTP      |          |
   +------+    |  Client- |Commands/Replies| Server-  |
   +------+    |   SMTP   |&lt;--------------&gt;|    SMTP  |    +------+
   | File |&lt;--&gt;|          |    and Mail    |          |&lt;--&gt;| File |
   |System|    |          |                |          |    |System|
   +------+    +----------+                +----------+    +------+
                SMTP client                SMTP server

   When an SMTP client has a message to transmit, it establishes a two-
   way transmission channel to an SMTP server.  The responsibility of an
   SMTP client is to transfer mail messages to one or more SMTP servers,
   or report its failure to do so.

   The means by which a mail message is presented to an SMTP client, and
   how that client determines the domain name(s) to which mail messages
   are to be transferred is a local matter, and is not addressed by this
   document.  In some cases, the domain name(s) transferred to, or
   determined by, an SMTP client will identify the final destination(s)
   of the mail message.  In other cases, common with SMTP clients
   associated with implementations of the POP [<a href="#ref-3" title='"Post Office Protocol - version 2"'>3</a>, <a href="#ref-26" title='"Post Office Protocol - Version 3"'>26</a>] or IMAP [<a href="#ref-6" title='"Internet Message Access Protocol - Version 4"'>6</a>]
   protocols, or when the SMTP client is inside an isolated transport
   service environment, the domain name determined will identify an
   intermediate destination through which all mail messages are to be
   relayed.  SMTP clients that transfer all traffic, regardless of the
   target domain names associated with the individual messages, or that
   do not maintain queues for retrying message transmissions that
   initially cannot be completed, may otherwise conform to this
   specification but are not considered fully-capable.  Fully-capable
   SMTP implementations, including the relays used by these less capable




<span class="grey">Klensin                     Standards Track                     [Page 5]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-6" id="page-6" href="#page-6" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   ones, and their destinations, are expected to support all of the
   queuing, retrying, and alternate address functions discussed in this
   specification.

   The means by which an SMTP client, once it has determined a target
   domain name, determines the identity of an SMTP server to which a
   copy of a message is to be transferred, and then performs that
   transfer, is covered by this document.  To effect a mail transfer to
   an SMTP server, an SMTP client establishes a two-way transmission
   channel to that SMTP server.  An SMTP client determines the address
   of an appropriate host running an SMTP server by resolving a
   destination domain name to either an intermediate Mail eXchanger host
   or a final target host.

   An SMTP server may be either the ultimate destination or an
   intermediate "relay" (that is, it may assume the role of an SMTP
   client after receiving the message) or "gateway" (that is, it may
   transport the message further using some protocol other than SMTP).
   SMTP commands are generated by the SMTP client and sent to the SMTP
   server.  SMTP replies are sent from the SMTP server to the SMTP
   client in response to the commands.

   In other words, message transfer can occur in a single connection
   between the original SMTP-sender and the final SMTP-recipient, or can
   occur in a series of hops through intermediary systems.  In either
   case, a formal handoff of responsibility for the message occurs: the
   protocol requires that a server accept responsibility for either
   delivering a message or properly reporting the failure to do so.

   Once the transmission channel is established and initial handshaking
   completed, the SMTP client normally initiates a mail transaction.
   Such a transaction consists of a series of commands to specify the
   originator and destination of the mail and transmission of the
   message content (including any headers or other structure) itself.
   When the same message is sent to multiple recipients, this protocol
   encourages the transmission of only one copy of the data for all
   recipients at the same destination (or intermediate relay) host.

   The server responds to each command with a reply; replies may
   indicate that the command was accepted, that additional commands are
   expected, or that a temporary or permanent error condition exists.
   Commands specifying the sender or recipients may include server-
   permitted SMTP service extension requests as discussed in <a href="#section-2.2">section</a>
   <a href="#section-2.2">2.2</a>.  The dialog is purposely lock-step, one-at-a-time, although this
   can be modified by mutually-agreed extension requests such as command
   pipelining [<a href="#ref-13" title='"SMTP Service Extension for Command Pipelining"'>13</a>].





<span class="grey">Klensin                     Standards Track                     [Page 6]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-7" id="page-7" href="#page-7" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   Once a given mail message has been transmitted, the client may either
   request that the connection be shut down or may initiate other mail
   transactions.  In addition, an SMTP client may use a connection to an
   SMTP server for ancillary services such as verification of email
   addresses or retrieval of mailing list subscriber addresses.

   As suggested above, this protocol provides mechanisms for the
   transmission of mail.  This transmission normally occurs directly
   from the sending user's host to the receiving user's host when the
   two hosts are connected to the same transport service.  When they are
   not connected to the same transport service, transmission occurs via
   one or more relay SMTP servers.  An intermediate host that acts as
   either an SMTP relay or as a gateway into some other transmission
   environment is usually selected through the use of the domain name
   service (DNS) Mail eXchanger mechanism.

   Usually, intermediate hosts are determined via the DNS MX record, not
   by explicit "source" routing (see <a href="#section-5">section 5</a> and appendices C and
   F.2).

<span class="h3"><h3><a class="selflink" name="section-2.2" href="#section-2.2">2.2</a> The Extension Model</h3></span>

<span class="h4"><h4><a class="selflink" name="section-2.2.1" href="#section-2.2.1">2.2.1</a> Background</h4></span>

   In an effort that started in 1990, approximately a decade after <a href="http://tools.ietf.org/html/rfc821">RFC</a>
   <a href="http://tools.ietf.org/html/rfc821">821</a> was completed, the protocol was modified with a "service
   extensions" model that permits the client and server to agree to
   utilize shared functionality beyond the original SMTP requirements.
   The SMTP extension mechanism defines a means whereby an extended SMTP
   client and server may recognize each other, and the server can inform
   the client as to the service extensions that it supports.

   Contemporary SMTP implementations MUST support the basic extension
   mechanisms.  For instance, servers MUST support the EHLO command even
   if they do not implement any specific extensions and clients SHOULD
   preferentially utilize EHLO rather than HELO.  (However, for
   compatibility with older conforming implementations, SMTP clients and
   servers MUST support the original HELO mechanisms as a fallback.)
   Unless the different characteristics of HELO must be identified for
   interoperability purposes, this document discusses only EHLO.

   SMTP is widely deployed and high-quality implementations have proven
   to be very robust.  However, the Internet community now considers
   some services to be important that were not anticipated when the
   protocol was first designed.  If support for those services is to be
   added, it must be done in a way that permits older implementations to
   continue working acceptably.  The extension framework consists of:




<span class="grey">Klensin                     Standards Track                     [Page 7]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-8" id="page-8" href="#page-8" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   -  The SMTP command EHLO, superseding the earlier HELO,

   -  a registry of SMTP service extensions,

   -  additional parameters to the SMTP MAIL and RCPT commands, and

   -  optional replacements for commands defined in this protocol, such
      as for DATA in non-ASCII transmissions [<a href="#ref-33" title='"SMTP Service Extensions for Transmission of Large and Binary MIME Messages"'>33</a>].

   SMTP's strength comes primarily from its simplicity.  Experience with
   many protocols has shown that protocols with few options tend towards
   ubiquity, whereas protocols with many options tend towards obscurity.

   Each and every extension, regardless of its benefits, must be
   carefully scrutinized with respect to its implementation, deployment,
   and interoperability costs.  In many cases, the cost of extending the
   SMTP service will likely outweigh the benefit.

<span class="h4"><h4><a class="selflink" name="section-2.2.2" href="#section-2.2.2">2.2.2</a> Definition and Registration of Extensions</h4></span>

   The IANA maintains a registry of SMTP service extensions.  A
   corresponding EHLO keyword value is associated with each extension.
   Each service extension registered with the IANA must be defined in a
   formal standards-track or IESG-approved experimental protocol
   document.  The definition must include:

   -  the textual name of the SMTP service extension;

   -  the EHLO keyword value associated with the extension;

   -  the syntax and possible values of parameters associated with the
      EHLO keyword value;

   -  any additional SMTP verbs associated with the extension
      (additional verbs will usually be, but are not required to be, the
      same as the EHLO keyword value);

   -  any new parameters the extension associates with the MAIL or RCPT
      verbs;

   -  a description of how support for the extension affects the
      behavior of a server and client SMTP; and,

   -  the increment by which the extension is increasing the maximum
      length of the commands MAIL and/or RCPT, over that specified in
      this standard.





<span class="grey">Klensin                     Standards Track                     [Page 8]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-9" id="page-9" href="#page-9" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   In addition, any EHLO keyword value starting with an upper or lower
   case "X" refers to a local SMTP service extension used exclusively
   through bilateral agreement.  Keywords beginning with "X" MUST NOT be
   used in a registered service extension.  Conversely, keyword values
   presented in the EHLO response that do not begin with "X" MUST
   correspond to a standard, standards-track, or IESG-approved
   experimental SMTP service extension registered with IANA.  A
   conforming server MUST NOT offer non-"X"-prefixed keyword values that
   are not described in a registered extension.

   Additional verbs and parameter names are bound by the same rules as
   EHLO keywords; specifically, verbs beginning with "X" are local
   extensions that may not be registered or standardized.  Conversely,
   verbs not beginning with "X" must always be registered.

<span class="h3"><h3><a class="selflink" name="section-2.3" href="#section-2.3">2.3</a> Terminology</h3></span>

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described below.

   1. MUST   This word, or the terms "REQUIRED" or "SHALL", mean that
      the definition is an absolute requirement of the specification.

   2. MUST NOT   This phrase, or the phrase "SHALL NOT", mean that the
      definition is an absolute prohibition of the specification.

   3. SHOULD   This word, or the adjective "RECOMMENDED", mean that
      there may exist valid reasons in particular circumstances to
      ignore a particular item, but the full implications must be
      understood and carefully weighed before choosing a different
      course.

   4. SHOULD NOT   This phrase, or the phrase "NOT RECOMMENDED" mean
      that there may exist valid reasons in particular circumstances
      when the particular behavior is acceptable or even useful, but the
      full implications should be understood and the case carefully
      weighed before implementing any behavior described with this
      label.

   5. MAY   This word, or the adjective "OPTIONAL", mean that an item is
      truly optional.  One vendor may choose to include the item because
      a particular marketplace requires it or because the vendor feels
      that it enhances the product while another vendor may omit the
      same item.  An implementation which does not include a particular
      option MUST be prepared to interoperate with another
      implementation which does include the option, though perhaps with
      reduced functionality.  In the same vein an implementation which



<span class="grey">Klensin                     Standards Track                     [Page 9]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-10" id="page-10" href="#page-10" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      does include a particular option MUST be prepared to interoperate
      with another implementation which does not include the option
      (except, of course, for the feature the option provides.)

<span class="h4"><h4><a class="selflink" name="section-2.3.1" href="#section-2.3.1">2.3.1</a> Mail Objects</h4></span>

   SMTP transports a mail object.  A mail object contains an envelope
   and content.

   The SMTP envelope is sent as a series of SMTP protocol units
   (described in <a href="#section-3">section 3</a>).  It consists of an originator address (to
   which error reports should be directed); one or more recipient
   addresses; and optional protocol extension material.  Historically,
   variations on the recipient address specification command (RCPT TO)
   could be used to specify alternate delivery modes, such as immediate
   display; those variations have now been deprecated (see <a href="#appendix-F">appendix F</a>,
   section F.6).

   The SMTP content is sent in the SMTP DATA protocol unit and has two
   parts:  the headers and the body.  If the content conforms to other
   contemporary standards, the headers form a collection of field/value
   pairs structured as in the message format specification [<a href="#ref-32" title='"Internet Message Format"'>32</a>]; the
   body, if structured, is defined according to MIME [<a href="#ref-12" title='"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"'>12</a>].  The content
   is textual in nature, expressed using the US-ASCII repertoire [<a href="#ref-1" title='"USA Code for Information Interchange"'>1</a>].
   Although SMTP extensions (such as "8BITMIME" [<a href="#ref-20" title='"SMTP Service Extension for 8bit-MIMEtransport"'>20</a>]) may relax this
   restriction for the content body, the content headers are always
   encoded using the US-ASCII repertoire.  A MIME extension [<a href="#ref-23" title='"MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text"'>23</a>] defines
   an algorithm for representing header values outside the US-ASCII
   repertoire, while still encoding them using the US-ASCII repertoire.

<span class="h4"><h4><a class="selflink" name="section-2.3.2" href="#section-2.3.2">2.3.2</a> Senders and Receivers</h4></span>

   In <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>, the two hosts participating in an SMTP transaction were
   described as the "SMTP-sender" and "SMTP-receiver".  This document
   has been changed to reflect current industry terminology and hence
   refers to them as the "SMTP client" (or sometimes just "the client")
   and "SMTP server" (or just "the server"), respectively.  Since a
   given host may act both as server and client in a relay situation,
   "receiver" and "sender" terminology is still used where needed for
   clarity.

<span class="h4"><h4><a class="selflink" name="section-2.3.3" href="#section-2.3.3">2.3.3</a> Mail Agents and Message Stores</h4></span>

   Additional mail system terminology became common after <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> was
   published and, where convenient, is used in this specification.  In
   particular, SMTP servers and clients provide a mail transport service
   and therefore act as "Mail Transfer Agents" (MTAs).  "Mail User
   Agents" (MUAs or UAs) are normally thought of as the sources and



<span class="grey">Klensin                     Standards Track                    [Page 10]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-11" id="page-11" href="#page-11" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   targets of mail.  At the source, an MUA might collect mail to be
   transmitted from a user and hand it off to an MTA; the final
   ("delivery") MTA would be thought of as handing the mail off to an
   MUA (or at least transferring responsibility to it, e.g., by
   depositing the message in a "message store").  However, while these
   terms are used with at least the appearance of great precision in
   other environments, the implied boundaries between MUAs and MTAs
   often do not accurately match common, and conforming, practices with
   Internet mail.  Hence, the reader should be cautious about inferring
   the strong relationships and responsibilities that might be implied
   if these terms were used elsewhere.

<span class="h4"><h4><a class="selflink" name="section-2.3.4" href="#section-2.3.4">2.3.4</a> Host</h4></span>

   For the purposes of this specification, a host is a computer system
   attached to the Internet (or, in some cases, to a private TCP/IP
   network) and supporting the SMTP protocol.  Hosts are known by names
   (see "domain"); identifying them by numerical address is discouraged.

<span class="h4"><h4><a class="selflink" name="section-2.3.5" href="#section-2.3.5">2.3.5</a> Domain</h4></span>

   A domain (or domain name) consists of one or more dot-separated
   components.  These components ("labels" in DNS terminology [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>]) are
   restricted for SMTP purposes to consist of a sequence of letters,
   digits, and hyphens drawn from the ASCII character set [<a href="#ref-1" title='"USA Code for Information Interchange"'>1</a>].  Domain
   names are used as names of hosts and of other entities in the domain
   name hierarchy.  For example, a domain may refer to an alias (label
   of a CNAME RR) or the label of Mail eXchanger records to be used to
   deliver mail instead of representing a host name.  See [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>] and
   <a href="#section-5">section 5</a> of this specification.

   The domain name, as described in this document and in [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>], is the
   entire, fully-qualified name (often referred to as an "FQDN").  A
   domain name that is not in FQDN form is no more than a local alias.
   Local aliases MUST NOT appear in any SMTP transaction.

<span class="h4"><h4><a class="selflink" name="section-2.3.6" href="#section-2.3.6">2.3.6</a> Buffer and State Table</h4></span>

   SMTP sessions are stateful, with both parties carefully maintaining a
   common view of the current state.  In this document we model this
   state by a virtual "buffer" and a "state table" on the server which
   may be used by the client to, for example, "clear the buffer" or
   "reset the state table," causing the information in the buffer to be
   discarded and the state to be returned to some previous state.







<span class="grey">Klensin                     Standards Track                    [Page 11]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-12" id="page-12" href="#page-12" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h4"><h4><a class="selflink" name="section-2.3.7" href="#section-2.3.7">2.3.7</a> Lines</h4></span>

   SMTP commands and, unless altered by a service extension, message
   data, are transmitted in "lines".  Lines consist of zero or more data
   characters terminated by the sequence ASCII character "CR" (hex value
   0D) followed immediately by ASCII character "LF" (hex value 0A).
   This termination sequence is denoted as &lt;CRLF&gt; in this document.
   Conforming implementations MUST NOT recognize or generate any other
   character or character sequence as a line terminator.  Limits MAY be
   imposed on line lengths by servers (see <a href="#section-4.5.3">section 4.5.3</a>).

   In addition, the appearance of "bare" "CR" or "LF" characters in text
   (i.e., either without the other) has a long history of causing
   problems in mail implementations and applications that use the mail
   system as a tool.  SMTP client implementations MUST NOT transmit
   these characters except when they are intended as line terminators
   and then MUST, as indicated above, transmit them only as a &lt;CRLF&gt;
   sequence.

<span class="h4"><h4><a class="selflink" name="section-2.3.8" href="#section-2.3.8">2.3.8</a> Originator, Delivery, Relay, and Gateway Systems</h4></span>

   This specification makes a distinction among four types of SMTP
   systems, based on the role those systems play in transmitting
   electronic mail.  An "originating" system (sometimes called an SMTP
   originator) introduces mail into the Internet or, more generally,
   into a transport service environment.  A "delivery" SMTP system is
   one that receives mail from a transport service environment and
   passes it to a mail user agent or deposits it in a message store
   which a mail user agent is expected to subsequently access.  A
   "relay" SMTP system (usually referred to just as a "relay") receives
   mail from an SMTP client and transmits it, without modification to
   the message data other than adding trace information, to another SMTP
   server for further relaying or for delivery.

   A "gateway" SMTP system (usually referred to just as a "gateway")
   receives mail from a client system in one transport environment and
   transmits it to a server system in another transport environment.
   Differences in protocols or message semantics between the transport
   environments on either side of a gateway may require that the gateway
   system perform transformations to the message that are not permitted
   to SMTP relay systems.  For the purposes of this specification,
   firewalls that rewrite addresses should be considered as gateways,
   even if SMTP is used on both sides of them (see [<a href="#ref-11" title='"Behavior of and Requirements for Internet Firewalls"'>11</a>]).








<span class="grey">Klensin                     Standards Track                    [Page 12]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-13" id="page-13" href="#page-13" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h4"><h4><a class="selflink" name="section-2.3.9" href="#section-2.3.9">2.3.9</a> Message Content and Mail Data</h4></span>

   The terms "message content" and "mail data" are used interchangeably
   in this document to describe the material transmitted after the DATA
   command is accepted and before the end of data indication is
   transmitted.  Message content includes message headers and the
   possibly-structured message body.  The MIME specification [<a href="#ref-12" title='"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"'>12</a>]
   provides the standard mechanisms for structured message bodies.

<span class="h4"><h4><a class="selflink" name="section-2.3.10" href="#section-2.3.10">2.3.10</a> Mailbox and Address</h4></span>

   As used in this specification, an "address" is a character string
   that identifies a user to whom mail will be sent or a location into
   which mail will be deposited.  The term "mailbox" refers to that
   depository.  The two terms are typically used interchangeably unless
   the distinction between the location in which mail is placed (the
   mailbox) and a reference to it (the address) is important.  An
   address normally consists of user and domain specifications.  The
   standard mailbox naming convention is defined to be "local-
   part@domain": contemporary usage permits a much broader set of
   applications than simple "user names".  Consequently, and due to a
   long history of problems when intermediate hosts have attempted to
   optimize transport by modifying them, the local-part MUST be
   interpreted and assigned semantics only by the host specified in the
   domain part of the address.

<span class="h4"><h4><a class="selflink" name="section-2.3.11" href="#section-2.3.11">2.3.11</a> Reply</h4></span>

   An SMTP reply is an acknowledgment (positive or negative) sent from
   receiver to sender via the transmission channel in response to a
   command.  The general form of a reply is a numeric completion code
   (indicating failure or success) usually followed by a text string.
   The codes are for use by programs and the text is usually intended
   for human users.  Recent work [<a href="#ref-34" title='"Enhanced Mail System Status Codes"'>34</a>] has specified further structuring
   of the reply strings, including the use of supplemental and more
   specific completion codes.

<span class="h3"><h3><a class="selflink" name="section-2.4" href="#section-2.4">2.4</a> General Syntax Principles and Transaction Model</h3></span>

   SMTP commands and replies have a rigid syntax.  All commands begin
   with a command verb.  All Replies begin with a three digit numeric
   code.  In some commands and replies, arguments MUST follow the verb
   or reply code.  Some commands do not accept arguments (after the
   verb), and some reply codes are followed, sometimes optionally, by
   free form text.  In both cases, where text appears, it is separated
   from the verb or reply code by a space character.  Complete
   definitions of commands and replies appear in <a href="#section-4">section 4</a>.




<span class="grey">Klensin                     Standards Track                    [Page 13]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-14" id="page-14" href="#page-14" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command
   and extension name keywords) are not case sensitive, with the sole
   exception in this specification of a mailbox local-part (SMTP
   Extensions may explicitly specify case-sensitive elements).  That is,
   a command verb, an argument value other than a mailbox local-part,
   and free form text MAY be encoded in upper case, lower case, or any
   mixture of upper and lower case with no impact on its meaning.  This
   is NOT true of a mailbox local-part.  The local-part of a mailbox
   MUST BE treated as case sensitive.  Therefore, SMTP implementations
   MUST take care to preserve the case of mailbox local-parts.  Mailbox
   domains are not case sensitive.  In particular, for some hosts the
   user "smith" is different from the user "Smith".  However, exploiting
   the case sensitivity of mailbox local-parts impedes interoperability
   and is discouraged.

   A few SMTP servers, in violation of this specification (and <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>)
   require that command verbs be encoded by clients in upper case.
   Implementations MAY wish to employ this encoding to accommodate those
   servers.

   The argument field consists of a variable length character string
   ending with the end of the line, i.e., with the character sequence
   &lt;CRLF&gt;.  The receiver will take no action until this sequence is
   received.

   The syntax for each command is shown with the discussion of that
   command.  Common elements and parameters are shown in <a href="#section-4.1.2">section 4.1.2</a>.

   Commands and replies are composed of characters from the ASCII
   character set [<a href="#ref-1" title='"USA Code for Information Interchange"'>1</a>].  When the transport service provides an 8-bit byte
   (octet) transmission channel, each 7-bit character is transmitted
   right justified in an octet with the high order bit cleared to zero.
   More specifically, the unextended SMTP service provides seven bit
   transport only.  An originating SMTP client which has not
   successfully negotiated an appropriate extension with a particular
   server MUST NOT transmit messages with information in the high-order
   bit of octets.  If such messages are transmitted in violation of this
   rule, receiving SMTP servers MAY clear the high-order bit or reject
   the message as invalid.  In general, a relay SMTP SHOULD assume that
   the message content it has received is valid and, assuming that the
   envelope permits doing so, relay it without inspecting that content.
   Of course, if the content is mislabeled and the data path cannot
   accept the actual content, this may result in ultimate delivery of a
   severely garbled message to the recipient.  Delivery SMTP systems MAY
   reject ("bounce") such messages rather than deliver them.  No sending
   SMTP system is permitted to send envelope commands in any character





<span class="grey">Klensin                     Standards Track                    [Page 14]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-15" id="page-15" href="#page-15" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   set other than US-ASCII; receiving systems SHOULD reject such
   commands, normally using "500 syntax error - invalid character"
   replies.

   Eight-bit message content transmission MAY be requested of the server
   by a client using extended SMTP facilities, notably the "8BITMIME"
   extension [<a href="#ref-20" title='"SMTP Service Extension for 8bit-MIMEtransport"'>20</a>].  8BITMIME SHOULD be supported by SMTP servers.
   However, it MUST not be construed as authorization to transmit
   unrestricted eight bit material.  8BITMIME MUST NOT be requested by
   senders for material with the high bit on that is not in MIME format
   with an appropriate content-transfer encoding; servers MAY reject
   such messages.

   The metalinguistic notation used in this document corresponds to the
   "Augmented BNF" used in other Internet mail system documents.  The
   reader who is not familiar with that syntax should consult the ABNF
   specification [<a href="#ref-8" title='"Augmented BNF for Syntax Specifications: ABNF"'>8</a>].  Metalanguage terms used in running text are
   surrounded by pointed brackets (e.g., &lt;CRLF&gt;) for clarity.

<span class="h2"><h2><a class="selflink" name="section-3" href="#section-3">3</a>. The SMTP Procedures: An Overview</h2></span>

   This section contains descriptions of the procedures used in SMTP:
   session initiation, the mail transaction, forwarding mail, verifying
   mailbox names and expanding mailing lists, and the opening and
   closing exchanges.  Comments on relaying, a note on mail domains, and
   a discussion of changing roles are included at the end of this
   section.  Several complete scenarios are presented in <a href="#appendix-D">appendix D</a>.

<span class="h3"><h3><a class="selflink" name="section-3.1" href="#section-3.1">3.1</a> Session Initiation</h3></span>

   An SMTP session is initiated when a client opens a connection to a
   server and the server responds with an opening message.

   SMTP server implementations MAY include identification of their
   software and version information in the connection greeting reply
   after the 220 code, a practice that permits more efficient isolation
   and repair of any problems.  Implementations MAY make provision for
   SMTP servers to disable the software and version announcement where
   it causes security concerns.  While some systems also identify their
   contact point for mail problems, this is not a substitute for
   maintaining the required "postmaster" address (see <a href="#section-4.5.1">section 4.5.1</a>).

   The SMTP protocol allows a server to formally reject a transaction
   while still allowing the initial connection as follows: a 554
   response MAY be given in the initial connection opening message
   instead of the 220.  A server taking this approach MUST still wait
   for the client to send a QUIT (see <a href="#section-4.1.1.10">section 4.1.1.10</a>) before closing
   the connection and SHOULD respond to any intervening commands with



<span class="grey">Klensin                     Standards Track                    [Page 15]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-16" id="page-16" href="#page-16" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   "503 bad sequence of commands".  Since an attempt to make an SMTP
   connection to such a system is probably in error, a server returning
   a 554 response on connection opening SHOULD provide enough
   information in the reply text to facilitate debugging of the sending
   system.

<span class="h3"><h3><a class="selflink" name="section-3.2" href="#section-3.2">3.2</a> Client Initiation</h3></span>

   Once the server has sent the welcoming message and the client has
   received it, the client normally sends the EHLO command to the
   server, indicating the client's identity.  In addition to opening the
   session, use of EHLO indicates that the client is able to process
   service extensions and requests that the server provide a list of the
   extensions it supports.  Older SMTP systems which are unable to
   support service extensions and contemporary clients which do not
   require service extensions in the mail session being initiated, MAY
   use HELO instead of EHLO.  Servers MUST NOT return the extended
   EHLO-style response to a HELO command.  For a particular connection
   attempt, if the server returns a "command not recognized" response to
   EHLO, the client SHOULD be able to fall back and send HELO.

   In the EHLO command the host sending the command identifies itself;
   the command may be interpreted as saying "Hello, I am &lt;domain&gt;" (and,
   in the case of EHLO, "and I support service extension requests").

<span class="h3"><h3><a class="selflink" name="section-3.3" href="#section-3.3">3.3</a> Mail Transactions</h3></span>

   There are three steps to SMTP mail transactions.  The transaction
   starts with a MAIL command which gives the sender identification.
   (In general, the MAIL command may be sent only when no mail
   transaction is in progress; see <a href="#section-4.1.4">section 4.1.4</a>.)  A series of one or
   more RCPT commands follows giving the receiver information.  Then a
   DATA command initiates transfer of the mail data and is terminated by
   the "end of mail" data indicator, which also confirms the
   transaction.

   The first step in the procedure is the MAIL command.

      MAIL FROM:&lt;reverse-path&gt; [SP &lt;mail-parameters&gt; ] &lt;CRLF&gt;

   This command tells the SMTP-receiver that a new mail transaction is
   starting and to reset all its state tables and buffers, including any
   recipients or mail data.  The &lt;reverse-path&gt; portion of the first or
   only argument contains the source mailbox (between "&lt;" and "&gt;"
   brackets), which can be used to report errors (see <a href="#section-4.2">section 4.2</a> for a
   discussion of error reporting).  If accepted, the SMTP server returns
   a 250 OK reply.  If the mailbox specification is not acceptable for
   some reason, the server MUST return a reply indicating whether the



<span class="grey">Klensin                     Standards Track                    [Page 16]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-17" id="page-17" href="#page-17" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   failure is permanent (i.e., will occur again if the client tries to
   send the same address again) or temporary (i.e., the address might be
   accepted if the client tries again later).  Despite the apparent
   scope of this requirement, there are circumstances in which the
   acceptability of the reverse-path may not be determined until one or
   more forward-paths (in RCPT commands) can be examined.  In those
   cases, the server MAY reasonably accept the reverse-path (with a 250
   reply) and then report problems after the forward-paths are received
   and examined.  Normally, failures produce 550 or 553 replies.

   Historically, the &lt;reverse-path&gt; can contain more than just a
   mailbox, however, contemporary systems SHOULD NOT use source routing
   (see <a href="#appendix-C">appendix C</a>).

   The optional &lt;mail-parameters&gt; are associated with negotiated SMTP
   service extensions (see <a href="#section-2.2">section 2.2</a>).

   The second step in the procedure is the RCPT command.

      RCPT TO:&lt;forward-path&gt; [ SP &lt;rcpt-parameters&gt; ] &lt;CRLF&gt;

   The first or only argument to this command includes a forward-path
   (normally a mailbox and domain, always surrounded by "&lt;" and "&gt;"
   brackets) identifying one recipient.  If accepted, the SMTP server
   returns a 250 OK reply and stores the forward-path.  If the recipient
   is known not to be a deliverable address, the SMTP server returns a
   550 reply, typically with a string such as "no such user - " and the
   mailbox name (other circumstances and reply codes are possible).
   This step of the procedure can be repeated any number of times.

   The &lt;forward-path&gt; can contain more than just a mailbox.
   Historically, the &lt;forward-path&gt; can be a source routing list of
   hosts and the destination mailbox, however, contemporary SMTP clients
   SHOULD NOT utilize source routes (see <a href="#appendix-C">appendix C</a>).  Servers MUST be
   prepared to encounter a list of source routes in the forward path,
   but SHOULD ignore the routes or MAY decline to support the relaying
   they imply.  Similarly, servers MAY decline to accept mail that is
   destined for other hosts or systems.  These restrictions make a
   server useless as a relay for clients that do not support full SMTP
   functionality.  Consequently, restricted-capability clients MUST NOT
   assume that any SMTP server on the Internet can be used as their mail
   processing (relaying) site.  If a RCPT command appears without a
   previous MAIL command, the server MUST return a 503 "Bad sequence of
   commands" response.  The optional &lt;rcpt-parameters&gt; are associated
   with negotiated SMTP service extensions (see <a href="#section-2.2">section 2.2</a>).

   The third step in the procedure is the DATA command (or some
   alternative specified in a service extension).



<span class="grey">Klensin                     Standards Track                    [Page 17]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-18" id="page-18" href="#page-18" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      DATA &lt;CRLF&gt;

   If accepted, the SMTP server returns a 354 Intermediate reply and
   considers all succeeding lines up to but not including the end of
   mail data indicator to be the message text.  When the end of text is
   successfully received and stored the SMTP-receiver sends a 250 OK
   reply.

   Since the mail data is sent on the transmission channel, the end of
   mail data must be indicated so that the command and reply dialog can
   be resumed.  SMTP indicates the end of the mail data by sending a
   line containing only a "." (period or full stop).  A transparency
   procedure is used to prevent this from interfering with the user's
   text (see <a href="#section-4.5.2">section 4.5.2</a>).

   The end of mail data indicator also confirms the mail transaction and
   tells the SMTP server to now process the stored recipients and mail
   data.  If accepted, the SMTP server returns a 250 OK reply.  The DATA
   command can fail at only two points in the protocol exchange:

   -  If there was no MAIL, or no RCPT, command, or all such commands
      were rejected, the server MAY return a "command out of sequence"
      (503) or "no valid recipients" (554) reply in response to the DATA
      command.  If one of those replies (or any other 5yz reply) is
      received, the client MUST NOT send the message data; more
      generally, message data MUST NOT be sent unless a 354 reply is
      received.

   -  If the verb is initially accepted and the 354 reply issued, the
      DATA command should fail only if the mail transaction was
      incomplete (for example, no recipients), or if resources were
      unavailable (including, of course, the server unexpectedly
      becoming unavailable), or if the server determines that the
      message should be rejected for policy or other reasons.

   However, in practice, some servers do not perform recipient
   verification until after the message text is received.  These servers
   SHOULD treat a failure for one or more recipients as a "subsequent
   failure" and return a mail message as discussed in <a href="#section-6">section 6</a>.  Using
   a "550 mailbox not found" (or equivalent) reply code after the data
   are accepted makes it difficult or impossible for the client to
   determine which recipients failed.

   When <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> format [<a href="#ref-7" title='"Standard for the Format of ARPA Internet Text Messages"'>7</a>, <a href="#ref-32" title='"Internet Message Format"'>32</a>] is being used, the mail data include the
   memo header items such as Date, Subject, To, Cc, From.  Server SMTP
   systems SHOULD NOT reject messages based on perceived defects in the
   <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> or MIME [<a href="#ref-12" title='"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"'>12</a>] message header or message body.  In particular,




<span class="grey">Klensin                     Standards Track                    [Page 18]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-19" id="page-19" href="#page-19" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   they MUST NOT reject messages in which the numbers of Resent-fields
   do not match or Resent-to appears without Resent-from and/or Resent-
   date.

   Mail transaction commands MUST be used in the order discussed above.

<span class="h3"><h3><a class="selflink" name="section-3.4" href="#section-3.4">3.4</a> Forwarding for Address Correction or Updating</h3></span>

   Forwarding support is most often required to consolidate and simplify
   addresses within, or relative to, some enterprise and less frequently
   to establish addresses to link a person's prior address with current
   one.  Silent forwarding of messages (without server notification to
   the sender), for security or non-disclosure purposes, is common in
   the contemporary Internet.

   In both the enterprise and the "new address" cases, information
   hiding (and sometimes security) considerations argue against exposure
   of the "final" address through the SMTP protocol as a side-effect of
   the forwarding activity.  This may be especially important when the
   final address may not even be reachable by the sender.  Consequently,
   the "forwarding" mechanisms described in <a href="http://tools.ietf.org/html/rfc821#section-3.2">section 3.2 of RFC 821</a>, and
   especially the 251 (corrected destination) and 551 reply codes from
   RCPT must be evaluated carefully by implementers and, when they are
   available, by those configuring systems.

   In particular:

   *  Servers MAY forward messages when they are aware of an address
      change.  When they do so, they MAY either provide address-updating
      information with a 251 code, or may forward "silently" and return
      a 250 code.  But, if a 251 code is used, they MUST NOT assume that
      the client will actually update address information or even return
      that information to the user.

   Alternately,

   *  Servers MAY reject or bounce messages when they are not
      deliverable when addressed.  When they do so, they MAY either
      provide address-updating information with a 551 code, or may
      reject the message as undeliverable with a 550 code and no
      address-specific information.  But, if a 551 code is used, they
      MUST NOT assume that the client will actually update address
      information or even return that information to the user.

   SMTP server implementations that support the 251 and/or 551 reply
   codes are strongly encouraged to provide configuration mechanisms so
   that sites which conclude that they would undesirably disclose
   information can disable or restrict their use.



<span class="grey">Klensin                     Standards Track                    [Page 19]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-20" id="page-20" href="#page-20" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h3"><h3><a class="selflink" name="section-3.5" href="#section-3.5">3.5</a> Commands for Debugging Addresses</h3></span>

<span class="h4"><h4><a class="selflink" name="section-3.5.1" href="#section-3.5.1">3.5.1</a> Overview</h4></span>

   SMTP provides commands to verify a user name or obtain the content of
   a mailing list.  This is done with the VRFY and EXPN commands, which
   have character string arguments.  Implementations SHOULD support VRFY
   and EXPN (however, see <a href="#section-3.5.2">section 3.5.2</a> and 7.3).

   For the VRFY command, the string is a user name or a user name and
   domain (see below).  If a normal (i.e., 250) response is returned,
   the response MAY include the full name of the user and MUST include
   the mailbox of the user.  It MUST be in either of the following
   forms:

      User Name &lt;local-part@domain&gt;
      local-part@domain

   When a name that is the argument to VRFY could identify more than one
   mailbox, the server MAY either note the ambiguity or identify the
   alternatives.  In other words, any of the following are legitimate
   response to VRFY:

      553 User ambiguous

   or

      553- Ambiguous;  Possibilities are
      553-Joe Smith &lt;jsmith@foo.com&gt;
      553-Harry Smith &lt;hsmith@foo.com&gt;
      553 Melvin Smith &lt;dweep@foo.com&gt;

   or

      553-Ambiguous;  Possibilities
      553- &lt;jsmith@foo.com&gt;
      553- &lt;hsmith@foo.com&gt;
      553 &lt;dweep@foo.com&gt;

   Under normal circumstances, a client receiving a 553 reply would be
   expected to expose the result to the user.  Use of exactly the forms
   given, and the "user ambiguous" or "ambiguous" keywords, possibly
   supplemented by extended reply codes such as those described in [<a href="#ref-34" title='"Enhanced Mail System Status Codes"'>34</a>],
   will facilitate automated translation into other languages as needed.
   Of course, a client that was highly automated or that was operating
   in another language than English, might choose to try to translate
   the response, to return some other indication to the user than the




<span class="grey">Klensin                     Standards Track                    [Page 20]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-21" id="page-21" href="#page-21" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   literal text of the reply, or to take some automated action such as
   consulting a directory service for additional information before
   reporting to the user.

   For the EXPN command, the string identifies a mailing list, and the
   successful (i.e., 250) multiline response MAY include the full name
   of the users and MUST give the mailboxes on the mailing list.

   In some hosts the distinction between a mailing list and an alias for
   a single mailbox is a bit fuzzy, since a common data structure may
   hold both types of entries, and it is possible to have mailing lists
   containing only one mailbox.  If a request is made to apply VRFY to a
   mailing list, a positive response MAY be given if a message so
   addressed would be delivered to everyone on the list, otherwise an
   error SHOULD be reported (e.g., "550 That is a mailing list, not a
   user" or "252 Unable to verify members of mailing list").  If a
   request is made to expand a user name, the server MAY return a
   positive response consisting of a list containing one name, or an
   error MAY be reported (e.g., "550 That is a user name, not a mailing
   list").

   In the case of a successful multiline reply (normal for EXPN) exactly
   one mailbox is to be specified on each line of the reply.  The case
   of an ambiguous request is discussed above.

   "User name" is a fuzzy term and has been used deliberately.  An
   implementation of the VRFY or EXPN commands MUST include at least
   recognition of local mailboxes as "user names".  However, since
   current Internet practice often results in a single host handling
   mail for multiple domains, hosts, especially hosts that provide this
   functionality, SHOULD accept the "local-part@domain" form as a "user
   name"; hosts MAY also choose to recognize other strings as "user
   names".

   The case of expanding a mailbox list requires a multiline reply, such
   as:

      C: EXPN Example-People
      S: 250-Jon Postel &lt;Postel@isi.edu&gt;
      S: 250-Fred Fonebone &lt;Fonebone@physics.foo-u.edu&gt;
      S: 250 Sam Q. Smith &lt;SQSmith@specific.generic.com&gt;

   or

      C: EXPN Executive-Washroom-List
      S: 550 Access Denied to You.





<span class="grey">Klensin                     Standards Track                    [Page 21]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-22" id="page-22" href="#page-22" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   The character string arguments of the VRFY and EXPN commands cannot
   be further restricted due to the variety of implementations of the
   user name and mailbox list concepts.  On some systems it may be
   appropriate for the argument of the EXPN command to be a file name
   for a file containing a mailing list, but again there are a variety
   of file naming conventions in the Internet.  Similarly, historical
   variations in what is returned by these commands are such that the
   response SHOULD be interpreted very carefully, if at all, and SHOULD
   generally only be used for diagnostic purposes.

<span class="h4"><h4><a class="selflink" name="section-3.5.2" href="#section-3.5.2">3.5.2</a> VRFY Normal Response</h4></span>

   When normal (2yz or 551) responses are returned from a VRFY or EXPN
   request, the reply normally includes the mailbox name, i.e.,
   "&lt;local-part@domain&gt;", where "domain" is a fully qualified domain
   name, MUST appear in the syntax.  In circumstances exceptional enough
   to justify violating the intent of this specification, free-form text
   MAY be returned.  In order to facilitate parsing by both computers
   and people, addresses SHOULD appear in pointed brackets.  When
   addresses, rather than free-form debugging information, are returned,
   EXPN and VRFY MUST return only valid domain addresses that are usable
   in SMTP RCPT commands.  Consequently, if an address implies delivery
   to a program or other system, the mailbox name used to reach that
   target MUST be given.  Paths (explicit source routes) MUST NOT be
   returned by VRFY or EXPN.

   Server implementations SHOULD support both VRFY and EXPN.  For
   security reasons, implementations MAY provide local installations a
   way to disable either or both of these commands through configuration
   options or the equivalent.  When these commands are supported, they
   are not required to work across relays when relaying is supported.
   Since they were both optional in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>, they MUST be listed as
   service extensions in an EHLO response, if they are supported.

<span class="h4"><h4><a class="selflink" name="section-3.5.3" href="#section-3.5.3">3.5.3</a> Meaning of VRFY or EXPN Success Response</h4></span>

   A server MUST NOT return a 250 code in response to a VRFY or EXPN
   command unless it has actually verified the address.  In particular,
   a server MUST NOT return 250 if all it has done is to verify that the
   syntax given is valid.  In that case, 502 (Command not implemented)
   or 500 (Syntax error, command unrecognized) SHOULD be returned.  As
   stated elsewhere, implementation (in the sense of actually validating
   addresses and returning information) of VRFY and EXPN are strongly
   recommended.  Hence, implementations that return 500 or 502 for VRFY
   are not in full compliance with this specification.






<span class="grey">Klensin                     Standards Track                    [Page 22]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-23" id="page-23" href="#page-23" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   There may be circumstances where an address appears to be valid but
   cannot reasonably be verified in real time, particularly when a
   server is acting as a mail exchanger for another server or domain.
   "Apparent validity" in this case would normally involve at least
   syntax checking and might involve verification that any domains
   specified were ones to which the host expected to be able to relay
   mail.  In these situations, reply code 252 SHOULD be returned.  These
   cases parallel the discussion of RCPT verification discussed in
   <a href="#section-2.1">section 2.1</a>.  Similarly, the discussion in <a href="#section-3.4">section 3.4</a> applies to the
   use of reply codes 251 and 551 with VRFY (and EXPN) to indicate
   addresses that are recognized but that would be forwarded or bounced
   were mail received for them.  Implementations generally SHOULD be
   more aggressive about address verification in the case of VRFY than
   in the case of RCPT, even if it takes a little longer to do so.

<span class="h4"><h4><a class="selflink" name="section-3.5.4" href="#section-3.5.4">3.5.4</a> Semantics and Applications of EXPN</h4></span>

   EXPN is often very useful in debugging and understanding problems
   with mailing lists and multiple-target-address aliases.  Some systems
   have attempted to use source expansion of mailing lists as a means of
   eliminating duplicates.  The propagation of aliasing systems with
   mail on the Internet, for hosts (typically with MX and CNAME DNS
   records), for mailboxes (various types of local host aliases), and in
   various proxying arrangements, has made it nearly impossible for
   these strategies to work consistently, and mail systems SHOULD NOT
   attempt them.

<span class="h3"><h3><a class="selflink" name="section-3.6" href="#section-3.6">3.6</a> Domains</h3></span>

   Only resolvable, fully-qualified, domain names (FQDNs) are permitted
   when domain names are used in SMTP.  In other words, names that can
   be resolved to MX RRs or A RRs (as discussed in <a href="#section-5">section 5</a>) are
   permitted, as are CNAME RRs whose targets can be resolved, in turn,
   to MX or A RRs.  Local nicknames or unqualified names MUST NOT be
   used.  There are two exceptions to the rule requiring FQDNs:

   -  The domain name given in the EHLO command MUST BE either a primary
      host name (a domain name that resolves to an A RR) or, if the host
      has no name, an address literal as described in <a href="#section-4.1.1.1">section 4.1.1.1</a>.

   -  The reserved mailbox name "postmaster" may be used in a RCPT
      command without domain qualification (see <a href="#section-4.1.1.3">section 4.1.1.3</a>) and
      MUST be accepted if so used.








<span class="grey">Klensin                     Standards Track                    [Page 23]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-24" id="page-24" href="#page-24" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h3"><h3><a class="selflink" name="section-3.7" href="#section-3.7">3.7</a> Relaying</h3></span>

   In general, the availability of Mail eXchanger records in the domain
   name system [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>, <a href="#ref-27" title='"Mail routing and the domain system"'>27</a>] makes the use of explicit source routes in the
   Internet mail system unnecessary.  Many historical problems with
   their interpretation have made their use undesirable.  SMTP clients
   SHOULD NOT generate explicit source routes except under unusual
   circumstances.  SMTP servers MAY decline to act as mail relays or to
   accept addresses that specify source routes.  When route information
   is encountered, SMTP servers are also permitted to ignore the route
   information and simply send to the final destination specified as the
   last element in the route and SHOULD do so.  There has been an
   invalid practice of using names that do not appear in the DNS as
   destination names, with the senders counting on the intermediate
   hosts specified in source routing to resolve any problems.  If source
   routes are stripped, this practice will cause failures.  This is one
   of several reasons why SMTP clients MUST NOT generate invalid source
   routes or depend on serial resolution of names.

   When source routes are not used, the process described in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> for
   constructing a reverse-path from the forward-path is not applicable
   and the reverse-path at the time of delivery will simply be the
   address that appeared in the MAIL command.

   A relay SMTP server is usually the target of a DNS MX record that
   designates it, rather than the final delivery system.  The relay
   server may accept or reject the task of relaying the mail in the same
   way it accepts or rejects mail for a local user.  If it accepts the
   task, it then becomes an SMTP client, establishes a transmission
   channel to the next SMTP server specified in the DNS (according to
   the rules in <a href="#section-5">section 5</a>), and sends it the mail.  If it declines to
   relay mail to a particular address for policy reasons, a 550 response
   SHOULD be returned.

   Many mail-sending clients exist, especially in conjunction with
   facilities that receive mail via POP3 or IMAP, that have limited
   capability to support some of the requirements of this specification,
   such as the ability to queue messages for subsequent delivery
   attempts.  For these clients, it is common practice to make private
   arrangements to send all messages to a single server for processing
   and subsequent distribution.  SMTP, as specified here, is not ideally
   suited for this role, and work is underway on standardized mail
   submission protocols that might eventually supercede the current
   practices.  In any event, because these arrangements are private and
   fall outside the scope of this specification, they are not described
   here.





<span class="grey">Klensin                     Standards Track                    [Page 24]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-25" id="page-25" href="#page-25" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   It is important to note that MX records can point to SMTP servers
   which act as gateways into other environments, not just SMTP relays
   and final delivery systems; see sections <a href="#section-3.8">3.8</a> and <a href="#section-5">5</a>.

   If an SMTP server has accepted the task of relaying the mail and
   later finds that the destination is incorrect or that the mail cannot
   be delivered for some other reason, then it MUST construct an
   "undeliverable mail" notification message and send it to the
   originator of the undeliverable mail (as indicated by the reverse-
   path).  Formats specified for non-delivery reports by other standards
   (see, for example, [<a href="#ref-24" title='"SMTP Service Extension for Delivery Status Notifications"'>24</a>, <a href="#ref-25" title='"An Extensible Message Format for Delivery Status Notifications"'>25</a>]) SHOULD be used if possible.

   This notification message must be from the SMTP server at the relay
   host or the host that first determines that delivery cannot be
   accomplished.  Of course, SMTP servers MUST NOT send notification
   messages about problems transporting notification messages.  One way
   to prevent loops in error reporting is to specify a null reverse-path
   in the MAIL command of a notification message.  When such a message
   is transmitted the reverse-path MUST be set to null (see <a href="#section-4.5.5">section</a>
   <a href="#section-4.5.5">4.5.5</a> for additional discussion).  A MAIL command with a null
   reverse-path appears as follows:

      MAIL FROM:&lt;&gt;

   As discussed in <a href="#section-2.4.1">section 2.4.1</a>, a relay SMTP has no need to inspect or
   act upon the headers or body of the message data and MUST NOT do so
   except to add its own "Received:" header (<a href="#section-4.4">section 4.4</a>) and,
   optionally, to attempt to detect looping in the mail system (see
   <a href="#section-6.2">section 6.2</a>).

<span class="h3"><h3><a class="selflink" name="section-3.8" href="#section-3.8">3.8</a> Mail Gatewaying</h3></span>

   While the relay function discussed above operates within the Internet
   SMTP transport service environment, MX records or various forms of
   explicit routing may require that an intermediate SMTP server perform
   a translation function between one transport service and another.  As
   discussed in <a href="#section-2.3.8">section 2.3.8</a>, when such a system is at the boundary
   between two transport service environments, we refer to it as a
   "gateway" or "gateway SMTP".

   Gatewaying mail between different mail environments, such as
   different mail formats and protocols, is complex and does not easily
   yield to standardization.  However, some general requirements may be
   given for a gateway between the Internet and another mail
   environment.






<span class="grey">Klensin                     Standards Track                    [Page 25]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-26" id="page-26" href="#page-26" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h4"><h4><a class="selflink" name="section-3.8.1" href="#section-3.8.1">3.8.1</a> Header Fields in Gatewaying</h4></span>

   Header fields MAY be rewritten when necessary as messages are
   gatewayed across mail environment boundaries.  This may involve
   inspecting the message body or interpreting the local-part of the
   destination address in spite of the prohibitions in <a href="#section-2.4.1">section 2.4.1</a>.

   Other mail systems gatewayed to the Internet often use a subset of
   <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> headers or provide similar functionality with a different
   syntax, but some of these mail systems do not have an equivalent to
   the SMTP envelope.  Therefore, when a message leaves the Internet
   environment, it may be necessary to fold the SMTP envelope
   information into the message header.  A possible solution would be to
   create new header fields to carry the envelope information (e.g.,
   "X-SMTP-MAIL:"  and "X-SMTP-RCPT:"); however, this would require
   changes in mail programs in foreign environments and might risk
   disclosure of private information (see <a href="#section-7.2">section 7.2</a>).

<span class="h4"><h4><a class="selflink" name="section-3.8.2" href="#section-3.8.2">3.8.2</a> Received Lines in Gatewaying</h4></span>

   When forwarding a message into or out of the Internet environment, a
   gateway MUST prepend a Received: line, but it MUST NOT alter in any
   way a Received: line that is already in the header.

   "Received:" fields of messages originating from other environments
   may not conform exactly to this specification.  However, the most
   important use of Received: lines is for debugging mail faults, and
   this debugging can be severely hampered by well-meaning gateways that
   try to "fix" a Received: line.  As another consequence of trace
   fields arising in non-SMTP environments, receiving systems MUST NOT
   reject mail based on the format of a trace field and SHOULD be
   extremely robust in the light of unexpected information or formats in
   those fields.

   The gateway SHOULD indicate the environment and protocol in the "via"
   clauses of Received field(s) that it supplies.

<span class="h4"><h4><a class="selflink" name="section-3.8.3" href="#section-3.8.3">3.8.3</a> Addresses in Gatewaying</h4></span>

   From the Internet side, the gateway SHOULD accept all valid address
   formats in SMTP commands and in <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> headers, and all valid <a href="http://tools.ietf.org/html/rfc822">RFC</a>
   <a href="http://tools.ietf.org/html/rfc822">822</a> messages.  Addresses and headers generated by gateways MUST
   conform to applicable Internet standards (including this one and <a href="http://tools.ietf.org/html/rfc822">RFC</a>
   <a href="http://tools.ietf.org/html/rfc822">822</a>).  Gateways are, of course, subject to the same rules for
   handling source routes as those described for other SMTP systems in
   <a href="#section-3.3">section 3.3</a>.





<span class="grey">Klensin                     Standards Track                    [Page 26]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-27" id="page-27" href="#page-27" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h4"><h4><a class="selflink" name="section-3.8.4" href="#section-3.8.4">3.8.4</a> Other Header Fields in Gatewaying</h4></span>

   The gateway MUST ensure that all header fields of a message that it
   forwards into the Internet mail environment meet the requirements for
   Internet mail.  In particular, all addresses in "From:", "To:",
   "Cc:", etc., fields MUST be transformed (if necessary) to satisfy <a href="http://tools.ietf.org/html/rfc822">RFC</a>
   <a href="http://tools.ietf.org/html/rfc822">822</a> syntax, MUST reference only fully-qualified domain names, and
   MUST be effective and useful for sending replies.  The translation
   algorithm used to convert mail from the Internet protocols to another
   environment's protocol SHOULD ensure that error messages from the
   foreign mail environment are delivered to the return path from the
   SMTP envelope, not to the sender listed in the "From:" field (or
   other fields) of the <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> message.

<span class="h4"><h4><a class="selflink" name="section-3.8.5" href="#section-3.8.5">3.8.5</a> Envelopes in Gatewaying</h4></span>

   Similarly, when forwarding a message from another environment into
   the Internet, the gateway SHOULD set the envelope return path in
   accordance with an error message return address, if supplied by the
   foreign environment.  If the foreign environment has no equivalent
   concept, the gateway must select and use a best approximation, with
   the message originator's address as the default of last resort.

<span class="h3"><h3><a class="selflink" name="section-3.9" href="#section-3.9">3.9</a> Terminating Sessions and Connections</h3></span>

   An SMTP connection is terminated when the client sends a QUIT
   command.  The server responds with a positive reply code, after which
   it closes the connection.

   An SMTP server MUST NOT intentionally close the connection except:

   -  After receiving a QUIT command and responding with a 221 reply.

   -  After detecting the need to shut down the SMTP service and
      returning a 421 response code.  This response code can be issued
      after the server receives any command or, if necessary,
      asynchronously from command receipt (on the assumption that the
      client will receive it after the next command is issued).

   In particular, a server that closes connections in response to
   commands that are not understood is in violation of this
   specification.  Servers are expected to be tolerant of unknown
   commands, issuing a 500 reply and awaiting further instructions from
   the client.







<span class="grey">Klensin                     Standards Track                    [Page 27]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-28" id="page-28" href="#page-28" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   An SMTP server which is forcibly shut down via external means SHOULD
   attempt to send a line containing a 421 response code to the SMTP
   client before exiting.  The SMTP client will normally read the 421
   response code after sending its next command.

   SMTP clients that experience a connection close, reset, or other
   communications failure due to circumstances not under their control
   (in violation of the intent of this specification but sometimes
   unavoidable) SHOULD, to maintain the robustness of the mail system,
   treat the mail transaction as if a 451 response had been received and
   act accordingly.

<span class="h3"><h3><a class="selflink" name="section-3.10" href="#section-3.10">3.10</a> Mailing Lists and Aliases</h3></span>

   An SMTP-capable host SHOULD support both the alias and the list
   models of address expansion for multiple delivery.  When a message is
   delivered or forwarded to each address of an expanded list form, the
   return address in the envelope ("MAIL FROM:") MUST be changed to be
   the address of a person or other entity who administers the list.
   However, in this case, the message header [<a href="#ref-32" title='"Internet Message Format"'>32</a>] MUST be left
   unchanged; in particular, the "From" field of the message header is
   unaffected.

   An important mail facility is a mechanism for multi-destination
   delivery of a single message, by transforming (or "expanding" or
   "exploding") a pseudo-mailbox address into a list of destination
   mailbox addresses.  When a message is sent to such a pseudo-mailbox
   (sometimes called an "exploder"), copies are forwarded or
   redistributed to each mailbox in the expanded list.  Servers SHOULD
   simply utilize the addresses on the list; application of heuristics
   or other matching rules to eliminate some addresses, such as that of
   the originator, is strongly discouraged.  We classify such a pseudo-
   mailbox as an "alias" or a "list", depending upon the expansion
   rules.

<span class="h4"><h4><a class="selflink" name="section-3.10.1" href="#section-3.10.1">3.10.1</a> Alias</h4></span>

   To expand an alias, the recipient mailer simply replaces the pseudo-
   mailbox address in the envelope with each of the expanded addresses
   in turn; the rest of the envelope and the message body are left
   unchanged.  The message is then delivered or forwarded to each
   expanded address.

<span class="h4"><h4><a class="selflink" name="section-3.10.2" href="#section-3.10.2">3.10.2</a> List</h4></span>

   A mailing list may be said to operate by "redistribution" rather than
   by "forwarding".  To expand a list, the recipient mailer replaces the
   pseudo-mailbox address in the envelope with all of the expanded



<span class="grey">Klensin                     Standards Track                    [Page 28]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-29" id="page-29" href="#page-29" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   addresses.  The return address in the envelope is changed so that all
   error messages generated by the final deliveries will be returned to
   a list administrator, not to the message originator, who generally
   has no control over the contents of the list and will typically find
   error messages annoying.

<span class="h2"><h2><a class="selflink" name="section-4" href="#section-4">4</a>. The SMTP Specifications</h2></span>

<span class="h3"><h3><a class="selflink" name="section-4.1" href="#section-4.1">4.1</a> SMTP Commands</h3></span>

<span class="h4"><h4><a class="selflink" name="section-4.1.1" href="#section-4.1.1">4.1.1</a> Command Semantics and Syntax</h4></span>

   The SMTP commands define the mail transfer or the mail system
   function requested by the user.  SMTP commands are character strings
   terminated by &lt;CRLF&gt;.  The commands themselves are alphabetic
   characters terminated by &lt;SP&gt; if parameters follow and &lt;CRLF&gt;
   otherwise.  (In the interest of improved interoperability, SMTP
   receivers are encouraged to tolerate trailing white space before the
   terminating &lt;CRLF&gt;.)  The syntax of the local part of a mailbox must
   conform to receiver site conventions and the syntax specified in
   <a href="#section-4.1.2">section 4.1.2</a>.  The SMTP commands are discussed below.  The SMTP
   replies are discussed in <a href="#section-4.2">section 4.2</a>.

   A mail transaction involves several data objects which are
   communicated as arguments to different commands.  The reverse-path is
   the argument of the MAIL command, the forward-path is the argument of
   the RCPT command, and the mail data is the argument of the DATA
   command.  These arguments or data objects must be transmitted and
   held pending the confirmation communicated by the end of mail data
   indication which finalizes the transaction.  The model for this is
   that distinct buffers are provided to hold the types of data objects,
   that is, there is a reverse-path buffer, a forward-path buffer, and a
   mail data buffer.  Specific commands cause information to be appended
   to a specific buffer, or cause one or more buffers to be cleared.

   Several commands (RSET, DATA, QUIT) are specified as not permitting
   parameters.  In the absence of specific extensions offered by the
   server and accepted by the client, clients MUST NOT send such
   parameters and servers SHOULD reject commands containing them as
   having invalid syntax.

<span class="h5"><h5><a class="selflink" name="section-4.1.1.1" href="#section-4.1.1.1">4.1.1.1</a>  Extended HELLO (EHLO) or HELLO (HELO)</h5></span>

   These commands are used to identify the SMTP client to the SMTP
   server.  The argument field contains the fully-qualified domain name
   of the SMTP client if one is available.  In situations in which the
   SMTP client system does not have a meaningful domain name (e.g., when
   its address is dynamically allocated and no reverse mapping record is



<span class="grey">Klensin                     Standards Track                    [Page 29]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-30" id="page-30" href="#page-30" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   available), the client SHOULD send an address literal (see <a href="#section-4.1.3">section</a>
   <a href="#section-4.1.3">4.1.3</a>), optionally followed by information that will help to identify
   the client system.  y The SMTP server identifies itself to the SMTP
   client in the connection greeting reply and in the response to this
   command.

   A client SMTP SHOULD start an SMTP session by issuing the EHLO
   command.  If the SMTP server supports the SMTP service extensions it
   will give a successful response, a failure response, or an error
   response.  If the SMTP server, in violation of this specification,
   does not support any SMTP service extensions it will generate an
   error response.  Older client SMTP systems MAY, as discussed above,
   use HELO (as specified in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>) instead of EHLO, and servers MUST
   support the HELO command and reply properly to it.  In any event, a
   client MUST issue HELO or EHLO before starting a mail transaction.

   These commands, and a "250 OK" reply to one of them, confirm that
   both the SMTP client and the SMTP server are in the initial state,
   that is, there is no transaction in progress and all state tables and
   buffers are cleared.

   Syntax:

      ehlo            = "EHLO" SP Domain CRLF
      helo            = "HELO" SP Domain CRLF

   Normally, the response to EHLO will be a multiline reply.  Each line
   of the response contains a keyword and, optionally, one or more
   parameters.  Following the normal syntax for multiline replies, these
   keyworks follow the code (250) and a hyphen for all but the last
   line, and the code and a space for the last line.  The syntax for a
   positive response, using the ABNF notation and terminal symbols of
   [<a href="#ref-8" title='"Augmented BNF for Syntax Specifications: ABNF"'>8</a>], is:

      ehlo-ok-rsp  =    ( "250"    domain [ SP ehlo-greet ] CRLF )
                   / (    "250-"   domain [ SP ehlo-greet ] CRLF
                       *( "250-"   ehlo-line                CRLF )
                          "250"    SP ehlo-line             CRLF  )

      ehlo-greet   = 1*(%d0-9 / %d11-12 / %d14-127)
                   ; string of any characters other than CR or LF

      ehlo-line    = ehlo-keyword *( SP ehlo-param )

      ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
                   ; additional syntax of ehlo-params depends on
                   ; ehlo-keyword




<span class="grey">Klensin                     Standards Track                    [Page 30]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-31" id="page-31" href="#page-31" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      ehlo-param   = 1*(%d33-127)
                   ; any CHAR excluding &lt;SP&gt; and all
                   ; control characters (US-ASCII 0-31 inclusive)

   Although EHLO keywords may be specified in upper, lower, or mixed
   case, they MUST always be recognized and processed in a case-
   insensitive manner.  This is simply an extension of practices
   specified in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> and <a href="#section-2.4.1">section 2.4.1</a>.

<span class="h5"><h5><a class="selflink" name="section-4.1.1.2" href="#section-4.1.1.2">4.1.1.2</a> MAIL (MAIL)</h5></span>

   This command is used to initiate a mail transaction in which the mail
   data is delivered to an SMTP server which may, in turn, deliver it to
   one or more mailboxes or pass it on to another system (possibly using
   SMTP).  The argument field contains a reverse-path and may contain
   optional parameters.  In general, the MAIL command may be sent only
   when no mail transaction is in progress, see <a href="#section-4.1.4">section 4.1.4</a>.

   The reverse-path consists of the sender mailbox.  Historically, that
   mailbox might optionally have been preceded by a list of hosts, but
   that behavior is now deprecated (see <a href="#appendix-C">appendix C</a>).  In some types of
   reporting messages for which a reply is likely to cause a mail loop
   (for example, mail delivery and nondelivery notifications), the
   reverse-path may be null (see <a href="#section-3.7">section 3.7</a>).

   This command clears the reverse-path buffer, the forward-path buffer,
   and the mail data buffer; and inserts the reverse-path information
   from this command into the reverse-path buffer.

   If service extensions were negotiated, the MAIL command may also
   carry parameters associated with a particular service extension.

   Syntax:

      "MAIL FROM:" ("&lt;&gt;" / Reverse-Path)
                       [SP Mail-parameters] CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.3" href="#section-4.1.1.3">4.1.1.3</a> RECIPIENT (RCPT)</h5></span>

   This command is used to identify an individual recipient of the mail
   data; multiple recipients are specified by multiple use of this
   command.  The argument field contains a forward-path and may contain
   optional parameters.

   The forward-path normally consists of the required destination
   mailbox.  Sending systems SHOULD not generate the optional list of
   hosts known as a source route.  Receiving systems MUST recognize




<span class="grey">Klensin                     Standards Track                    [Page 31]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-32" id="page-32" href="#page-32" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   source route syntax but SHOULD strip off the source route
   specification and utilize the domain name associated with the mailbox
   as if the source route had not been provided.

   Similarly, relay hosts SHOULD strip or ignore source routes, and
   names MUST NOT be copied into the reverse-path.  When mail reaches
   its ultimate destination (the forward-path contains only a
   destination mailbox), the SMTP server inserts it into the destination
   mailbox in accordance with its host mail conventions.

   For example, mail received at relay host xyz.com with envelope
   commands

      MAIL FROM:&lt;userx@y.foo.org&gt;
      RCPT TO:&lt;@hosta.int,@jkl.org:userc@d.bar.org&gt;

   will normally be sent directly on to host d.bar.org with envelope
   commands

      MAIL FROM:&lt;userx@y.foo.org&gt;
      RCPT TO:&lt;userc@d.bar.org&gt;

   As provided in <a href="#appendix-C">appendix C</a>, xyz.com MAY also choose to relay the
   message to hosta.int, using the envelope commands

      MAIL FROM:&lt;userx@y.foo.org&gt;
      RCPT TO:&lt;@hosta.int,@jkl.org:userc@d.bar.org&gt;

   or to jkl.org, using the envelope commands

      MAIL FROM:&lt;userx@y.foo.org&gt;
      RCPT TO:&lt;@jkl.org:userc@d.bar.org&gt;

   Of course, since hosts are not required to relay mail at all, xyz.com
   may also reject the message entirely when the RCPT command is
   received, using a 550 code (since this is a "policy reason").

   If service extensions were negotiated, the RCPT command may also
   carry parameters associated with a particular service extension
   offered by the server.  The client MUST NOT transmit parameters other
   than those associated with a service extension offered by the server
   in its EHLO response.

Syntax:
   "RCPT TO:" ("&lt;Postmaster@" domain "&gt;" / "&lt;Postmaster&gt;" / Forward-Path)
                    [SP Rcpt-parameters] CRLF





<span class="grey">Klensin                     Standards Track                    [Page 32]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-33" id="page-33" href="#page-33" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h5"><h5><a class="selflink" name="section-4.1.1.4" href="#section-4.1.1.4">4.1.1.4</a> DATA (DATA)</h5></span>

   The receiver normally sends a 354 response to DATA, and then treats
   the lines (strings ending in &lt;CRLF&gt; sequences, as described in
   <a href="#section-2.3.7">section 2.3.7</a>) following the command as mail data from the sender.
   This command causes the mail data to be appended to the mail data
   buffer.  The mail data may contain any of the 128 ASCII character
   codes, although experience has indicated that use of control
   characters other than SP, HT, CR, and LF may cause problems and
   SHOULD be avoided when possible.

   The mail data is terminated by a line containing only a period, that
   is, the character sequence "&lt;CRLF&gt;.&lt;CRLF&gt;" (see <a href="#section-4.5.2">section 4.5.2</a>).  This
   is the end of mail data indication.  Note that the first &lt;CRLF&gt; of
   this terminating sequence is also the &lt;CRLF&gt; that ends the final line
   of the data (message text) or, if there was no data, ends the DATA
   command itself.  An extra &lt;CRLF&gt; MUST NOT be added, as that would
   cause an empty line to be added to the message.  The only exception
   to this rule would arise if the message body were passed to the
   originating SMTP-sender with a final "line" that did not end in
   &lt;CRLF&gt;; in that case, the originating SMTP system MUST either reject
   the message as invalid or add &lt;CRLF&gt; in order to have the receiving
   SMTP server recognize the "end of data" condition.

   The custom of accepting lines ending only in &lt;LF&gt;, as a concession to
   non-conforming behavior on the part of some UNIX systems, has proven
   to cause more interoperability problems than it solves, and SMTP
   server systems MUST NOT do this, even in the name of improved
   robustness.  In particular, the sequence "&lt;LF&gt;.&lt;LF&gt;" (bare line
   feeds, without carriage returns) MUST NOT be treated as equivalent to
   &lt;CRLF&gt;.&lt;CRLF&gt; as the end of mail data indication.

   Receipt of the end of mail data indication requires the server to
   process the stored mail transaction information.  This processing
   consumes the information in the reverse-path buffer, the forward-path
   buffer, and the mail data buffer, and on the completion of this
   command these buffers are cleared.  If the processing is successful,
   the receiver MUST send an OK reply.  If the processing fails the
   receiver MUST send a failure reply.  The SMTP model does not allow
   for partial failures at this point: either the message is accepted by
   the server for delivery and a positive response is returned or it is
   not accepted and a failure reply is returned.  In sending a positive
   completion reply to the end of data indication, the receiver takes
   full responsibility for the message (see <a href="#section-6.1">section 6.1</a>).  Errors that
   are diagnosed subsequently MUST be reported in a mail message, as
   discussed in <a href="#section-4.4">section 4.4</a>.





<span class="grey">Klensin                     Standards Track                    [Page 33]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-34" id="page-34" href="#page-34" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   When the SMTP server accepts a message either for relaying or for
   final delivery, it inserts a trace record (also referred to
   interchangeably as a "time stamp line" or "Received" line) at the top
   of the mail data.  This trace record indicates the identity of the
   host that sent the message, the identity of the host that received
   the message (and is inserting this time stamp), and the date and time
   the message was received.  Relayed messages will have multiple time
   stamp lines.  Details for formation of these lines, including their
   syntax, is specified in <a href="#section-4.4">section 4.4</a>.

   Additional discussion about the operation of the DATA command appears
   in <a href="#section-3.3">section 3.3</a>.

   Syntax:
      "DATA" CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.5" href="#section-4.1.1.5">4.1.1.5</a> RESET (RSET)</h5></span>

   This command specifies that the current mail transaction will be
   aborted.  Any stored sender, recipients, and mail data MUST be
   discarded, and all buffers and state tables cleared.  The receiver
   MUST send a "250 OK" reply to a RSET command with no arguments.  A
   reset command may be issued by the client at any time.  It is
   effectively equivalent to a NOOP (i.e., if has no effect) if issued
   immediately after EHLO, before EHLO is issued in the session, after
   an end-of-data indicator has been sent and acknowledged, or
   immediately before a QUIT.  An SMTP server MUST NOT close the
   connection as the result of receiving a RSET; that action is reserved
   for QUIT (see <a href="#section-4.1.1.10">section 4.1.1.10</a>).

   Since EHLO implies some additional processing and response by the
   server, RSET will normally be more efficient than reissuing that
   command, even though the formal semantics are the same.

   There are circumstances, contrary to the intent of this
   specification, in which an SMTP server may receive an indication that
   the underlying TCP connection has been closed or reset.  To preserve
   the robustness of the mail system, SMTP servers SHOULD be prepared
   for this condition and SHOULD treat it as if a QUIT had been received
   before the connection disappeared.

   Syntax:
      "RSET" CRLF








<span class="grey">Klensin                     Standards Track                    [Page 34]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-35" id="page-35" href="#page-35" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h5"><h5><a class="selflink" name="section-4.1.1.6" href="#section-4.1.1.6">4.1.1.6</a> VERIFY (VRFY)</h5></span>

   This command asks the receiver to confirm that the argument
   identifies a user or mailbox.  If it is a user name, information is
   returned as specified in <a href="#section-3.5">section 3.5</a>.

   This command has no effect on the reverse-path buffer, the forward-
   path buffer, or the mail data buffer.

   Syntax:
      "VRFY" SP String CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.7" href="#section-4.1.1.7">4.1.1.7</a> EXPAND (EXPN)</h5></span>

   This command asks the receiver to confirm that the argument
   identifies a mailing list, and if so, to return the membership of
   that list.  If the command is successful, a reply is returned
   containing information as described in <a href="#section-3.5">section 3.5</a>.  This reply will
   have multiple lines except in the trivial case of a one-member list.

   This command has no effect on the reverse-path buffer, the forward-
   path buffer, or the mail data buffer and may be issued at any time.

   Syntax:
      "EXPN" SP String CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.8" href="#section-4.1.1.8">4.1.1.8</a> HELP (HELP)</h5></span>

   This command causes the server to send helpful information to the
   client.  The command MAY take an argument (e.g., any command name)
   and return more specific information as a response.

   This command has no effect on the reverse-path buffer, the forward-
   path buffer, or the mail data buffer and may be issued at any time.

   SMTP servers SHOULD support HELP without arguments and MAY support it
   with arguments.

   Syntax:
      "HELP" [ SP String ] CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.9" href="#section-4.1.1.9">4.1.1.9</a> NOOP (NOOP)</h5></span>

   This command does not affect any parameters or previously entered
   commands.  It specifies no action other than that the receiver send
   an OK reply.





<span class="grey">Klensin                     Standards Track                    [Page 35]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-36" id="page-36" href="#page-36" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   This command has no effect on the reverse-path buffer, the forward-
   path buffer, or the mail data buffer and may be issued at any time.
   If a parameter string is specified, servers SHOULD ignore it.

   Syntax:
      "NOOP" [ SP String ] CRLF

<span class="h5"><h5><a class="selflink" name="section-4.1.1.10" href="#section-4.1.1.10">4.1.1.10</a> QUIT (QUIT)</h5></span>

   This command specifies that the receiver MUST send an OK reply, and
   then close the transmission channel.

   The receiver MUST NOT intentionally close the transmission channel
   until it receives and replies to a QUIT command (even if there was an
   error).  The sender MUST NOT intentionally close the transmission
   channel until it sends a QUIT command and SHOULD wait until it
   receives the reply (even if there was an error response to a previous
   command).  If the connection is closed prematurely due to violations
   of the above or system or network failure, the server MUST cancel any
   pending transaction, but not undo any previously completed
   transaction, and generally MUST act as if the command or transaction
   in progress had received a temporary error (i.e., a 4yz response).

   The QUIT command may be issued at any time.

   Syntax:
      "QUIT" CRLF

<span class="h4"><h4><a class="selflink" name="section-4.1.2" href="#section-4.1.2">4.1.2</a> Command Argument Syntax</h4></span>

   The syntax of the argument fields of the above commands (using the
   syntax specified in [<a href="#ref-8" title='"Augmented BNF for Syntax Specifications: ABNF"'>8</a>] where applicable) is given below.  Some of
   the productions given below are used only in conjunction with source
   routes as described in <a href="#appendix-C">appendix C</a>.  Terminals not defined in this
   document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined in
   the "core" syntax [8 (<a href="#section-6">section 6</a>)] or in the message format syntax
   [<a href="#ref-32" title='"Internet Message Format"'>32</a>].

      Reverse-path = Path
      Forward-path = Path
      Path = "&lt;" [ A-d-l ":" ] Mailbox "&gt;"
      A-d-l = At-domain *( "," A-d-l )
            ; Note that this form, the so-called "source route",
            ; MUST BE accepted, SHOULD NOT be generated, and SHOULD be
            ; ignored.
      At-domain = "@" domain
      Mail-parameters = esmtp-param *(SP esmtp-param)
      Rcpt-parameters = esmtp-param *(SP esmtp-param)



<span class="grey">Klensin                     Standards Track                    [Page 36]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-37" id="page-37" href="#page-37" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      esmtp-param     = esmtp-keyword ["=" esmtp-value]
      esmtp-keyword   = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
      esmtp-value     = 1*(%d33-60 / %d62-127)
            ; any CHAR excluding "=", SP, and control characters
      Keyword  = Ldh-str
      Argument = Atom
      Domain = (sub-domain 1*("." sub-domain)) / address-literal
      sub-domain = Let-dig [Ldh-str]

      address-literal = "[" IPv4-address-literal /
                            IPv6-address-literal /
                            General-address-literal "]"
            ; See <a href="#section-4.1.3">section 4.1.3</a>

      Mailbox = Local-part "@" Domain

      Local-part = Dot-string / Quoted-string
            ; MAY be case-sensitive

      Dot-string = Atom *("." Atom)

      Atom = 1*atext

      Quoted-string = DQUOTE *qcontent DQUOTE

      String = Atom / Quoted-string

   While the above definition for Local-part is relatively permissive,
   for maximum interoperability, a host that expects to receive mail
   SHOULD avoid defining mailboxes where the Local-part requires (or
   uses) the Quoted-string form or where the Local-part is case-
   sensitive.  For any purposes that require generating or comparing
   Local-parts (e.g., to specific mailbox names), all quoted forms MUST
   be treated as equivalent and the sending system SHOULD transmit the
   form that uses the minimum quoting possible.

   Systems MUST NOT define mailboxes in such a way as to require the use
   in SMTP of non-ASCII characters (octets with the high order bit set
   to one) or ASCII "control characters" (decimal value 0-31 and 127).
   These characters MUST NOT be used in MAIL or RCPT commands or other
   commands that require mailbox names.

   Note that the backslash, "\", is a quote character, which is used to
   indicate that the next character is to be used literally (instead of
   its normal interpretation).  For example, "Joe\,Smith" indicates a
   single nine character user field with the comma being the fourth
   character of the field.




<span class="grey">Klensin                     Standards Track                    [Page 37]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-38" id="page-38" href="#page-38" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   To promote interoperability and consistent with long-standing
   guidance about conservative use of the DNS in naming and applications
   (e.g., see <a href="#section-2.3.1">section 2.3.1</a> of the base DNS document, <a href="http://tools.ietf.org/html/rfc1035">RFC1035</a> [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>]),
   characters outside the set of alphas, digits, and hyphen MUST NOT
   appear in domain name labels for SMTP clients or servers.  In
   particular, the underscore character is not permitted.  SMTP servers
   that receive a command in which invalid character codes have been
   employed, and for which there are no other reasons for rejection,
   MUST reject that command with a 501 response.

<span class="h4"><h4><a class="selflink" name="section-4.1.3" href="#section-4.1.3">4.1.3</a> Address Literals</h4></span>

   Sometimes a host is not known to the domain name system and
   communication (and, in particular, communication to report and repair
   the error) is blocked.  To bypass this barrier a special literal form
   of the address is allowed as an alternative to a domain name.  For
   IPv4 addresses, this form uses four small decimal integers separated
   by dots and enclosed by brackets such as [123.255.37.2], which
   indicates an (IPv4) Internet Address in sequence-of-octets form.  For
   IPv6 and other forms of addressing that might eventually be
   standardized, the form consists of a standardized "tag" that
   identifies the address syntax, a colon, and the address itself, in a
   format specified as part of the IPv6 standards [<a href="#ref-17" title='"IP Version 6 Addressing Architecture"'>17</a>].

   Specifically:

      IPv4-address-literal = Snum 3("." Snum)
      IPv6-address-literal = "IPv6:" IPv6-addr
      General-address-literal = Standardized-tag ":" 1*dcontent
      Standardized-tag = Ldh-str
            ; MUST be specified in a standards-track RFC
            ; and registered with IANA

      Snum = 1*3DIGIT  ; representing a decimal integer
            ; value in the range 0 through 255
      Let-dig = ALPHA / DIGIT
      Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig

      IPv6-addr = IPv6-full / IPv6-comp / IPv6v4-full / IPv6v4-comp
      IPv6-hex  = 1*4HEXDIG
      IPv6-full = IPv6-hex 7(":" IPv6-hex)
      IPv6-comp = [IPv6-hex *5(":" IPv6-hex)] "::" [IPv6-hex *5(":"
                 IPv6-hex)]
            ; The "::" represents at least 2 16-bit groups of zeros
            ; No more than 6 groups in addition to the "::" may be
            ; present
      IPv6v4-full = IPv6-hex 5(":" IPv6-hex) ":" IPv4-address-literal
      IPv6v4-comp = [IPv6-hex *3(":" IPv6-hex)] "::"



<span class="grey">Klensin                     Standards Track                    [Page 38]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-39" id="page-39" href="#page-39" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


                   [IPv6-hex *3(":" IPv6-hex) ":"] IPv4-address-literal
            ; The "::" represents at least 2 16-bit groups of zeros
            ; No more than 4 groups in addition to the "::" and
            ; IPv4-address-literal may be present

<span class="h4"><h4><a class="selflink" name="section-4.1.4" href="#section-4.1.4">4.1.4</a> Order of Commands</h4></span>

   There are restrictions on the order in which these commands may be
   used.

   A session that will contain mail transactions MUST first be
   initialized by the use of the EHLO command.  An SMTP server SHOULD
   accept commands for non-mail transactions (e.g., VRFY or EXPN)
   without this initialization.

   An EHLO command MAY be issued by a client later in the session.  If
   it is issued after the session begins, the SMTP server MUST clear all
   buffers and reset the state exactly as if a RSET command had been
   issued.  In other words, the sequence of RSET followed immediately by
   EHLO is redundant, but not harmful other than in the performance cost
   of executing unnecessary commands.

   If the EHLO command is not acceptable to the SMTP server, 501, 500,
   or 502 failure replies MUST be returned as appropriate.  The SMTP
   server MUST stay in the same state after transmitting these replies
   that it was in before the EHLO was received.

   The SMTP client MUST, if possible, ensure that the domain parameter
   to the EHLO command is a valid principal host name (not a CNAME or MX
   name) for its host.  If this is not possible (e.g., when the client's
   address is dynamically assigned and the client does not have an
   obvious name), an address literal SHOULD be substituted for the
   domain name and supplemental information provided that will assist in
   identifying the client.

   An SMTP server MAY verify that the domain name parameter in the EHLO
   command actually corresponds to the IP address of the client.
   However, the server MUST NOT refuse to accept a message for this
   reason if the verification fails: the information about verification
   failure is for logging and tracing only.

   The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time
   during a session, or without previously initializing a session.  SMTP
   servers SHOULD process these normally (that is, not return a 503
   code) even if no EHLO command has yet been received; clients SHOULD
   open a session with EHLO before sending these commands.





<span class="grey">Klensin                     Standards Track                    [Page 39]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-40" id="page-40" href="#page-40" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   If these rules are followed, the example in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> that shows "550
   access denied to you" in response to an EXPN command is incorrect
   unless an EHLO command precedes the EXPN or the denial of access is
   based on the client's IP address or other authentication or
   authorization-determining mechanisms.

   The MAIL command (or the obsolete SEND, SOML, or SAML commands)
   begins a mail transaction.  Once started, a mail transaction consists
   of a transaction beginning command, one or more RCPT commands, and a
   DATA command, in that order.  A mail transaction may be aborted by
   the RSET (or a new EHLO) command.  There may be zero or more
   transactions in a session.  MAIL (or SEND, SOML, or SAML) MUST NOT be
   sent if a mail transaction is already open, i.e., it should be sent
   only if no mail transaction had been started in the session, or it
   the previous one successfully concluded with a successful DATA
   command, or if the previous one was aborted with a RSET.

   If the transaction beginning command argument is not acceptable, a
   501 failure reply MUST be returned and the SMTP server MUST stay in
   the same state.  If the commands in a transaction are out of order to
   the degree that they cannot be processed by the server, a 503 failure
   reply MUST be returned and the SMTP server MUST stay in the same
   state.

   The last command in a session MUST be the QUIT command.  The QUIT
   command cannot be used at any other time in a session, but SHOULD be
   used by the client SMTP to request connection closure, even when no
   session opening command was sent and accepted.

<span class="h4"><h4><a class="selflink" name="section-4.1.5" href="#section-4.1.5">4.1.5</a> Private-use Commands</h4></span>

   As specified in <a href="#section-2.2.2">section 2.2.2</a>, commands starting in "X" may be used
   by bilateral agreement between the client (sending) and server
   (receiving) SMTP agents.  An SMTP server that does not recognize such
   a command is expected to reply with "500 Command not recognized".  An
   extended SMTP server MAY list the feature names associated with these
   private commands in the response to the EHLO command.

   Commands sent or accepted by SMTP systems that do not start with "X"
   MUST conform to the requirements of <a href="#section-2.2.2">section 2.2.2</a>.

<span class="h3"><h3><a class="selflink" name="section-4.2" href="#section-4.2">4.2</a> SMTP Replies</h3></span>

   Replies to SMTP commands serve to ensure the synchronization of
   requests and actions in the process of mail transfer and to guarantee
   that the SMTP client always knows the state of the SMTP server.
   Every command MUST generate exactly one reply.




<span class="grey">Klensin                     Standards Track                    [Page 40]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-41" id="page-41" href="#page-41" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   The details of the command-reply sequence are described in <a href="#section-4.3">section</a>
   <a href="#section-4.3">4.3</a>.

   An SMTP reply consists of a three digit number (transmitted as three
   numeric characters) followed by some text unless specified otherwise
   in this document.  The number is for use by automata to determine
   what state to enter next; the text is for the human user.  The three
   digits contain enough encoded information that the SMTP client need
   not examine the text and may either discard it or pass it on to the
   user, as appropriate.  Exceptions are as noted elsewhere in this
   document.  In particular, the 220, 221, 251, 421, and 551 reply codes
   are associated with message text that must be parsed and interpreted
   by machines.  In the general case, the text may be receiver dependent
   and context dependent, so there are likely to be varying texts for
   each reply code.  A discussion of the theory of reply codes is given
   in <a href="#section-4.2.1">section 4.2.1</a>.  Formally, a reply is defined to be the sequence: a
   three-digit code, &lt;SP&gt;, one line of text, and &lt;CRLF&gt;, or a multiline
   reply (as defined in <a href="#section-4.2.1">section 4.2.1</a>).  Since, in violation of this
   specification, the text is sometimes not sent, clients which do not
   receive it SHOULD be prepared to process the code alone (with or
   without a trailing space character).  Only the EHLO, EXPN, and HELP
   commands are expected to result in multiline replies in normal
   circumstances, however, multiline replies are allowed for any
   command.

   In ABNF, server responses are:

      Greeting = "220 " Domain [ SP text ] CRLF
      Reply-line = Reply-code [ SP text ] CRLF

   where "Greeting" appears only in the 220 response that announces that
   the server is opening its part of the connection.

   An SMTP server SHOULD send only the reply codes listed in this
   document.  An SMTP server SHOULD use the text shown in the examples
   whenever appropriate.

   An SMTP client MUST determine its actions only by the reply code, not
   by the text (except for the "change of address" 251 and 551 and, if
   necessary, 220, 221, and 421 replies); in the general case, any text,
   including no text at all (although senders SHOULD NOT send bare
   codes), MUST be acceptable.  The space (blank) following the reply
   code is considered part of the text.  Whenever possible, a receiver-
   SMTP SHOULD test the first digit (severity indication) of the reply
   code.






<span class="grey">Klensin                     Standards Track                    [Page 41]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-42" id="page-42" href="#page-42" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   The list of codes that appears below MUST NOT be construed as
   permanent.  While the addition of new codes should be a rare and
   significant activity, with supplemental information in the textual
   part of the response being preferred, new codes may be added as the
   result of new Standards or Standards-track specifications.
   Consequently, a sender-SMTP MUST be prepared to handle codes not
   specified in this document and MUST do so by interpreting the first
   digit only.

<span class="h4"><h4><a class="selflink" name="section-4.2.1" href="#section-4.2.1">4.2.1</a> Reply Code Severities and Theory</h4></span>

   The three digits of the reply each have a special significance.  The
   first digit denotes whether the response is good, bad or incomplete.
   An unsophisticated SMTP client, or one that receives an unexpected
   code, will be able to determine its next action (proceed as planned,
   redo, retrench, etc.) by examining this first digit.  An SMTP client
   that wants to know approximately what kind of error occurred (e.g.,
   mail system error, command syntax error) may examine the second
   digit.  The third digit and any supplemental information that may be
   present is reserved for the finest gradation of information.

   There are five values for the first digit of the reply code:

   1yz   Positive Preliminary reply
      The command has been accepted, but the requested action is being
      held in abeyance, pending confirmation of the information in this
      reply.  The SMTP client should send another command specifying
      whether to continue or abort the action.  Note: unextended SMTP
      does not have any commands that allow this type of reply, and so
      does not have continue or abort commands.

   2yz   Positive Completion reply
      The requested action has been successfully completed.  A new
      request may be initiated.

   3yz   Positive Intermediate reply
      The command has been accepted, but the requested action is being
      held in abeyance, pending receipt of further information.  The
      SMTP client should send another command specifying this
      information.  This reply is used in command sequence groups (i.e.,
      in DATA).

   4yz   Transient Negative Completion reply
      The command was not accepted, and the requested action did not
      occur.  However, the error condition is temporary and the action
      may be requested again.  The sender should return to the beginning
      of the command sequence (if any).  It is difficult to assign a
      meaning to "transient" when two different sites (receiver- and



<span class="grey">Klensin                     Standards Track                    [Page 42]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-43" id="page-43" href="#page-43" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      sender-SMTP agents) must agree on the interpretation.  Each reply
      in this category might have a different time value, but the SMTP
      client is encouraged to try again.  A rule of thumb to determine
      whether a reply fits into the 4yz or the 5yz category (see below)
      is that replies are 4yz if they can be successful if repeated
      without any change in command form or in properties of the sender
      or receiver (that is, the command is repeated identically and the
      receiver does not put up a new implementation.)

   5yz   Permanent Negative Completion reply
      The command was not accepted and the requested action did not
      occur.  The SMTP client is discouraged from repeating the exact
      request (in the same sequence).  Even some "permanent" error
      conditions can be corrected, so the human user may want to direct
      the SMTP client to reinitiate the command sequence by direct
      action at some point in the future (e.g., after the spelling has
      been changed, or the user has altered the account status).

   The second digit encodes responses in specific categories:

   x0z   Syntax: These replies refer to syntax errors, syntactically
      correct commands that do not fit any functional category, and
      unimplemented or superfluous commands.

   x1z   Information:  These are replies to requests for information,
      such as status or help.

   x2z   Connections: These are replies referring to the transmission
      channel.

   x3z   Unspecified.

   x4z   Unspecified.

   x5z   Mail system: These replies indicate the status of the receiver
      mail system vis-a-vis the requested transfer or other mail system
      action.

   The third digit gives a finer gradation of meaning in each category
   specified by the second digit.  The list of replies illustrates this.
   Each reply text is recommended rather than mandatory, and may even
   change according to the command with which it is associated.  On the
   other hand, the reply codes must strictly follow the specifications
   in this section.  Receiver implementations should not invent new
   codes for slightly different situations from the ones described here,
   but rather adapt codes already defined.





<span class="grey">Klensin                     Standards Track                    [Page 43]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-44" id="page-44" href="#page-44" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   For example, a command such as NOOP, whose successful execution does
   not offer the SMTP client any new information, will return a 250
   reply.  The reply is 502 when the command requests an unimplemented
   non-site-specific action.  A refinement of that is the 504 reply for
   a command that is implemented, but that requests an unimplemented
   parameter.

   The reply text may be longer than a single line; in these cases the
   complete text must be marked so the SMTP client knows when it can
   stop reading the reply.  This requires a special format to indicate a
   multiple line reply.

   The format for multiline replies requires that every line, except the
   last, begin with the reply code, followed immediately by a hyphen,
   "-" (also known as minus), followed by text.  The last line will
   begin with the reply code, followed immediately by &lt;SP&gt;, optionally
   some text, and &lt;CRLF&gt;.  As noted above, servers SHOULD send the &lt;SP&gt;
   if subsequent text is not sent, but clients MUST be prepared for it
   to be omitted.

   For example:

      123-First line
      123-Second line
      123-234 text beginning with numbers
      123 The last line

   In many cases the SMTP client then simply needs to search for a line
   beginning with the reply code followed by &lt;SP&gt; or &lt;CRLF&gt; and ignore
   all preceding lines.  In a few cases, there is important data for the
   client in the reply "text".  The client will be able to identify
   these cases from the current context.

<span class="h4"><h4><a class="selflink" name="section-4.2.2" href="#section-4.2.2">4.2.2</a> Reply Codes by Function Groups</h4></span>

      500 Syntax error, command unrecognized
         (This may include errors such as command line too long)
      501 Syntax error in parameters or arguments
      502 Command not implemented  (see <a href="#section-4.2.4">section 4.2.4</a>)
      503 Bad sequence of commands
      504 Command parameter not implemented

      211 System status, or system help reply
      214 Help message
         (Information on how to use the receiver or the meaning of a
         particular non-standard command; this reply is useful only
         to the human user)




<span class="grey">Klensin                     Standards Track                    [Page 44]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-45" id="page-45" href="#page-45" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      220 &lt;domain&gt; Service ready
      221 &lt;domain&gt; Service closing transmission channel
      421 &lt;domain&gt; Service not available, closing transmission channel
         (This may be a reply to any command if the service knows it
         must shut down)

      250 Requested mail action okay, completed
      251 User not local; will forward to &lt;forward-path&gt;
         (See <a href="#section-3.4">section 3.4</a>)
      252 Cannot VRFY user, but will accept message and attempt
          delivery
         (See <a href="#section-3.5.3">section 3.5.3</a>)
      450 Requested mail action not taken: mailbox unavailable
         (e.g., mailbox busy)
      550 Requested action not taken: mailbox unavailable
         (e.g., mailbox not found, no access, or command rejected
         for policy reasons)
      451 Requested action aborted: error in processing
      551 User not local; please try &lt;forward-path&gt;
         (See <a href="#section-3.4">section 3.4</a>)
      452 Requested action not taken: insufficient system storage
      552 Requested mail action aborted: exceeded storage allocation
      553 Requested action not taken: mailbox name not allowed
         (e.g., mailbox syntax incorrect)
      354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
      554 Transaction failed (Or, in the case of a connection-opening
          response, "No SMTP service here")

<span class="h4"><h4><a class="selflink" name="section-4.2.3" href="#section-4.2.3">4.2.3</a>  Reply Codes in Numeric Order</h4></span>

      211 System status, or system help reply
      214 Help message
         (Information on how to use the receiver or the meaning of a
         particular non-standard command; this reply is useful only
         to the human user)
      220 &lt;domain&gt; Service ready
      221 &lt;domain&gt; Service closing transmission channel
      250 Requested mail action okay, completed
      251 User not local; will forward to &lt;forward-path&gt;
         (See <a href="#section-3.4">section 3.4</a>)
      252 Cannot VRFY user, but will accept message and attempt
         delivery
         (See <a href="#section-3.5.3">section 3.5.3</a>)

      354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;






<span class="grey">Klensin                     Standards Track                    [Page 45]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-46" id="page-46" href="#page-46" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      421 &lt;domain&gt; Service not available, closing transmission channel
         (This may be a reply to any command if the service knows it
         must shut down)
      450 Requested mail action not taken: mailbox unavailable
         (e.g., mailbox busy)
      451 Requested action aborted: local error in processing
      452 Requested action not taken: insufficient system storage
      500 Syntax error, command unrecognized
         (This may include errors such as command line too long)
      501 Syntax error in parameters or arguments
      502 Command not implemented (see <a href="#section-4.2.4">section 4.2.4</a>)
      503 Bad sequence of commands
      504 Command parameter not implemented
      550 Requested action not taken: mailbox unavailable
         (e.g., mailbox not found, no access, or command rejected
         for policy reasons)
      551 User not local; please try &lt;forward-path&gt;
         (See <a href="#section-3.4">section 3.4</a>)
      552 Requested mail action aborted: exceeded storage allocation
      553 Requested action not taken: mailbox name not allowed
         (e.g., mailbox syntax incorrect)
      554 Transaction failed  (Or, in the case of a connection-opening
          response, "No SMTP service here")

<span class="h4"><h4><a class="selflink" name="section-4.2.4" href="#section-4.2.4">4.2.4</a> Reply Code 502</h4></span>

   Questions have been raised as to when reply code 502 (Command not
   implemented) SHOULD be returned in preference to other codes.  502
   SHOULD be used when the command is actually recognized by the SMTP
   server, but not implemented.  If the command is not recognized, code
   500 SHOULD be returned.  Extended SMTP systems MUST NOT list
   capabilities in response to EHLO for which they will return 502 (or
   500) replies.

<span class="h4"><h4><a class="selflink" name="section-4.2.5" href="#section-4.2.5">4.2.5</a> Reply Codes After DATA and the Subsequent &lt;CRLF&gt;.&lt;CRLF&gt;</h4></span>

   When an SMTP server returns a positive completion status (2yz code)
   after the DATA command is completed with &lt;CRLF&gt;.&lt;CRLF&gt;, it accepts
   responsibility for:

   -  delivering the message (if the recipient mailbox exists), or

   -  if attempts to deliver the message fail due to transient
      conditions, retrying delivery some reasonable number of times at
      intervals as specified in <a href="#section-4.5.4">section 4.5.4</a>.






<span class="grey">Klensin                     Standards Track                    [Page 46]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-47" id="page-47" href="#page-47" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   -  if attempts to deliver the message fail due to permanent
      conditions, or if repeated attempts to deliver the message fail
      due to transient conditions, returning appropriate notification to
      the sender of the original message (using the address in the SMTP
      MAIL command).

   When an SMTP server returns a permanent error status (5yz) code after
   the DATA command is completed with &lt;CRLF&gt;.&lt;CRLF&gt;, it MUST NOT make
   any subsequent attempt to deliver that message.  The SMTP client
   retains responsibility for delivery of that message and may either
   return it to the user or requeue it for a subsequent attempt (see
   <a href="#section-4.5.4.1">section 4.5.4.1</a>).

   The user who originated the message SHOULD be able to interpret the
   return of a transient failure status (by mail message or otherwise)
   as a non-delivery indication, just as a permanent failure would be
   interpreted.  I.e., if the client SMTP successfully handles these
   conditions, the user will not receive such a reply.

   When an SMTP server returns a permanent error status (5yz) code after
   the DATA command is completely with &lt;CRLF&gt;.&lt;CRLF&gt;, it MUST NOT make
   any subsequent attempt to deliver the message.  As with temporary
   error status codes, the SMTP client retains responsibility for the
   message, but SHOULD not again attempt delivery to the same server
   without user review and intervention of the message.

<span class="h3"><h3><a class="selflink" name="section-4.3" href="#section-4.3">4.3</a> Sequencing of Commands and Replies</h3></span>

<span class="h4"><h4><a class="selflink" name="section-4.3.1" href="#section-4.3.1">4.3.1</a> Sequencing Overview</h4></span>

   The communication between the sender and receiver is an alternating
   dialogue, controlled by the sender.  As such, the sender issues a
   command and the receiver responds with a reply.  Unless other
   arrangements are negotiated through service extensions, the sender
   MUST wait for this response before sending further commands.

   One important reply is the connection greeting.  Normally, a receiver
   will send a 220 "Service ready" reply when the connection is
   completed.  The sender SHOULD wait for this greeting message before
   sending any commands.

   Note: all the greeting-type replies have the official name (the
   fully-qualified primary domain name) of the server host as the first
   word following the reply code.  Sometimes the host will have no
   meaningful name.  See 4.1.3 for a discussion of alternatives in these
   situations.





<span class="grey">Klensin                     Standards Track                    [Page 47]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-48" id="page-48" href="#page-48" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   For example,

      220 ISIF.USC.EDU Service ready
   or
      220 mail.foo.com SuperSMTP v 6.1.2 Service ready
   or
      220 [10.0.0.1] Clueless host service ready

   The table below lists alternative success and failure replies for
   each command.  These SHOULD be strictly adhered to: a receiver may
   substitute text in the replies, but the meaning and action implied by
   the code numbers and by the specific command reply sequence cannot be
   altered.

<span class="h4"><h4><a class="selflink" name="section-4.3.2" href="#section-4.3.2">4.3.2</a> Command-Reply Sequences</h4></span>

   Each command is listed with its usual possible replies.  The prefixes
   used before the possible replies are "I" for intermediate, "S" for
   success, and "E" for error.  Since some servers may generate other
   replies under special circumstances, and to allow for future
   extension, SMTP clients SHOULD, when possible, interpret only the
   first digit of the reply and MUST be prepared to deal with
   unrecognized reply codes by interpreting the first digit only.
   Unless extended using the mechanisms described in <a href="#section-2.2">section 2.2</a>, SMTP
   servers MUST NOT transmit reply codes to an SMTP client that are
   other than three digits or that do not start in a digit between 2 and
   5 inclusive.

   These sequencing rules and, in principle, the codes themselves, can
   be extended or modified by SMTP extensions offered by the server and
   accepted (requested) by the client.

   In addition to the codes listed below, any SMTP command can return
   any of the following codes if the corresponding unusual circumstances
   are encountered:

   500  For the "command line too long" case or if the command name was
      not recognized.  Note that producing a "command not recognized"
      error in response to the required subset of these commands is a
      violation of this specification.

   501  Syntax error in command or arguments.  In order to provide for
      future extensions, commands that are specified in this document as
      not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501
      message if arguments are supplied in the absence of EHLO-
      advertised extensions.

   421  Service shutting down and closing transmission channel



<span class="grey">Klensin                     Standards Track                    [Page 48]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-49" id="page-49" href="#page-49" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   Specific sequences are:

   CONNECTION ESTABLISHMENT
      S: 220
      E: 554
   EHLO or HELO
      S: 250
      E: 504, 550
   MAIL
      S: 250
      E: 552, 451, 452, 550, 553, 503
   RCPT
      S: 250, 251 (but see <a href="#section-3.4">section 3.4</a> for discussion of 251 and 551)
      E: 550, 551, 552, 553, 450, 451, 452, 503, 550
   DATA
      I: 354 -&gt; data -&gt; S: 250
                        E: 552, 554, 451, 452
      E: 451, 554, 503
   RSET
      S: 250
   VRFY
      S: 250, 251, 252
      E: 550, 551, 553, 502, 504
   EXPN
      S: 250, 252
      E: 550, 500, 502, 504
   HELP
      S: 211, 214
      E: 502, 504
   NOOP
      S: 250
   QUIT
      S: 221

<span class="h3"><h3><a class="selflink" name="section-4.4" href="#section-4.4">4.4</a> Trace Information</h3></span>

   When an SMTP server receives a message for delivery or further
   processing, it MUST insert trace ("time stamp" or "Received")
   information at the beginning of the message content, as discussed in
   <a href="#section-4.1.1.4">section 4.1.1.4</a>.

   This line MUST be structured as follows:

   -  The FROM field, which MUST be supplied in an SMTP environment,
      SHOULD contain both (1) the name of the source host as presented
      in the EHLO command and (2) an address literal containing the IP
      address of the source, determined from the TCP connection.




<span class="grey">Klensin                     Standards Track                    [Page 49]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-50" id="page-50" href="#page-50" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   -  The ID field MAY contain an "@" as suggested in <a href="http://tools.ietf.org/html/rfc822">RFC 822</a>, but this
      is not required.

   -  The FOR field MAY contain a list of &lt;path&gt; entries when multiple
      RCPT commands have been given.  This may raise some security
      issues and is usually not desirable; see <a href="#section-7.2">section 7.2</a>.

   An Internet mail program MUST NOT change a Received: line that was
   previously added to the message header.  SMTP servers MUST prepend
   Received lines to messages; they MUST NOT change the order of
   existing lines or insert Received lines in any other location.

   As the Internet grows, comparability of Received fields is important
   for detecting problems, especially slow relays.  SMTP servers that
   create Received fields SHOULD use explicit offsets in the dates
   (e.g., -0800), rather than time zone names of any type.  Local time
   (with an offset) is preferred to UT when feasible.  This formulation
   allows slightly more information about local circumstances to be
   specified.  If UT is needed, the receiver need merely do some simple
   arithmetic to convert the values.  Use of UT loses information about
   the time zone-location of the server.  If it is desired to supply a
   time zone name, it SHOULD be included in a comment.

   When the delivery SMTP server makes the "final delivery" of a
   message, it inserts a return-path line at the beginning of the mail
   data.  This use of return-path is required; mail systems MUST support
   it.  The return-path line preserves the information in the &lt;reverse-
   path&gt; from the MAIL command.  Here, final delivery means the message
   has left the SMTP environment.  Normally, this would mean it had been
   delivered to the destination user or an associated mail drop, but in
   some cases it may be further processed and transmitted by another
   mail system.

   It is possible for the mailbox in the return path to be different
   from the actual sender's mailbox, for example, if error responses are
   to be delivered to a special error handling mailbox rather than to
   the message sender.  When mailing lists are involved, this
   arrangement is common and useful as a means of directing errors to
   the list maintainer rather than the message originator.

   The text above implies that the final mail data will begin with a
   return path line, followed by one or more time stamp lines.  These
   lines will be followed by the mail data headers and body [<a href="#ref-32" title='"Internet Message Format"'>32</a>].

   It is sometimes difficult for an SMTP server to determine whether or
   not it is making final delivery since forwarding or other operations
   may occur after the message is accepted for delivery.  Consequently,




<span class="grey">Klensin                     Standards Track                    [Page 50]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-51" id="page-51" href="#page-51" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   any further (forwarding, gateway, or relay) systems MAY remove the
   return path and rebuild the MAIL command as needed to ensure that
   exactly one such line appears in a delivered message.

   A message-originating SMTP system SHOULD NOT send a message that
   already contains a Return-path header.  SMTP servers performing a
   relay function MUST NOT inspect the message data, and especially not
   to the extent needed to determine if Return-path headers are present.
   SMTP servers making final delivery MAY remove Return-path headers
   before adding their own.

   The primary purpose of the Return-path is to designate the address to
   which messages indicating non-delivery or other mail system failures
   are to be sent.  For this to be unambiguous, exactly one return path
   SHOULD be present when the message is delivered.  Systems using <a href="http://tools.ietf.org/html/rfc822">RFC</a>
   <a href="http://tools.ietf.org/html/rfc822">822</a> syntax with non-SMTP transports SHOULD designate an unambiguous
   address, associated with the transport envelope, to which error
   reports (e.g., non-delivery messages) should be sent.

   Historical note: Text in <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> that appears to contradict the use
   of the Return-path header (or the envelope reverse path address from
   the MAIL command) as the destination for error messages is not
   applicable on the Internet.  The reverse path address (as copied into
   the Return-path) MUST be used as the target of any mail containing
   delivery error messages.

   In particular:

   -  a gateway from SMTP-&gt;elsewhere SHOULD insert a return-path header,
      unless it is known that the "elsewhere" transport also uses
      Internet domain addresses and maintains the envelope sender
      address separately.

   -  a gateway from elsewhere-&gt;SMTP SHOULD delete any return-path
      header present in the message, and either copy that information to
      the SMTP envelope or combine it with information present in the
      envelope of the other transport system to construct the reverse
      path argument to the MAIL command in the SMTP envelope.

   The server must give special treatment to cases in which the
   processing following the end of mail data indication is only
   partially successful.  This could happen if, after accepting several
   recipients and the mail data, the SMTP server finds that the mail
   data could be successfully delivered to some, but not all, of the
   recipients.  In such cases, the response to the DATA command MUST be
   an OK reply.  However, the SMTP server MUST compose and send an
   "undeliverable mail" notification message to the originator of the
   message.



<span class="grey">Klensin                     Standards Track                    [Page 51]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-52" id="page-52" href="#page-52" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   A single notification listing all of the failed recipients or
   separate notification messages MUST be sent for each failed
   recipient.  For economy of processing by the sender, the former is
   preferred when possible.  All undeliverable mail notification
   messages are sent using the MAIL command (even if they result from
   processing the obsolete SEND, SOML, or SAML commands) and use a null
   return path as discussed in <a href="#section-3.7">section 3.7</a>.

   The time stamp line and the return path line are formally defined as
   follows:

Return-path-line = "Return-Path:" FWS Reverse-path &lt;CRLF&gt;

Time-stamp-line = "Received:" FWS Stamp &lt;CRLF&gt;

Stamp = From-domain By-domain Opt-info ";"  FWS date-time

      ; where "date-time" is as defined in [<a href="#ref-32" title='"Internet Message Format"'>32</a>]
      ; but the "obs-" forms, especially two-digit
      ; years, are prohibited in SMTP and MUST NOT be used.

From-domain = "FROM" FWS Extended-Domain CFWS

By-domain = "BY" FWS Extended-Domain CFWS

Extended-Domain = Domain /
           ( Domain FWS "(" TCP-info ")" ) /
           ( Address-literal FWS "(" TCP-info ")" )

TCP-info = Address-literal / ( Domain FWS Address-literal )
      ; Information derived by server from TCP connection
      ; not client EHLO.

Opt-info = [Via] [With] [ID] [For]

Via = "VIA" FWS Link CFWS

With = "WITH" FWS Protocol CFWS

ID = "ID" FWS String / msg-id CFWS

For = "FOR" FWS 1*( Path / Mailbox ) CFWS

Link = "TCP" / Addtl-Link
Addtl-Link = Atom
      ; Additional standard names for links are registered with the
         ; Internet Assigned Numbers Authority (IANA).  "Via" is
         ; primarily of value with non-Internet transports.  SMTP



<span class="grey">Klensin                     Standards Track                    [Page 52]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-53" id="page-53" href="#page-53" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


         ; servers SHOULD NOT use unregistered names.
Protocol = "ESMTP" / "SMTP" / Attdl-Protocol
Attdl-Protocol = Atom
      ; Additional standard names for protocols are registered with the
         ; Internet Assigned Numbers Authority (IANA).  SMTP servers
         ; SHOULD NOT use unregistered names.

<span class="h3"><h3><a class="selflink" name="section-4.5" href="#section-4.5">4.5</a> Additional Implementation Issues</h3></span>

<span class="h4"><h4><a class="selflink" name="section-4.5.1" href="#section-4.5.1">4.5.1</a> Minimum Implementation</h4></span>

   In order to make SMTP workable, the following minimum implementation
   is required for all receivers.  The following commands MUST be
   supported to conform to this specification:

      EHLO
      HELO
      MAIL
      RCPT
      DATA
      RSET
      NOOP
      QUIT
      VRFY

   Any system that includes an SMTP server supporting mail relaying or
   delivery MUST support the reserved mailbox "postmaster" as a case-
   insensitive local name.  This postmaster address is not strictly
   necessary if the server always returns 554 on connection opening (as
   described in <a href="#section-3.1">section 3.1</a>).  The requirement to accept mail for
   postmaster implies that RCPT commands which specify a mailbox for
   postmaster at any of the domains for which the SMTP server provides
   mail service, as well as the special case of "RCPT TO:&lt;Postmaster&gt;"
   (with no domain specification), MUST be supported.

   SMTP systems are expected to make every reasonable effort to accept
   mail directed to Postmaster from any other system on the Internet.
   In extreme cases --such as to contain a denial of service attack or
   other breach of security-- an SMTP server may block mail directed to
   Postmaster.  However, such arrangements SHOULD be narrowly tailored
   so as to avoid blocking messages which are not part of such attacks.

<span class="h4"><h4><a class="selflink" name="section-4.5.2" href="#section-4.5.2">4.5.2</a> Transparency</h4></span>

   Without some provision for data transparency, the character sequence
   "&lt;CRLF&gt;.&lt;CRLF&gt;" ends the mail text and cannot be sent by the user.
   In general, users are not aware of such "forbidden" sequences.  To




<span class="grey">Klensin                     Standards Track                    [Page 53]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-54" id="page-54" href="#page-54" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   allow all user composed text to be transmitted transparently, the
   following procedures are used:

   -  Before sending a line of mail text, the SMTP client checks the
      first character of the line.  If it is a period, one additional
      period is inserted at the beginning of the line.

   -  When a line of mail text is received by the SMTP server, it checks
      the line.  If the line is composed of a single period, it is
      treated as the end of mail indicator.  If the first character is a
      period and there are other characters on the line, the first
      character is deleted.

   The mail data may contain any of the 128 ASCII characters.  All
   characters are to be delivered to the recipient's mailbox, including
   spaces, vertical and horizontal tabs, and other control characters.
   If the transmission channel provides an 8-bit byte (octet) data
   stream, the 7-bit ASCII codes are transmitted right justified in the
   octets, with the high order bits cleared to zero.  See 3.7 for
   special treatment of these conditions in SMTP systems serving a relay
   function.

   In some systems it may be necessary to transform the data as it is
   received and stored.  This may be necessary for hosts that use a
   different character set than ASCII as their local character set, that
   store data in records rather than strings, or which use special
   character sequences as delimiters inside mailboxes.  If such
   transformations are necessary, they MUST be reversible, especially if
   they are applied to mail being relayed.

<span class="h4"><h4><a class="selflink" name="section-4.5.3" href="#section-4.5.3">4.5.3</a> Sizes and Timeouts</h4></span>

<span class="h5"><h5><a class="selflink" name="section-4.5.3.1" href="#section-4.5.3.1">4.5.3.1</a> Size limits and minimums</h5></span>

   There are several objects that have required minimum/maximum sizes.
   Every implementation MUST be able to receive objects of at least
   these sizes.  Objects larger than these sizes SHOULD be avoided when
   possible.  However, some Internet mail constructs such as encoded
   X.400 addresses [<a href="#ref-16" title='"Mapping between X.400 and RFC822/MIME"'>16</a>] will often require larger objects: clients MAY
   attempt to transmit these, but MUST be prepared for a server to
   reject them if they cannot be handled by it.  To the maximum extent
   possible, implementation techniques which impose no limits on the
   length of these objects should be used.

   local-part
      The maximum total length of a user name or other local-part is 64
      characters.




<span class="grey">Klensin                     Standards Track                    [Page 54]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-55" id="page-55" href="#page-55" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   domain
      The maximum total length of a domain name or number is 255
      characters.

   path
      The maximum total length of a reverse-path or forward-path is 256
      characters (including the punctuation and element separators).

   command line
      The maximum total length of a command line including the command
      word and the &lt;CRLF&gt; is 512 characters.  SMTP extensions may be
      used to increase this limit.

   reply line
      The maximum total length of a reply line including the reply code
      and the &lt;CRLF&gt; is 512 characters.  More information may be
      conveyed through multiple-line replies.

   text line
      The maximum total length of a text line including the &lt;CRLF&gt; is
      1000 characters (not counting the leading dot duplicated for
      transparency).  This number may be increased by the use of SMTP
      Service Extensions.

   message content
      The maximum total length of a message content (including any
      message headers as well as the message body) MUST BE at least 64K
      octets.  Since the introduction of Internet standards for
      multimedia mail [<a href="#ref-12" title='"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"'>12</a>], message lengths on the Internet have grown
      dramatically, and message size restrictions should be avoided if
      at all possible.  SMTP server systems that must impose
      restrictions SHOULD implement the "SIZE" service extension [<a href="#ref-18" title='"SMTP Service Extension for Message Size Declaration"'>18</a>],
      and SMTP client systems that will send large messages SHOULD
      utilize it when possible.

   recipients buffer
      The minimum total number of recipients that must be buffered is
      100 recipients.  Rejection of messages (for excessive recipients)
      with fewer than 100 RCPT commands is a violation of this
      specification.  The general principle that relaying SMTP servers
      MUST NOT, and delivery SMTP servers SHOULD NOT, perform validation
      tests on message headers suggests that rejecting a message based
      on the total number of recipients shown in header fields is to be
      discouraged.  A server which imposes a limit on the number of
      recipients MUST behave in an orderly fashion,  such as to reject
      additional addresses over its limit rather than silently
      discarding addresses previously accepted.  A client that needs to




<span class="grey">Klensin                     Standards Track                    [Page 55]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-56" id="page-56" href="#page-56" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      deliver a message containing over 100 RCPT commands SHOULD be
      prepared to transmit in 100-recipient "chunks" if the server
      declines to accept more than 100 recipients in a single message.

   Errors due to exceeding these limits may be reported by using the
   reply codes.  Some examples of reply codes are:

      500 Line too long.
   or
      501 Path too long
   or
      452 Too many recipients  (see below)
   or
      552 Too much mail data.

   <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> [<a href="#ref-30" title='"Simple Mail Transfer Protocol"'>30</a>] incorrectly listed the error where an SMTP server
   exhausts its implementation limit on the number of RCPT commands
   ("too many recipients") as having reply code 552.  The correct reply
   code for this condition is 452.  Clients SHOULD treat a 552 code in
   this case as a temporary, rather than permanent, failure so the logic
   below works.

   When a conforming SMTP server encounters this condition, it has at
   least 100 successful RCPT commands in its recipients buffer.  If the
   server is able to accept the message, then at least these 100
   addresses will be removed from the SMTP client's queue.  When the
   client attempts retransmission of those addresses which received 452
   responses, at least 100 of these will be able to fit in the SMTP
   server's recipients buffer.  Each retransmission attempt which is
   able to deliver anything will be able to dispose of at least 100 of
   these recipients.

   If an SMTP server has an implementation limit on the number of RCPT
   commands and this limit is exhausted, it MUST use a response code of
   452 (but the client SHOULD also be prepared for a 552, as noted
   above).  If the server has a configured site-policy limitation on the
   number of RCPT commands, it MAY instead use a 5XX response code.
   This would be most appropriate if the policy limitation was intended
   to apply if the total recipient count for a particular message body
   were enforced even if that message body was sent in multiple mail
   transactions.

<span class="h5"><h5><a class="selflink" name="section-4.5.3.2" href="#section-4.5.3.2">4.5.3.2</a> Timeouts</h5></span>

   An SMTP client MUST provide a timeout mechanism.  It MUST use per-
   command timeouts rather than somehow trying to time the entire mail
   transaction.  Timeouts SHOULD be easily reconfigurable, preferably
   without recompiling the SMTP code.  To implement this, a timer is set



<span class="grey">Klensin                     Standards Track                    [Page 56]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-57" id="page-57" href="#page-57" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   for each SMTP command and for each buffer of the data transfer.  The
   latter means that the overall timeout is inherently proportional to
   the size of the message.

   Based on extensive experience with busy mail-relay hosts, the minimum
   per-command timeout values SHOULD be as follows:

   Initial 220 Message: 5 minutes
      An SMTP client process needs to distinguish between a failed TCP
      connection and a delay in receiving the initial 220 greeting
      message.  Many SMTP servers accept a TCP connection but delay
      delivery of the 220 message until their system load permits more
      mail to be processed.

   MAIL Command: 5 minutes

   RCPT Command: 5 minutes
      A longer timeout is required if processing of mailing lists and
      aliases is not deferred until after the message was accepted.

   DATA Initiation: 2 minutes
      This is while awaiting the "354 Start Input" reply to a DATA
      command.

   Data Block: 3 minutes
      This is while awaiting the completion of each TCP SEND call
      transmitting a chunk of data.

   DATA Termination: 10 minutes.
      This is while awaiting the "250 OK" reply.  When the receiver gets
      the final period terminating the message data, it typically
      performs processing to deliver the message to a user mailbox.  A
      spurious timeout at this point would be very wasteful and would
      typically result in delivery of multiple copies of the message,
      since it has been successfully sent and the server has accepted
      responsibility for delivery.  See <a href="#section-6.1">section 6.1</a> for additional
      discussion.

   An SMTP server SHOULD have a timeout of at least 5 minutes while it
   is awaiting the next command from the sender.

<span class="h4"><h4><a class="selflink" name="section-4.5.4" href="#section-4.5.4">4.5.4</a> Retry Strategies</h4></span>

   The common structure of a host SMTP implementation includes user
   mailboxes, one or more areas for queuing messages in transit, and one
   or more daemon processes for sending and receiving mail.  The exact
   structure will vary depending on the needs of the users on the host




<span class="grey">Klensin                     Standards Track                    [Page 57]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-58" id="page-58" href="#page-58" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   and the number and size of mailing lists supported by the host.  We
   describe several optimizations that have proved helpful, particularly
   for mailers supporting high traffic levels.

   Any queuing strategy MUST include timeouts on all activities on a
   per-command basis.  A queuing strategy MUST NOT send error messages
   in response to error messages under any circumstances.

<span class="h5"><h5><a class="selflink" name="section-4.5.4.1" href="#section-4.5.4.1">4.5.4.1</a> Sending Strategy</h5></span>

   The general model for an SMTP client is one or more processes that
   periodically attempt to transmit outgoing mail.  In a typical system,
   the program that composes a message has some method for requesting
   immediate attention for a new piece of outgoing mail, while mail that
   cannot be transmitted immediately MUST be queued and periodically
   retried by the sender.  A mail queue entry will include not only the
   message itself but also the envelope information.

   The sender MUST delay retrying a particular destination after one
   attempt has failed.  In general, the retry interval SHOULD be at
   least 30 minutes; however, more sophisticated and variable strategies
   will be beneficial when the SMTP client can determine the reason for
   non-delivery.

   Retries continue until the message is transmitted or the sender gives
   up; the give-up time generally needs to be at least 4-5 days.  The
   parameters to the retry algorithm MUST be configurable.

   A client SHOULD keep a list of hosts it cannot reach and
   corresponding connection timeouts, rather than just retrying queued
   mail items.

   Experience suggests that failures are typically transient (the target
   system or its connection has crashed), favoring a policy of two
   connection attempts in the first hour the message is in the queue,
   and then backing off to one every two or three hours.

   The SMTP client can shorten the queuing delay in cooperation with the
   SMTP server.  For example, if mail is received from a particular
   address, it is likely that mail queued for that host can now be sent.
   Application of this principle may, in many cases, eliminate the
   requirement for an explicit "send queues now" function such as ETRN
   [<a href="#ref-9" title='"SMTP Service Extension for Remote Message Queue Starting"'>9</a>].

   The strategy may be further modified as a result of multiple
   addresses per host (see below) to optimize delivery time vs. resource
   usage.




<span class="grey">Klensin                     Standards Track                    [Page 58]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-59" id="page-59" href="#page-59" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   An SMTP client may have a large queue of messages for each
   unavailable destination host.  If all of these messages were retried
   in every retry cycle, there would be excessive Internet overhead and
   the sending system would be blocked for a long period.  Note that an
   SMTP client can generally determine that a delivery attempt has
   failed only after a timeout of several minutes and even a one-minute
   timeout per connection will result in a very large delay if retries
   are repeated for dozens, or even hundreds, of queued messages to the
   same host.

   At the same time, SMTP clients SHOULD use great care in caching
   negative responses from servers.  In an extreme case, if EHLO is
   issued multiple times during the same SMTP connection, different
   answers may be returned by the server.  More significantly, 5yz
   responses to the MAIL command MUST NOT be cached.

   When a mail message is to be delivered to multiple recipients, and
   the SMTP server to which a copy of the message is to be sent is the
   same for multiple recipients, then only one copy of the message
   SHOULD be transmitted.  That is, the SMTP client SHOULD use the
   command sequence:  MAIL, RCPT, RCPT,... RCPT, DATA instead of the
   sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA.  However, if there
   are very many addresses, a limit on the number of RCPT commands per
   MAIL command MAY be imposed.  Implementation of this efficiency
   feature is strongly encouraged.

   Similarly, to achieve timely delivery, the SMTP client MAY support
   multiple concurrent outgoing mail transactions.  However, some limit
   may be appropriate to protect the host from devoting all its
   resources to mail.

<span class="h5"><h5><a class="selflink" name="section-4.5.4.2" href="#section-4.5.4.2">4.5.4.2</a> Receiving Strategy</h5></span>

   The SMTP server SHOULD attempt to keep a pending listen on the SMTP
   port at all times.  This requires the support of multiple incoming
   TCP connections for SMTP.  Some limit MAY be imposed but servers that
   cannot handle more than one SMTP transaction at a time are not in
   conformance with the intent of this specification.

   As discussed above, when the SMTP server receives mail from a
   particular host address, it could activate its own SMTP queuing
   mechanisms to retry any mail pending for that host address.

<span class="h4"><h4><a class="selflink" name="section-4.5.5" href="#section-4.5.5">4.5.5</a>   Messages with a null reverse-path</h4></span>

   There are several types of notification messages which are required
   by existing and proposed standards to be sent with a null reverse
   path, namely non-delivery notifications as discussed in <a href="#section-3.7">section 3.7</a>,



<span class="grey">Klensin                     Standards Track                    [Page 59]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-60" id="page-60" href="#page-60" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   other kinds of Delivery Status Notifications (DSNs) [<a href="#ref-24" title='"SMTP Service Extension for Delivery Status Notifications"'>24</a>], and also
   Message Disposition Notifications (MDNs) [<a href="#ref-10" title='"An Extensible Message Format for Message Disposition Notifications"'>10</a>].  All of these kinds of
   messages are notifications about a previous message, and they are
   sent to the reverse-path of the previous mail message.  (If the
   delivery of such a notification message fails, that usually indicates
   a problem with the mail system of the host to which the notification
   message is addressed.  For this reason, at some hosts the MTA is set
   up to forward such failed notification messages to someone who is
   able to fix problems with the mail system, e.g., via the postmaster
   alias.)

   All other types of messages (i.e., any message which is not required
   by a standards-track RFC to have a null reverse-path) SHOULD be sent
   with with a valid, non-null reverse-path.

   Implementors of automated email processors should be careful to make
   sure that the various kinds of messages with null reverse-path are
   handled correctly, in particular such systems SHOULD NOT reply to
   messages with null reverse-path.

<span class="h2"><h2><a class="selflink" name="section-5" href="#section-5">5</a>. Address Resolution and Mail Handling</h2></span>

   Once an SMTP client lexically identifies a domain to which mail will
   be delivered for processing (as described in sections <a href="#section-3.6">3.6</a> and <a href="#section-3.7">3.7</a>), a
   DNS lookup MUST be performed to resolve the domain name [<a href="#ref-22" title='"Domain names - implementation and specification"'>22</a>].  The
   names are expected to be fully-qualified domain names (FQDNs):
   mechanisms for inferring FQDNs from partial names or local aliases
   are outside of this specification and, due to a history of problems,
   are generally discouraged.  The lookup first attempts to locate an MX
   record associated with the name.  If a CNAME record is found instead,
   the resulting name is processed as if it were the initial name.  If
   no MX records are found, but an A RR is found, the A RR is treated as
   if it was associated with an implicit MX RR, with a preference of 0,
   pointing to that host.  If one or more MX RRs are found for a given
   name, SMTP systems MUST NOT utilize any A RRs associated with that
   name unless they are located using the MX RRs; the "implicit MX" rule
   above applies only if there are no MX records present.  If MX records
   are present, but none of them are usable, this situation MUST be
   reported as an error.

   When the lookup succeeds, the mapping can result in a list of
   alternative delivery addresses rather than a single address, because
   of multiple MX records, multihoming, or both.  To provide reliable
   mail transmission, the SMTP client MUST be able to try (and retry)
   each of the relevant addresses in this list in order, until a
   delivery attempt succeeds.  However, there MAY also be a configurable
   limit on the number of alternate addresses that can be tried.  In any
   case, the SMTP client SHOULD try at least two addresses.



<span class="grey">Klensin                     Standards Track                    [Page 60]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-61" id="page-61" href="#page-61" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   Two types of information is used to rank the host addresses: multiple
   MX records, and multihomed hosts.

   Multiple MX records contain a preference indication that MUST be used
   in sorting (see below).  Lower numbers are more preferred than higher
   ones.  If there are multiple destinations with the same preference
   and there is no clear reason to favor one (e.g., by recognition of an
   easily-reached address), then the sender-SMTP MUST randomize them to
   spread the load across multiple mail exchangers for a specific
   organization.

   The destination host (perhaps taken from the preferred MX record) may
   be multihomed, in which case the domain name resolver will return a
   list of alternative IP addresses.  It is the responsibility of the
   domain name resolver interface to have ordered this list by
   decreasing preference if necessary, and SMTP MUST try them in the
   order presented.

   Although the capability to try multiple alternative addresses is
   required, specific installations may want to limit or disable the use
   of alternative addresses.  The question of whether a sender should
   attempt retries using the different addresses of a multihomed host
   has been controversial.  The main argument for using the multiple
   addresses is that it maximizes the probability of timely delivery,
   and indeed sometimes the probability of any delivery; the counter-
   argument is that it may result in unnecessary resource use.  Note
   that resource use is also strongly determined by the sending strategy
   discussed in <a href="#section-4.5.4.1">section 4.5.4.1</a>.

   If an SMTP server receives a message with a destination for which it
   is a designated Mail eXchanger, it MAY relay the message (potentially
   after having rewritten the MAIL FROM and/or RCPT TO addresses), make
   final delivery of the message, or hand it off using some mechanism
   outside the SMTP-provided transport environment.  Of course, neither
   of the latter require that the list of MX records be examined
   further.

   If it determines that it should relay the message without rewriting
   the address, it MUST sort the MX records to determine candidates for
   delivery.  The records are first ordered by preference, with the
   lowest-numbered records being most preferred.  The relay host MUST
   then inspect the list for any of the names or addresses by which it
   might be known in mail transactions.  If a matching record is found,
   all records at that preference level and higher-numbered ones MUST be
   discarded from consideration.  If there are no records left at that
   point, it is an error condition, and the message MUST be returned as
   undeliverable.  If records do remain, they SHOULD be tried, best
   preference first, as described above.



<span class="grey">Klensin                     Standards Track                    [Page 61]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-62" id="page-62" href="#page-62" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h2"><h2><a class="selflink" name="section-6" href="#section-6">6</a>. Problem Detection and Handling</h2></span>

<span class="h3"><h3><a class="selflink" name="section-6.1" href="#section-6.1">6.1</a> Reliable Delivery and Replies by Email</h3></span>

   When the receiver-SMTP accepts a piece of mail (by sending a "250 OK"
   message in response to DATA), it is accepting responsibility for
   delivering or relaying the message.  It must take this responsibility
   seriously.  It MUST NOT lose the message for frivolous reasons, such
   as because the host later crashes or because of a predictable
   resource shortage.

   If there is a delivery failure after acceptance of a message, the
   receiver-SMTP MUST formulate and mail a notification message.  This
   notification MUST be sent using a null ("&lt;&gt;") reverse path in the
   envelope.  The recipient of this notification MUST be the address
   from the envelope return path (or the Return-Path: line).  However,
   if this address is null ("&lt;&gt;"), the receiver-SMTP MUST NOT send a
   notification.  Obviously, nothing in this section can or should
   prohibit local decisions (i.e., as part of the same system
   environment as the receiver-SMTP) to log or otherwise transmit
   information about null address events locally if that is desired.  If
   the address is an explicit source route, it MUST be stripped down to
   its final hop.

   For example, suppose that an error notification must be sent for a
   message that arrived with:

      MAIL FROM:&lt;@a,@b:user@d&gt;

   The notification message MUST be sent using:

      RCPT TO:&lt;user@d&gt;

   Some delivery failures after the message is accepted by SMTP will be
   unavoidable.  For example, it may be impossible for the receiving
   SMTP server to validate all the delivery addresses in RCPT command(s)
   due to a "soft" domain system error, because the target is a mailing
   list (see earlier discussion of RCPT), or because the server is
   acting as a relay and has no immediate access to the delivering
   system.

   To avoid receiving duplicate messages as the result of timeouts, a
   receiver-SMTP MUST seek to minimize the time required to respond to
   the final &lt;CRLF&gt;.&lt;CRLF&gt; end of data indicator.  See <a href="http://tools.ietf.org/html/rfc1047">RFC 1047</a> [<a href="#ref-28" title='"Duplicate messages and SMTP"'>28</a>] for
   a discussion of this problem.






<span class="grey">Klensin                     Standards Track                    [Page 62]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-63" id="page-63" href="#page-63" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h3"><h3><a class="selflink" name="section-6.2" href="#section-6.2">6.2</a> Loop Detection</h3></span>

   Simple counting of the number of "Received:" headers in a message has
   proven to be an effective, although rarely optimal, method of
   detecting loops in mail systems.  SMTP servers using this technique
   SHOULD use a large rejection threshold, normally at least 100
   Received entries.  Whatever mechanisms are used, servers MUST contain
   provisions for detecting and stopping trivial loops.

<span class="h3"><h3><a class="selflink" name="section-6.3" href="#section-6.3">6.3</a> Compensating for Irregularities</h3></span>

   Unfortunately, variations, creative interpretations, and outright
   violations of Internet mail protocols do occur; some would suggest
   that they occur quite frequently.  The debate as to whether a well-
   behaved SMTP receiver or relay should reject a malformed message,
   attempt to pass it on unchanged, or attempt to repair it to increase
   the odds of successful delivery (or subsequent reply) began almost
   with the dawn of structured network mail and shows no signs of
   abating.  Advocates of rejection claim that attempted repairs are
   rarely completely adequate and that rejection of bad messages is the
   only way to get the offending software repaired.  Advocates of
   "repair" or "deliver no matter what" argue that users prefer that
   mail go through it if at all possible and that there are significant
   market pressures in that direction.  In practice, these market
   pressures may be more important to particular vendors than strict
   conformance to the standards, regardless of the preference of the
   actual developers.

   The problems associated with ill-formed messages were exacerbated by
   the introduction of the split-UA mail reading protocols [3, 26, 5,
   21].  These protocols have encouraged the use of SMTP as a posting
   protocol, and SMTP servers as relay systems for these client hosts
   (which are often only intermittently connected to the Internet).
   Historically, many of those client machines lacked some of the
   mechanisms and information assumed by SMTP (and indeed, by the mail
   format protocol [<a href="#ref-7" title='"Standard for the Format of ARPA Internet Text Messages"'>7</a>]).  Some could not keep adequate track of time;
   others had no concept of time zones; still others could not identify
   their own names or addresses; and, of course, none could satisfy the
   assumptions that underlay <a href="http://tools.ietf.org/html/rfc822">RFC 822</a>'s conception of authenticated
   addresses.

   In response to these weak SMTP clients, many SMTP systems now
   complete messages that are delivered to them in incomplete or
   incorrect form.  This strategy is generally considered appropriate
   when the server can identify or authenticate the client, and there
   are prior agreements between them.  By contrast, there is at best
   great concern about fixes applied by a relay or delivery SMTP server
   that has little or no knowledge of the user or client machine.



<span class="grey">Klensin                     Standards Track                    [Page 63]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-64" id="page-64" href="#page-64" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   The following changes to a message being processed MAY be applied
   when necessary by an originating SMTP server, or one used as the
   target of SMTP as an initial posting protocol:

   -  Addition of a message-id field when none appears

   -  Addition of a date, time or time zone when none appears

   -  Correction of addresses to proper FQDN format

   The less information the server has about the client, the less likely
   these changes are to be correct and the more caution and conservatism
   should be applied when considering whether or not to perform fixes
   and how.  These changes MUST NOT be applied by an SMTP server that
   provides an intermediate relay function.

   In all cases, properly-operating clients supplying correct
   information are preferred to corrections by the SMTP server.  In all
   cases, documentation of actions performed by the servers (in trace
   fields and/or header comments) is strongly encouraged.

<span class="h2"><h2><a class="selflink" name="section-7" href="#section-7">7</a>. Security Considerations</h2></span>

<span class="h3"><h3><a class="selflink" name="section-7.1" href="#section-7.1">7.1</a> Mail Security and Spoofing</h3></span>

   SMTP mail is inherently insecure in that it is feasible for even
   fairly casual users to negotiate directly with receiving and relaying
   SMTP servers and create messages that will trick a naive recipient
   into believing that they came from somewhere else.  Constructing such
   a message so that the "spoofed" behavior cannot be detected by an
   expert is somewhat more difficult, but not sufficiently so as to be a
   deterrent to someone who is determined and knowledgeable.
   Consequently, as knowledge of Internet mail increases, so does the
   knowledge that SMTP mail inherently cannot be authenticated, or
   integrity checks provided, at the transport level.  Real mail
   security lies only in end-to-end methods involving the message
   bodies, such as those which use digital signatures (see [<a href="#ref-14" title='"Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted"'>14</a>] and,
   e.g., PGP [<a href="#ref-4" title='"OpenPGP Message Format"'>4</a>] or S/MIME [<a href="#ref-31" title='"S/MIME Version 3 Message Specification"'>31</a>]).

   Various protocol extensions and configuration options that provide
   authentication at the transport level (e.g., from an SMTP client to
   an SMTP server) improve somewhat on the traditional situation
   described above.  However, unless they are accompanied by careful
   handoffs of responsibility in a carefully-designed trust environment,
   they remain inherently weaker than end-to-end mechanisms which use
   digitally signed messages rather than depending on the integrity of
   the transport system.




<span class="grey">Klensin                     Standards Track                    [Page 64]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-65" id="page-65" href="#page-65" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   Efforts to make it more difficult for users to set envelope return
   path and header "From" fields to point to valid addresses other than
   their own are largely misguided: they frustrate legitimate
   applications in which mail is sent by one user on behalf of another
   or in which error (or normal) replies should be directed to a special
   address.  (Systems that provide convenient ways for users to alter
   these fields on a per-message basis should attempt to establish a
   primary and permanent mailbox address for the user so that Sender
   fields within the message data can be generated sensibly.)

   This specification does not further address the authentication issues
   associated with SMTP other than to advocate that useful functionality
   not be disabled in the hope of providing some small margin of
   protection against an ignorant user who is trying to fake mail.

<span class="h3"><h3><a class="selflink" name="section-7.2" href="#section-7.2">7.2</a> "Blind" Copies</h3></span>

   Addresses that do not appear in the message headers may appear in the
   RCPT commands to an SMTP server for a number of reasons.  The two
   most common involve the use of a mailing address as a "list exploder"
   (a single address that resolves into multiple addresses) and the
   appearance of "blind copies".  Especially when more than one RCPT
   command is present, and in order to avoid defeating some of the
   purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy
   the full set of RCPT command arguments into the headers, either as
   part of trace headers or as informational or private-extension
   headers.  Since this rule is often violated in practice, and cannot
   be enforced, sending SMTP systems that are aware of "bcc" use MAY
   find it helpful to send each blind copy as a separate message
   transaction containing only a single RCPT command.

   There is no inherent relationship between either "reverse" (from
   MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP
   transaction ("envelope") and the addresses in the headers.  Receiving
   systems SHOULD NOT attempt to deduce such relationships and use them
   to alter the headers of the message for delivery.  The popular
   "Apparently-to" header is a violation of this principle as well as a
   common source of unintended information disclosure and SHOULD NOT be
   used.

<span class="h3"><h3><a class="selflink" name="section-7.3" href="#section-7.3">7.3</a> VRFY, EXPN, and Security</h3></span>

   As discussed in <a href="#section-3.5">section 3.5</a>, individual sites may want to disable
   either or both of VRFY or EXPN for security reasons.  As a corollary
   to the above, implementations that permit this MUST NOT appear to
   have verified addresses that are not, in fact, verified.  If a site





<span class="grey">Klensin                     Standards Track                    [Page 65]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-66" id="page-66" href="#page-66" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   disables these commands for security reasons, the SMTP server MUST
   return a 252 response, rather than a code that could be confused with
   successful or unsuccessful verification.

   Returning a 250 reply code with the address listed in the VRFY
   command after having checked it only for syntax violates this rule.
   Of course, an implementation that "supports" VRFY by always returning
   550 whether or not the address is valid is equally not in
   conformance.

   Within the last few years, the contents of mailing lists have become
   popular as an address information source for so-called "spammers."
   The use of EXPN to "harvest" addresses has increased as list
   administrators have installed protections against inappropriate uses
   of the lists themselves.  Implementations SHOULD still provide
   support for EXPN, but sites SHOULD carefully evaluate the tradeoffs.
   As authentication mechanisms are introduced into SMTP, some sites may
   choose to make EXPN available only to authenticated requestors.

<span class="h3"><h3><a class="selflink" name="section-7.4" href="#section-7.4">7.4</a> Information Disclosure in Announcements</h3></span>

   There has been an ongoing debate about the tradeoffs between the
   debugging advantages of announcing server type and version (and,
   sometimes, even server domain name) in the greeting response or in
   response to the HELP command and the disadvantages of exposing
   information that might be useful in a potential hostile attack.  The
   utility of the debugging information is beyond doubt.  Those who
   argue for making it available point out that it is far better to
   actually secure an SMTP server rather than hope that trying to
   conceal known vulnerabilities by hiding the server's precise identity
   will provide more protection.  Sites are encouraged to evaluate the
   tradeoff with that issue in mind; implementations are strongly
   encouraged to minimally provide for making type and version
   information available in some way to other network hosts.

<span class="h3"><h3><a class="selflink" name="section-7.5" href="#section-7.5">7.5</a> Information Disclosure in Trace Fields</h3></span>

   In some circumstances, such as when mail originates from within a LAN
   whose hosts are not directly on the public Internet, trace
   ("Received") fields produced in conformance with this specification
   may disclose host names and similar information that would not
   normally be available.  This ordinarily does not pose a problem, but
   sites with special concerns about name disclosure should be aware of
   it.  Also, the optional FOR clause should be supplied with caution or
   not at all when multiple recipients are involved lest it
   inadvertently disclose the identities of "blind copy" recipients to
   others.




<span class="grey">Klensin                     Standards Track                    [Page 66]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-67" id="page-67" href="#page-67" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h3"><h3><a class="selflink" name="section-7.6" href="#section-7.6">7.6</a> Information Disclosure in Message Forwarding</h3></span>

   As discussed in <a href="#section-3.4">section 3.4</a>, use of the 251 or 551 reply codes to
   identify the replacement address associated with a mailbox may
   inadvertently disclose sensitive information.  Sites that are
   concerned about those issues should ensure that they select and
   configure servers appropriately.

<span class="h3"><h3><a class="selflink" name="section-7.7" href="#section-7.7">7.7</a> Scope of Operation of SMTP Servers</h3></span>

   It is a well-established principle that an SMTP server may refuse to
   accept mail for any operational or technical reason that makes sense
   to the site providing the server.  However, cooperation among sites
   and installations makes the Internet possible.  If sites take
   excessive advantage of the right to reject traffic, the ubiquity of
   email availability (one of the strengths of the Internet) will be
   threatened; considerable care should be taken and balance maintained
   if a site decides to be selective about the traffic it will accept
   and process.

   In recent years, use of the relay function through arbitrary sites
   has been used as part of hostile efforts to hide the actual origins
   of mail.  Some sites have decided to limit the use of the relay
   function to known or identifiable sources, and implementations SHOULD
   provide the capability to perform this type of filtering.  When mail
   is rejected for these or other policy reasons, a 550 code SHOULD be
   used in response to EHLO, MAIL, or RCPT as appropriate.

<span class="h2"><h2><a class="selflink" name="section-8" href="#section-8">8</a>. IANA Considerations</h2></span>

   IANA will maintain three registries in support of this specification.
   The first consists of SMTP service extensions with the associated
   keywords, and, as needed, parameters and verbs.  As specified in
   <a href="#section-2.2.2">section 2.2.2</a>, no entry may be made in this registry that starts in
   an "X".  Entries may be made only for service extensions (and
   associated keywords, parameters, or verbs) that are defined in
   standards-track or experimental RFCs specifically approved by the
   IESG for this purpose.

   The second registry consists of "tags" that identify forms of domain
   literals other than those for IPv4 addresses (specified in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>
   and in this document) and IPv6 addresses (specified in this
   document).  Additional literal types require standardization before
   being used; none are anticipated at this time.

   The third, established by <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> and renewed by this specification,
   is a registry of link and protocol identifiers to be used with the
   "via" and "with" subclauses of the time stamp ("Received: header")



<span class="grey">Klensin                     Standards Track                    [Page 67]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-68" id="page-68" href="#page-68" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   described in <a href="#section-4.4">section 4.4</a>.  Link and protocol identifiers in addition
   to those specified in this document may be registered only by
   standardization or by way of an RFC-documented, IESG-approved,
   Experimental protocol extension.

<span class="h2"><h2><a class="selflink" name="section-9" href="#section-9">9</a>. References</h2></span>

   [<a name="ref-1" id="ref-1">1</a>]  American National Standards Institute (formerly United States of
        America Standards Institute), X3.4, 1968, "USA Code for
        Information Interchange". ANSI X3.4-1968 has been replaced by
        newer versions with slight modifications, but the 1968 version
        remains definitive for the Internet.

   [<a name="ref-2" id="ref-2">2</a>]  Braden, R., "Requirements for Internet hosts - application and
        support", STD 3, <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a>, October 1989.

   [<a name="ref-3" id="ref-3">3</a>]  Butler, M., Chase, D., Goldberger, J., Postel, J. and J.
        Reynolds, "Post Office Protocol - version 2", <a href="http://tools.ietf.org/html/rfc937">RFC 937</a>, February
        1985.

   [<a name="ref-4" id="ref-4">4</a>]  Callas, J., Donnerhacke, L., Finney, H. and R. Thayer, "OpenPGP
        Message Format", <a href="http://tools.ietf.org/html/rfc2440">RFC 2440</a>, November 1998.

   [<a name="ref-5" id="ref-5">5</a>]  Crispin, M., "Interactive Mail Access Protocol - Version 2", <a href="http://tools.ietf.org/html/rfc1176">RFC</a>
        <a href="http://tools.ietf.org/html/rfc1176">1176</a>, August 1990.

   [<a name="ref-6" id="ref-6">6</a>]  Crispin, M., "Internet Message Access Protocol - Version 4", <a href="http://tools.ietf.org/html/rfc2060">RFC</a>
        <a href="http://tools.ietf.org/html/rfc2060">2060</a>, December 1996.

   [<a name="ref-7" id="ref-7">7</a>]  Crocker, D., "Standard for the Format of ARPA Internet Text
        Messages", <a href="http://tools.ietf.org/html/rfc822">RFC 822</a>, August 1982.

   [<a name="ref-8" id="ref-8">8</a>]  Crocker, D. and P. Overell, Eds., "Augmented BNF for Syntax
        Specifications: ABNF", <a href="http://tools.ietf.org/html/rfc2234">RFC 2234</a>, November 1997.

   [<a name="ref-9" id="ref-9">9</a>]  De Winter, J., "SMTP Service Extension for Remote Message Queue
        Starting", <a href="http://tools.ietf.org/html/rfc1985">RFC 1985</a>, August 1996.

   [<a name="ref-10" id="ref-10">10</a>] Fajman, R., "An Extensible Message Format for Message
        Disposition Notifications", <a href="http://tools.ietf.org/html/rfc2298">RFC 2298</a>, March 1998.

   [<a name="ref-11" id="ref-11">11</a>] Freed, N, "Behavior of and Requirements for Internet Firewalls",
        <a href="http://tools.ietf.org/html/rfc2979">RFC 2979</a>, October 2000.

   [<a name="ref-12" id="ref-12">12</a>] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
        Extensions (MIME) Part One: Format of Internet Message Bodies",
        <a href="http://tools.ietf.org/html/rfc2045">RFC 2045</a>, December 1996.




<span class="grey">Klensin                     Standards Track                    [Page 68]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-69" id="page-69" href="#page-69" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   [<a name="ref-13" id="ref-13">13</a>] Freed, N., "SMTP Service Extension for Command Pipelining", <a href="http://tools.ietf.org/html/rfc2920">RFC</a>
        <a href="http://tools.ietf.org/html/rfc2920">2920</a>, September 2000.

   [<a name="ref-14" id="ref-14">14</a>] Galvin, J., Murphy, S., Crocker, S. and N. Freed, "Security
        Multiparts for MIME: Multipart/Signed and Multipart/Encrypted",
        <a href="http://tools.ietf.org/html/rfc1847">RFC 1847</a>, October 1995.

   [<a name="ref-15" id="ref-15">15</a>] Gellens, R. and J. Klensin, "Message Submission", <a href="http://tools.ietf.org/html/rfc2476">RFC 2476</a>,
        December 1998.

   [<a name="ref-16" id="ref-16">16</a>] Kille, S., "Mapping between X.400 and <a href="http://tools.ietf.org/html/rfc822">RFC822</a>/MIME", <a href="http://tools.ietf.org/html/rfc2156">RFC 2156</a>,
        January 1998.

   [<a name="ref-17" id="ref-17">17</a>] Hinden, R and S. Deering, Eds. "IP Version 6 Addressing
        Architecture", <a href="http://tools.ietf.org/html/rfc2373">RFC 2373</a>, July 1998.

   [<a name="ref-18" id="ref-18">18</a>] Klensin, J., Freed, N. and K. Moore, "SMTP Service Extension for
        Message Size Declaration", STD 10, <a href="http://tools.ietf.org/html/rfc1870">RFC 1870</a>, November 1995.

   [<a name="ref-19" id="ref-19">19</a>] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker,
        "SMTP Service Extensions", STD 10, <a href="http://tools.ietf.org/html/rfc1869">RFC 1869</a>, November 1995.

   [<a name="ref-20" id="ref-20">20</a>] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker,
        "SMTP Service Extension for 8bit-MIMEtransport", <a href="http://tools.ietf.org/html/rfc1652">RFC 1652</a>, July
        1994.

   [<a name="ref-21" id="ref-21">21</a>] Lambert, M., "PCMAIL: A distributed mail system for personal
        computers", <a href="http://tools.ietf.org/html/rfc1056">RFC 1056</a>, July 1988.

   [<a name="ref-22" id="ref-22">22</a>] Mockapetris, P., "Domain names - implementation and
        specification", STD 13, <a href="http://tools.ietf.org/html/rfc1035">RFC 1035</a>, November 1987.

        Mockapetris, P., "Domain names - concepts and facilities", STD
        13, <a href="http://tools.ietf.org/html/rfc1034">RFC 1034</a>, November 1987.

   [<a name="ref-23" id="ref-23">23</a>] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part
        Three: Message Header Extensions for Non-ASCII Text", <a href="http://tools.ietf.org/html/rfc2047">RFC 2047</a>,
        December 1996.

   [<a name="ref-24" id="ref-24">24</a>] Moore, K., "SMTP Service Extension for Delivery Status
        Notifications", <a href="http://tools.ietf.org/html/rfc1891">RFC 1891</a>, January 1996.

   [<a name="ref-25" id="ref-25">25</a>] Moore, K., and G. Vaudreuil, "An Extensible Message Format for
        Delivery Status Notifications", <a href="http://tools.ietf.org/html/rfc1894">RFC 1894</a>, January 1996.

   [<a name="ref-26" id="ref-26">26</a>] Myers, J. and M. Rose, "Post Office Protocol - Version 3", STD
        53, <a href="http://tools.ietf.org/html/rfc1939">RFC 1939</a>, May 1996.




<span class="grey">Klensin                     Standards Track                    [Page 69]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-70" id="page-70" href="#page-70" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   [<a name="ref-27" id="ref-27">27</a>] Partridge, C., "Mail routing and the domain system", <a href="http://tools.ietf.org/html/rfc974">RFC 974</a>,
        January 1986.

   [<a name="ref-28" id="ref-28">28</a>] Partridge, C., "Duplicate messages and SMTP", <a href="http://tools.ietf.org/html/rfc1047">RFC 1047</a>, February
        1988.

   [<a name="ref-29" id="ref-29">29</a>] Postel, J., ed., "Transmission Control Protocol - DARPA Internet
        Program Protocol Specification", STD 7, <a href="http://tools.ietf.org/html/rfc793">RFC 793</a>, September 1981.

   [<a name="ref-30" id="ref-30">30</a>] Postel, J., "Simple Mail Transfer Protocol", <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>, August
        1982.

   [<a name="ref-31" id="ref-31">31</a>] Ramsdell, B., Ed., "S/MIME Version 3 Message Specification", <a href="http://tools.ietf.org/html/rfc2633">RFC</a>
        <a href="http://tools.ietf.org/html/rfc2633">2633</a>, June 1999.

   [<a name="ref-32" id="ref-32">32</a>] Resnick, P., Ed., "Internet Message Format", <a href="http://tools.ietf.org/html/rfc2822">RFC 2822</a>, April
        2001.

   [<a name="ref-33" id="ref-33">33</a>] Vaudreuil, G., "SMTP Service Extensions for Transmission of
        Large and Binary MIME Messages", <a href="http://tools.ietf.org/html/rfc1830">RFC 1830</a>, August 1995.

   [<a name="ref-34" id="ref-34">34</a>] Vaudreuil, G., "Enhanced Mail System Status Codes", <a href="http://tools.ietf.org/html/rfc1893">RFC 1893</a>,
        January 1996.

<span class="h2"><h2><a class="selflink" name="section-10" href="#section-10">10</a>. Editor's Address</h2></span>

   John C. Klensin
   AT&amp;T Laboratories
   99 Bedford St
   Boston, MA 02111 USA

   Phone: 617-574-3076
   EMail: klensin@research.att.com

<span class="h2"><h2><a class="selflink" name="section-11" href="#section-11">11</a>. Acknowledgments</h2></span>

   Many people worked long and hard on the many iterations of this
   document.  There was wide-ranging debate in the IETF DRUMS Working
   Group, both on its mailing list and in face to face discussions,
   about many technical issues and the role of a revised standard for
   Internet mail transport, and many contributors helped form the
   wording in this specification.  The hundreds of participants in the
   many discussions since <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> was produced are too numerous to
   mention, but they all helped this document become what it is.







<span class="grey">Klensin                     Standards Track                    [Page 70]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-71" id="page-71" href="#page-71" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


APPENDICES

<span class="h1"><h1><a class="selflink" name="appendix-A" href="#appendix-A">A</a>. TCP Transport Service</h1></span>

   The TCP connection supports the transmission of 8-bit bytes.  The
   SMTP data is 7-bit ASCII characters.  Each character is transmitted
   as an 8-bit byte with the high-order bit cleared to zero.  Service
   extensions may modify this rule to permit transmission of full 8-bit
   data bytes as part of the message body, but not in SMTP commands or
   responses.

<span class="h1"><h1><a class="selflink" name="appendix-B" href="#appendix-B">B</a>. Generating SMTP Commands from <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> Headers</h1></span>

   Some systems use <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> headers (only) in a mail submission
   protocol, or otherwise generate SMTP commands from <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> headers
   when such a message is handed to an MTA from a UA.  While the MTA-UA
   protocol is a private matter, not covered by any Internet Standard,
   there are problems with this approach.  For example, there have been
   repeated problems with proper handling of "bcc" copies and
   redistribution lists when information that conceptually belongs to a
   mail envelopes is not separated early in processing from header
   information (and kept separate).

   It is recommended that the UA provide its initial ("submission
   client") MTA with an envelope separate from the message itself.
   However, if the envelope is not supplied, SMTP commands SHOULD be
   generated as follows:

   1. Each recipient address from a TO, CC, or BCC header field SHOULD
      be copied to a RCPT command (generating multiple message copies if
      that is required for queuing or delivery).  This includes any
      addresses listed in a <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> "group".  Any BCC fields SHOULD then
      be removed from the headers.  Once this process is completed, the
      remaining headers SHOULD be checked to verify that at least one
      To:, Cc:, or Bcc: header remains.  If none do, then a bcc: header
      with no additional information SHOULD be inserted as specified in
      [<a href="#ref-32" title='"Internet Message Format"'>32</a>].

   2. The return address in the MAIL command SHOULD, if possible, be
      derived from the system's identity for the submitting (local)
      user, and the "From:" header field otherwise.  If there is a
      system identity available, it SHOULD also be copied to the Sender
      header field if it is different from the address in the From
      header field.  (Any Sender field that was already there SHOULD be
      removed.)  Systems may provide a way for submitters to override
      the envelope return address, but may want to restrict its use to
      privileged users.  This will not prevent mail forgery, but may
      lessen its incidence; see <a href="#section-7.1">section 7.1</a>.



<span class="grey">Klensin                     Standards Track                    [Page 71]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-72" id="page-72" href="#page-72" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   When an MTA is being used in this way, it bears responsibility for
   ensuring that the message being transmitted is valid.  The mechanisms
   for checking that validity, and for handling (or returning) messages
   that are not valid at the time of arrival, are part of the MUA-MTA
   interface and not covered by this specification.

   A submission protocol based on Standard <a href="http://tools.ietf.org/html/rfc822">RFC 822</a> information alone
   MUST NOT be used to gateway a message from a foreign (non-SMTP) mail
   system into an SMTP environment.  Additional information to construct
   an envelope must come from some source in the other environment,
   whether supplemental headers or the foreign system's envelope.

   Attempts to gateway messages using only their header "to" and "cc"
   fields have repeatedly caused mail loops and other behavior adverse
   to the proper functioning of the Internet mail environment.  These
   problems have been especially common when the message originates from
   an Internet mailing list and is distributed into the foreign
   environment using envelope information.  When these messages are then
   processed by a header-only remailer, loops back to the Internet
   environment (and the mailing list) are almost inevitable.

<span class="h1"><h1><a class="selflink" name="appendix-C" href="#appendix-C">C</a>. Source Routes</h1></span>

   Historically, the &lt;reverse-path&gt; was a reverse source routing list of
   hosts and a source mailbox.  The first host in the &lt;reverse-path&gt;
   SHOULD be the host sending the MAIL command.  Similarly, the
   &lt;forward-path&gt; may be a source routing lists of hosts and a
   destination mailbox.  However, in general, the &lt;forward-path&gt; SHOULD
   contain only a mailbox and domain name, relying on the domain name
   system to supply routing information if required.  The use of source
   routes is deprecated; while servers MUST be prepared to receive and
   handle them as discussed in <a href="#section-3.3">section 3.3</a> and F.2, clients SHOULD NOT
   transmit them and this section was included only to provide context.

   For relay purposes, the forward-path may be a source route of the
   form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE fully-
   qualified domain names.  This form is used to emphasize the
   distinction between an address and a route.  The mailbox is an
   absolute address, and the route is information about how to get
   there.  The two concepts should not be confused.

   If source routes are used, <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> and the text below should be
   consulted for the mechanisms for constructing and updating the
   forward- and reverse-paths.







<span class="grey">Klensin                     Standards Track                    [Page 72]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-73" id="page-73" href="#page-73" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


   The SMTP server transforms the command arguments by moving its own
   identifier (its domain name or that of any domain for which it is
   acting as a mail exchanger), if it appears, from the forward-path to
   the beginning of the reverse-path.

   Notice that the forward-path and reverse-path appear in the SMTP
   commands and replies, but not necessarily in the message.  That is,
   there is no need for these paths and especially this syntax to appear
   in the "To:" , "From:", "CC:", etc. fields of the message header.
   Conversely, SMTP servers MUST NOT derive final message delivery
   information from message header fields.

   When the list of hosts is present, it is a "reverse" source route and
   indicates that the mail was relayed through each host on the list
   (the first host in the list was the most recent relay).  This list is
   used as a source route to return non-delivery notices to the sender.
   As each relay host adds itself to the beginning of the list, it MUST
   use its name as known in the transport environment to which it is
   relaying the mail rather than that of the transport environment from
   which the mail came (if they are different).

<span class="h1"><h1><a class="selflink" name="appendix-D" href="#appendix-D">D</a>. Scenarios</h1></span>

   This section presents complete scenarios of several types of SMTP
   sessions.  In the examples, "C:" indicates what is said by the SMTP
   client, and "S:" indicates what is said by the SMTP server.

<span class="h1"><h1><a class="selflink" name="appendix-D.1" href="#appendix-D.1">D.1</a> A Typical SMTP Transaction Scenario</h1></span>

   This SMTP example shows mail sent by Smith at host bar.com, to Jones,
   Green, and Brown at host foo.com.  Here we assume that host bar.com
   contacts host foo.com directly.  The mail is accepted for Jones and
   Brown.  Green does not have a mailbox at host foo.com.

      S: 220 foo.com Simple Mail Transfer Service Ready
      C: EHLO bar.com
      S: 250-foo.com greets bar.com
      S: 250-8BITMIME
      S: 250-SIZE
      S: 250-DSN
      S: 250 HELP
      C: MAIL FROM:&lt;Smith@bar.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Jones@foo.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Green@foo.com&gt;
      S: 550 No such user here
      C: RCPT TO:&lt;Brown@foo.com&gt;



<span class="grey">Klensin                     Standards Track                    [Page 73]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-74" id="page-74" href="#page-74" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      S: 250 OK
      C: DATA
      S: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
      C: Blah blah blah...
      C: ...etc. etc. etc.
      C: .
      S: 250 OK
      C: QUIT
      S: 221 foo.com Service closing transmission channel

<span class="h1"><h1><a class="selflink" name="appendix-D.2" href="#appendix-D.2">D.2</a> Aborted SMTP Transaction Scenario</h1></span>

      S: 220 foo.com Simple Mail Transfer Service Ready
      C: EHLO bar.com
      S: 250-foo.com greets bar.com
      S: 250-8BITMIME
      S: 250-SIZE
      S: 250-DSN
      S: 250 HELP
      C: MAIL FROM:&lt;Smith@bar.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Jones@foo.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Green@foo.com&gt;
      S: 550 No such user here
      C: RSET
      S: 250 OK
      C: QUIT
      S: 221 foo.com Service closing transmission channel

<span class="h1"><h1><a class="selflink" name="appendix-D.3" href="#appendix-D.3">D.3</a> Relayed Mail Scenario</h1></span>

   Step 1  --  Source Host to Relay Host

      S: 220 foo.com Simple Mail Transfer Service Ready
      C: EHLO bar.com
      S: 250-foo.com greets bar.com
      S: 250-8BITMIME
      S: 250-SIZE
      S: 250-DSN
      S: 250 HELP
      C: MAIL FROM:&lt;JQP@bar.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;@foo.com:Jones@XYZ.COM&gt;
      S: 250 OK
      C: DATA
      S: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
      C: Date: Thu, 21 May 1998 05:33:29 -0700



<span class="grey">Klensin                     Standards Track                    [Page 74]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-75" id="page-75" href="#page-75" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      C: From: John Q. Public &lt;JQP@bar.com&gt;
      C: Subject:  The Next Meeting of the Board
      C: To: Jones@xyz.com
      C:
      C: Bill:
      C: The next meeting of the board of directors will be
      C: on Tuesday.
      C:                         John.
      C: .
      S: 250 OK
      C: QUIT
      S: 221 foo.com Service closing transmission channel

   Step 2  --  Relay Host to Destination Host

      S: 220 xyz.com Simple Mail Transfer Service Ready
      C: EHLO foo.com
      S: 250 xyz.com is on the air
      C: MAIL FROM:&lt;@foo.com:JQP@bar.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Jones@XYZ.COM&gt;
      S: 250 OK
      C: DATA
      S: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
      C: Received: from bar.com by foo.com ; Thu, 21 May 1998
      C:     05:33:29 -0700
      C: Date: Thu, 21 May 1998 05:33:22 -0700
      C: From: John Q. Public &lt;JQP@bar.com&gt;
      C: Subject:  The Next Meeting of the Board
      C: To: Jones@xyz.com
      C:
      C: Bill:
      C: The next meeting of the board of directors will be
      C: on Tuesday.
      C:                         John.
      C: .
      S: 250 OK
      C: QUIT
      S: 221 foo.com Service closing transmission channel

<span class="h1"><h1><a class="selflink" name="appendix-D.4" href="#appendix-D.4">D.4</a> Verifying and Sending Scenario</h1></span>

      S: 220 foo.com Simple Mail Transfer Service Ready
      C: EHLO bar.com
      S: 250-foo.com greets bar.com
      S: 250-8BITMIME
      S: 250-SIZE
      S: 250-DSN



<span class="grey">Klensin                     Standards Track                    [Page 75]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-76" id="page-76" href="#page-76" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


      S: 250-VRFY
      S: 250 HELP
      C: VRFY Crispin
      S: 250 Mark Crispin &lt;Admin.MRC@foo.com&gt;
      C: SEND FROM:&lt;EAK@bar.com&gt;
      S: 250 OK
      C: RCPT TO:&lt;Admin.MRC@foo.com&gt;
      S: 250 OK
      C: DATA
      S: 354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;
      C: Blah blah blah...
      C: ...etc. etc. etc.
      C: .
      S: 250 OK
      C: QUIT
      S: 221 foo.com Service closing transmission channel

<span class="h1"><h1><a class="selflink" name="appendix-E" href="#appendix-E">E</a>. Other Gateway Issues</h1></span>

   In general, gateways between the Internet and other mail systems
   SHOULD attempt to preserve any layering semantics across the
   boundaries between the two mail systems involved.  Gateway-
   translation approaches that attempt to take shortcuts by mapping,
   (such as envelope information from one system to the message headers
   or body of another) have generally proven to be inadequate in
   important ways.  Systems translating between environments that do not
   support both envelopes and headers and Internet mail must be written
   with the understanding that some information loss is almost
   inevitable.

<span class="h1"><h1><a class="selflink" name="appendix-F" href="#appendix-F">F</a>. Deprecated Features of <a href="http://tools.ietf.org/html/rfc821">RFC 821</a></h1></span>

   A few features of <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> have proven to be problematic and SHOULD
   NOT be used in Internet mail.

<span class="h1"><h1><a class="selflink" name="appendix-F.1" href="#appendix-F.1">F.1</a> TURN</h1></span>

   This command, described in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a>, raises important security issues
   since, in the absence of strong authentication of the host requesting
   that the client and server switch roles, it can easily be used to
   divert mail from its correct destination.  Its use is deprecated;
   SMTP systems SHOULD NOT use it unless the server can authenticate the
   client.








<span class="grey">Klensin                     Standards Track                    [Page 76]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-77" id="page-77" href="#page-77" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h1"><h1><a class="selflink" name="appendix-F.2" href="#appendix-F.2">F.2</a> Source Routing</h1></span>

   <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> utilized the concept of explicit source routing to get mail
   from one host to another via a series of relays.  The requirement to
   utilize source routes in regular mail traffic was eliminated by the
   introduction of the domain name system "MX" record and the last
   significant justification for them was eliminated by the
   introduction, in <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a>, of a clear requirement that addresses
   following an "@" must all be fully-qualified domain names.
   Consequently, the only remaining justifications for the use of source
   routes are support for very old SMTP clients or MUAs and in mail
   system debugging.  They can, however, still be useful in the latter
   circumstance and for routing mail around serious, but temporary,
   problems such as problems with the relevant DNS records.

   SMTP servers MUST continue to accept source route syntax as specified
   in the main body of this document and in <a href="http://tools.ietf.org/html/rfc1123">RFC 1123</a>.  They MAY, if
   necessary, ignore the routes and utilize only the target domain in
   the address.  If they do utilize the source route, the message MUST
   be sent to the first domain shown in the address.  In particular, a
   server MUST NOT guess at shortcuts within the source route.

   Clients SHOULD NOT utilize explicit source routing except under
   unusual circumstances, such as debugging or potentially relaying
   around firewall or mail system configuration errors.

<span class="h1"><h1><a class="selflink" name="appendix-F.3" href="#appendix-F.3">F.3</a> HELO</h1></span>

   As discussed in sections <a href="#section-3.1">3.1</a> and <a href="#section-4.1.1">4.1.1</a>, EHLO is strongly preferred to
   HELO when the server will accept the former.  Servers must continue
   to accept and process HELO in order to support older clients.

<span class="h1"><h1><a class="selflink" name="appendix-F.4" href="#appendix-F.4">F.4</a> #-literals</h1></span>

   <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> provided for specifying an Internet address as a decimal
   integer host number prefixed by a pound sign, "#".  In practice, that
   form has been obsolete since the introduction of TCP/IP.  It is
   deprecated and MUST NOT be used.

<span class="h1"><h1><a class="selflink" name="appendix-F.5" href="#appendix-F.5">F.5</a> Dates and Years</h1></span>

   When dates are inserted into messages by SMTP clients or servers
   (e.g., in trace fields), four-digit years MUST BE used.  Two-digit
   years are deprecated; three-digit years were never permitted in the
   Internet mail system.






<span class="grey">Klensin                     Standards Track                    [Page 77]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-78" id="page-78" href="#page-78" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


<span class="h1"><h1><a class="selflink" name="appendix-F.6" href="#appendix-F.6">F.6</a> Sending versus Mailing</h1></span>

   In addition to specifying a mechanism for delivering messages to
   user's mailboxes, <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> provided additional, optional, commands to
   deliver messages directly to the user's terminal screen.  These
   commands (SEND, SAML, SOML) were rarely implemented, and changes in
   workstation technology and the introduction of other protocols may
   have rendered them obsolete even where they are implemented.

   Clients SHOULD NOT provide SEND, SAML, or SOML as services.  Servers
   MAY implement them.  If they are implemented by servers, the
   implementation model specified in <a href="http://tools.ietf.org/html/rfc821">RFC 821</a> MUST be used and the
   command names MUST be published in the response to the EHLO command.






































<span class="grey">Klensin                     Standards Track                    [Page 78]</span>
</pre><!--NewPage--><pre class="newpage"><a name="page-79" id="page-79" href="#page-79" class="invisible"> </a>
<span class="grey"><a href="#">RFC 2821</a>             Simple Mail Transfer Protocol            April 2001</span>


Full Copyright Statement

   Copyright (C) The Internet Society (2001).  All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works.  However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.



















Klensin                     Standards Track                    [Page 79]

</pre><br>
<span class="noprint"><small><small>Html markup produced by rfcmarkup 1.109, available from
<a href="https://tools.ietf.org/tools/rfcmarkup/">https://tools.ietf.org/tools/rfcmarkup/</a>
</small></small></span>

</body></html>