Simple Mail Transfer Protocol
Simple Mail Transfer Protocol
Simple Mail Transfer Protocol (SMTP) is an $nternet standard for e(ectronic mai( (e6 mai() transmission across $nternet Protoco( ($P) net3or5s7 SMTP 3as first defined in R#! 809 (STD 9:) (9;80)<9=, and (ast updated 1> R#! :?09 (0@@8)<0= 3hich inc(udes the e2tended SMTP (-SMTP) additions, and is the protoco( in 3idespread use toda>7 SMTP is specified for outgoing mai( transport and uses T!P port 0:7 Ahi(e e(ectronic mai( servers and other mai( transfer agents use SMTP to send and receive mai( messages, user6(eve( c(ient mai( app(ications t>pica((> on(> use SMTP for sending messages to a mai( server for re(a>ing7 #or receiving messages, c(ient app(ications usua((> use either the Post 'ffice Protoco( (P'P) or the $nternet Message %ccess Protoco( ($M%P) or a proprietar> s>stem (such as Microsoft -2change or &otus "otes)Domino) to access their mai( 1o2 accounts on a mai( server7
Contents
<hide=
9 istor> 0 Mai( processing mode( ? Protoco( overvie3 o ?79 Remote Message Bueue Starting o ?70 'n6Demand Mai( Re(a> o ?7? $nternationa(iCation . 'utgoing mai( SMTP server : SMTP transport e2amp(e / 'ptiona( e2tensions D Securit> and spamming 8 $mp(ementations ; Re(ated ReEuests #or !omments 9@ See a(so 99 References 90 #urther reading 9? -2terna( (in5s
edit! "istory
,arious forms of one6to6one e(ectronic messaging 3ere used in the 9;/@s7 Peop(e communicated 3ith one another using s>stems deve(oped for specific mainframe computers7 %s more computers 3ere interconnected, especia((> in the +S GovernmentFs %RP%"-T, standards 3ere deve(oped to a((o3 users using different s>stems to 1e a1(e to e6mai( one another7 SMTP gre3 out of these standards deve(oped during the 9;D@s7 SMTP can trace its roots to t3o imp(ementations descri1ed in 9;D9, the Mai( Bo2 Protoco(, 3hich has 1een disputed to actua((> have 1een imp(emented,<?= 1ut is discussed in R#! 9;/ and other R#!s, and the S"DMSG program, 3hich, according to R#! 00?:, Ra> Tom(inson of BB" GinventsG for T-"-* computers the sending of mai( across the %RP%"-T7<.=<:=</= #e3er than :@ hosts 3ere connected to the %RP%"-T at this time7<D= #urther imp(ementations inc(ude #TP Mai( <8= and Mai( Protoco(, 1oth from 9;D?7<;= Deve(opment 3or5 continued throughout the 9;D@s, unti( the %RP%"-T converted into the modern $nternet around 9;8@7 Jon Poste( then proposed a Mai( Transfer Protoco( in 9;8@ that 1egan to remove the mai(Fs re(iance on #TP7<9@= SMTP 3as pu1(ished as R#! 809 in %ugust 9;80, a(so 1> Poste(7 The SMTP standard 3as deve(oped around the same time as +senet, a one6to6man> communication net3or5 3ith some simi(arities7 SMTP 1ecame 3ide(> used in the ear(> 9;8@s7 %t the time, it 3as a comp(ement to +ni2 to +ni2 !op> Program (++!P) mai(, 3hich 3as 1etter suited to hand(e e6mai( transfers 1et3een machines that 3ere intermittent(> connected7 SMTP, on the other hand, 3or5s
1est 3hen 1oth the sending and receiving machines are connected to the net3or5 a(( the time7 Both use a store and for3ard mechanism and are e2amp(es of push techno(og>7 Though +senetFs ne3sgroups are sti(( propagated 3ith ++!P 1et3een servers,<99= ++!P mai( has virtua((> disappeared<90= a(ong 3ith the G1ang pathsG it used as message routing headers7 The artic(e a1out sender re3riting contains technica( 1ac5ground info a1out the ear(> SMTP histor> and source routing 1efore R#! 990?7 Sendmai( 3as one of the first (if not the first) mai( transfer agents to imp(ement SMTP7 <citation needed= Some other popu(ar SMTP server programs inc(ude Postfi2, Emai(, "ove(( GroupAise, -2im, "ove(( "etMai(, Microsoft -2change Server, Sun Java S>stem Messaging Server7 Message su1mission (R#! 0.D/) and SMTP6%+T (R#! 0::.) 3ere introduced in 9;;8 and 9;;;, 1oth descri1ing ne3 trends in e6mai( de(iver>7 'rigina((>, SMTP servers 3ere t>pica((> interna( to an organiCation, receiving mai( for the organiCation from the outside, and re(a>ing messages from the organiCation to the outside7 But as time 3ent on, SMTP servers (Mai( transfer agents), in practice, 3ere e2panding their ro(es to 1ecome message su1mission agents for Mai( user agents, some of 3hich 3ere no3 re(a>ing mai( from the outside of an organiCation7 (e7g7 a compan> e2ecutive 3ishes to send e6mai( 3hi(e on a trip using the corporate SMTP server7) This issue, a conseEuence of the rapid e2pansion and popu(arit> of the Aor(d Aide Ae1, meant that the SMTP protoco( had to inc(ude specific ru(es and methods for re(a>ing mai( and authenticating users to prevent a1uses such as re(a>ing of unso(icited e6mai( (spam)7 %s this protoco( started out pure(> %S!$$ te2t61ased, it did not dea( 3e(( 3ith 1inar> fi(es7 Standards such as Mu(tipurpose $nternet Mai( -2tensions (M$M-) 3ere deve(oped to encode 1inar> fi(es for transfer through SMTP7 Mai( transfer agents (MT%s) deve(oped after Sendmai( a(so tended to 1e imp(emented 861it6c(ean, so that the a(ternate GHust send eightG strateg> cou(d 1e used to transmit ar1itrar> te2t data (in an> 861it %S!$$6(i5e character encoding) via SMTP7 861it6c(ean MT%s toda> tend to support the 8B$TM$Me2tension, permitting 1inar> fi(es to 1e transmitted a(most as easi(> as p(ain te2t7 Man> peop(e contri1uted to the core SMTP specifications, among them Jon Poste(, -ric %((man, Dave !roc5er, "ed #reed, Randa(( Ge((ens, John I(ensin, and Ieith Moore7
-6mai( is su1mitted from a mai( c(ient (M+%, message user agent) to a mai( server (MS%, message su1mission agent) using SMTP usua((>7 #rom there, the MS% de(ivers the mai( to an MT%, often running on the same machine7 % message ma> 1e direct(> su1mitted to an MT%: T!P port :8D is t>pica((> used for su1mission to MS%s (thence to MT%s), 3hi(e T!P port 0: must 1e used for transferring to MT%s7 The MT% (oo5s up the destinationFs mai( e2changer record (M* record) in the Domain name s>stem (D"S), and re(a>s the mai( to a server on record for that domain via T!P port 0: and SMTP7 (The artic(e on M* record discusses man> factors in determining 3hich server the sending MT% connects to7) 'nce the receiving MT% accepts the incoming message, it is de(ivered via a mai( de(iver> agent (MD%) to a server 3hich is designated for (oca( mai( de(iver>7 The MD% either de(ivers the mai( direct(> to storage, or for3ards it over a net3or5 using either SMTP or the &oca( Mai( Transfer Protoco( (&MTP), a derivative of -SMTP designed for this purpose7 'nce de(ivered to the (oca( mai( server, the mai( is stored for 1atch retrieva( 1> authenticated mai( c(ients (M+%s)7 Mai( is retrieved 1> end6user app(ications, ca((ed emai( c(ients, using $nternet Message %ccess Protoco( ($M%P), a protoco( that 1oth faci(itates access to mai( and manages stored mai(, or the Post 'ffice Protoco( (P'P) 3hich t>pica((> uses the traditiona( m1o2 mai( fi(e format or a proprietar> s>stem such as Microsoft -2change)'ut(oo5 or &otus "otes)Domino7 Ae1mai( c(ients ma> use either method, 1ut the retrieva( protoco( is often not a forma( standard7 Some (oca( mai( servers and M+%s are capa1(e of either push or pu(( mai( retrieva(7 SMTP defines message transport, not the message content7 Thus, it defines the mai( envelope and its parameters, such as the enve(ope sender, 1ut not the header or the 1od> of the message itse(f7 STD 9@ and R#! :?09 define SMTP (the enve(ope), 3hi(e STD 99 and R#! :?00 define the message (header and 1od>), forma((> referred to as the $nternet Message #ormat7
are t>pica((> end6user app(ications and send a(( messages through a smart relay server, often ca((ed the outgoing mail server, 3hich is specified in the programsF configuration7 % mai( transfer agent, incorporated either in the e6mai( c(ient direct(> or in the re(a> server, t>pica((> determines the destination SMTP server 1> Euer>ing the Domain "ame S>stem for the mai( e2changer (M* record) of each recipientFs domain name7 !onformant MT%s fa(( 1ac5 to a simp(e address (oo5up (% record) of the domain name 3hen no mai( e2changer is avai(a1(e7 $n some cases an SMTP c(ient, even a server, ma> a(so 1e configured to use a smart host for de(iver>7 The SMTP c(ient t>pica((> initiates a Transmission !ontro( Protoco( (T!P) connection to the SMTP server on the 3e((65no3n port designated for SMTP, port num1er 0:7 SMTP is a de(iver> protoco( on(>7 $t cannot pull messages from a remote server on demand7 'ther protoco(s, such as the Post 'ffice Protoco( (P'P) and the $nternet Message %ccess Protoco( ($M%P) are specifica((> designed for retrieving messages and managing mai( 1o2es7 o3ever, the SMTP protoco( has a feature to initiate mai( Eueue processing on a remote server so that the reEuesting s>stem ma> receive an> messages destined for it (cf7 Remote Message Bueue Starting)7 P'P and $M%P are preferred protoco(s 3hen a userFs persona( computer is on(> intermittent(> po3ered up, or $nternet connectivit> is on(> transient and hosts cannot receive message during off6(ine periods7
edit! Internationali+ation
R#! :??/ descri1es internationa(iCation features for SMTP, the +T#8SMTP e2tension, 3hich provides support for mu(ti61>te and non6%S!$$ characters in emai( addresses, such as Pe(KL(ive7com (simp(e diacritic), MNOPQRLSTUVMWPXQT7MNOPQR, and YYLYY7YY7
of a net3or5, is no (onger a (imiting factor for e6mai( su1mission or de(iver>7 Modern SMTP servers t>pica((> use a c(ientFs credentia(s (authentication) rather than a c(ientFs (ocation ($P address), to determine 3hether it is e(igi1(e to re(a> e6mai(7 Server administrators choose 3hether c(ients use T!P port 0: (SMTP) or port :8D (Su1mission), as forma(iCed in R#! ..@;, for re(a>ing out1ound mai( to a mai( server7 The specifications and man> servers support 1oth7 %(though some servers support port ./: for (egac> secure SMTP in vio(ation of the specifications, it is prefera1(e to use standard ports and standard -SMTP commands<9:= according to R#! ?0@D if a secure session needs to 1e used 1et3een the c(ient and the server7 Some servers are set up to reHect a(( re(a>ing on port 0:, 1ut va(id users authenticating on port :8D are a((o3ed to re(a> mai( to an> va(id address7 % server that re(a>s a(( e6mai( for all destinations for all c(ients connecting to port 0: is 5no3n as an open re(a> and is no3 genera((> considered a 1ad practice 3orth> of 1(ac5(isting7 Some $nternet service providers intercept port 0:, so that it is not possi1(e for their users to send mai( via a re(a>ing SMTP server outside the $SPFs net3or5 using port 0:Z the> are restricted to using the $SPFs SMTP server7 Some independent SMTP servers support an additiona( port other than 0: to a((o3 users 3ith authenticated access to connect to them even if port 0: is 1(oc5ed7 The practica( purpose of this is that a mo1i(e user connecting to different $SPs other3ise has to change SMTP server settings on the mai( c(ient for each $SPZ using a re(a>ing SMTP server a((o3s the SMTP c(ient settings to 1e used unchanged 3or(d3ide7
C: RCPT TO:(t-e)oss*example.com+ S: 2!0 O, C: .&T& S: /!0 E1$ $ata 2it- (CR+(L'+.(CR+(L'+ C: 'rom: 34o) Example3 ()o)*example.or + C: To: &lice Example (alice*example.com+ C: Cc: t-e)oss*example.com C: .ate: T%e" 5! 6a1 2007 58:02:0/ 90!00 C: S%):ect: Test messa e C: C: Hello &lice. C: T-is is a test messa e 2it- ! -ea$er fiel$s a1$ 0 li1es i1 t-e messa e )o$y. C: ;o%r frie1$" C: 4o) C: . S: 2!0 O,: <%e%e$ as 52/0! C: =U#T S: 225 4ye >T-e ser?er closes t-e co11ectio1@
The c(ient notifies the receiver of the originating e6mai( address of the message in a M&#L 'ROM command7 $n this e2amp(e, the emai( message is sent to t3o mai(1o2es on the same SMTP server: one each for each recipient (isted in the To and Cc header fie(ds7 The corresponding SMTP command is RCPT TO7 -ach successfu( reception and e2ecution of a command is ac5no3(edged 1> the server 3ith a resu(t code and response message (e7g7, 0:@ '5)7 The transmission of the 1od> of the mai( message is initiated 3ith a .&T& command after 3hich it is transmitted ver1atim (ine 1> (ine and is terminated 3ith a characteristic seEuence of a ne3 (ine ([!R\[&#\) 3ith Hust a sing(e fu(( stop (period) fo((o3ed 1> another (ine indication ([!R\[&#\)7 The =U#T command ends the session7 $f the second recipient 3ere (ocated e(se3here, the c(ient 3ou(d =U#T and connect to the appropriate SMTP server after the first message had 1een Eueued7 The information that the c(ient sends in the HELO and M&#L 'ROM commands are added (not seen in e2amp(e code) as additiona( header fie(ds to the message 1> the receiving server7 $t adds a Recei?e$ and Ret%r19Pat- header fie(d, respective(>7
transfer e2cessive(>6siCed messages that 3i(( 1e reHected after consuming net3or5 resources, inc(uding connect time to net3or5 (in5s that is paid 1> the minute7 +sers can manua((> determine in advance the ma2imum siCe accepted 1> -SMTP servers7 The c(ient rep(aces the HELO command 3ith the EHLO command7
S: C: S: S: S: S: 220 smtp2.example.com ESMTP Postfix EHLO )o).example.or 2!09smtp2.example.com Hello )o).example.or 2!09S#AE 50870080 2!09P#PEL#N#NE 2!0 HELP
B5C2.0.2.205D
Thus smtp2.example.com dec(ares that it 3i(( accept a fi2ed ma2imum message siCe no (arger than 9.,/8@,@/. octets (861it 1>tes)7 Depending on the serverFs actua( resource usage, it ma> 1e current(> una1(e to accept a message this (arge7 $n the simp(est case, an -SMTP server 3i(( dec(are a ma2imum S$]- 3ith on(> the - &' user interaction7
source authentication that is f(e2i1(e, (ight3eight, and sca(a1(e7 Recent $nternet -ngineering Tas5 #orce ($-T#) activities inc(ude M%R$D (0@@.) (eading to t3o approved $-T# e2periments in 0@@:, and DomainIe>s $dentified Mai( in 0@@/7
edit! Implementations
Main artic(e: &ist of mai( servers
R#! 990? ^ ReEuirements for $nternet osts_%pp(ication and Support (STD ?) R#! 98D@ ^ SMTP Service -2tension for Message SiCe Dec(aration (`1so(etes: R#! 9/:?) R#! 0:@: ^ %nti6Spam Recommendations for SMTP MT%s (B!P ?@) R#! 0;0@ ^ SMTP Service -2tension for !ommand Pipe(ining (STD /@) R#! ?@?@ ^ SMTP Service -2tensions for Transmission of &arge and Binar> M$M- Messages R#! ?0@D ^ SMTP Service -2tension for Secure SMTP over Transport &a>er Securit> (o1so(etes R#! 0.8D) R#! ?./9 ^ SMTP Service -2tension for De(iver> Status "otifications (o1so(etes R#! 98;9) R#! ?./0 ^ The Mu(tipart)Report !ontent T>pe for the Reporting of Mai( S>stem %dministrative Messages (o1so(etes R#! 98;0) R#! ?./? ^ -nhanced Status !odes for SMTP (o1so(etes R#! 98;? ) R#! ?./. ^ %n -2tensi1(e Message #ormat for De(iver> Status "otifications (o1so(etes R#! 98;.) R#! ?8?. ^ Recommendations for %utomatic Responses to -(ectronic Mai( R#! ..@; ^ Message Su1mission for Mai( (o1so(etes R#! 0.D/) R#! .;:0 ^ 'vervie3 and #rame3or5 for $nternationa(iCed -6mai( R#! .;:. ^ SMTP Service -2tension for %uthentication (o1so(etes R#! 0::.) R#! :@/8 ^ -6mai( Su1mission 'perations: %ccess and %ccounta1i(it> ReEuirements (B!P 9?.) R#! :?09 ^ The Simp(e Mai( Transfer Protoco( (o1so(etes R#! 809 a5a STD 9@, R#! ;D., R#! 98/;, R#! 0809) R#! :?00 ^ $nternet Message #ormat (o1so(etes R#! 800 a5a STD 99, and R#! 0800) R#! :??/ 6 SMTP -2tension for $nternationa(iCed -mai( %ddresses (updates R#! 0809, R#! 0800, and R#! .;:0) R#! ::@. 6 Do3ngrading Mechanism for -mai( %ddress $nternationa(iCation