rfc3501.IMAP4rev1.txt 222 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051
  1. Network Working Group M. Crispin
  2. Request for Comments: 3501 University of Washington
  3. Obsoletes: 2060 March 2003
  4. Category: Standards Track
  5. INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
  6. Status of this Memo
  7. This document specifies an Internet standards track protocol for the
  8. Internet community, and requests discussion and suggestions for
  9. improvements. Please refer to the current edition of the "Internet
  10. Official Protocol Standards" (STD 1) for the standardization state
  11. and status of this protocol. Distribution of this memo is unlimited.
  12. Copyright Notice
  13. Copyright (C) The Internet Society (2003). All Rights Reserved.
  14. Abstract
  15. The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1)
  16. allows a client to access and manipulate electronic mail messages on
  17. a server. IMAP4rev1 permits manipulation of mailboxes (remote
  18. message folders) in a way that is functionally equivalent to local
  19. folders. IMAP4rev1 also provides the capability for an offline
  20. client to resynchronize with the server.
  21. IMAP4rev1 includes operations for creating, deleting, and renaming
  22. mailboxes, checking for new messages, permanently removing messages,
  23. setting and clearing flags, RFC 2822 and RFC 2045 parsing, searching,
  24. and selective fetching of message attributes, texts, and portions
  25. thereof. Messages in IMAP4rev1 are accessed by the use of numbers.
  26. These numbers are either message sequence numbers or unique
  27. identifiers.
  28. IMAP4rev1 supports a single server. A mechanism for accessing
  29. configuration information to support multiple IMAP4rev1 servers is
  30. discussed in RFC 2244.
  31. IMAP4rev1 does not specify a means of posting mail; this function is
  32. handled by a mail transfer protocol such as RFC 2821.
  33. Crispin Standards Track [Page 1]
  34. RFC 3501 IMAPv4 March 2003
  35. Table of Contents
  36. IMAP4rev1 Protocol Specification ................................ 4
  37. 1. How to Read This Document ............................... 4
  38. 1.1. Organization of This Document ........................... 4
  39. 1.2. Conventions Used in This Document ....................... 4
  40. 1.3. Special Notes to Implementors ........................... 5
  41. 2. Protocol Overview ....................................... 6
  42. 2.1. Link Level .............................................. 6
  43. 2.2. Commands and Responses .................................. 6
  44. 2.2.1. Client Protocol Sender and Server Protocol Receiver ..... 6
  45. 2.2.2. Server Protocol Sender and Client Protocol Receiver ..... 7
  46. 2.3. Message Attributes ...................................... 8
  47. 2.3.1. Message Numbers ......................................... 8
  48. 2.3.1.1. Unique Identifier (UID) Message Attribute ....... 8
  49. 2.3.1.2. Message Sequence Number Message Attribute ....... 10
  50. 2.3.2. Flags Message Attribute ................................. 11
  51. 2.3.3. Internal Date Message Attribute ......................... 12
  52. 2.3.4. [RFC-2822] Size Message Attribute ....................... 12
  53. 2.3.5. Envelope Structure Message Attribute .................... 12
  54. 2.3.6. Body Structure Message Attribute ........................ 12
  55. 2.4. Message Texts ........................................... 13
  56. 3. State and Flow Diagram .................................. 13
  57. 3.1. Not Authenticated State ................................. 13
  58. 3.2. Authenticated State ..................................... 13
  59. 3.3. Selected State .......................................... 13
  60. 3.4. Logout State ............................................ 14
  61. 4. Data Formats ............................................ 16
  62. 4.1. Atom .................................................... 16
  63. 4.2. Number .................................................. 16
  64. 4.3. String .................................................. 16
  65. 4.3.1. 8-bit and Binary Strings ................................ 17
  66. 4.4. Parenthesized List ...................................... 17
  67. 4.5. NIL ..................................................... 17
  68. 5. Operational Considerations .............................. 18
  69. 5.1. Mailbox Naming .......................................... 18
  70. 5.1.1. Mailbox Hierarchy Naming ................................ 19
  71. 5.1.2. Mailbox Namespace Naming Convention ..................... 19
  72. 5.1.3. Mailbox International Naming Convention ................. 19
  73. 5.2. Mailbox Size and Message Status Updates ................. 21
  74. 5.3. Response when no Command in Progress .................... 21
  75. 5.4. Autologout Timer ........................................ 22
  76. 5.5. Multiple Commands in Progress ........................... 22
  77. 6. Client Commands ........................................ 23
  78. 6.1. Client Commands - Any State ............................ 24
  79. 6.1.1. CAPABILITY Command ..................................... 24
  80. 6.1.2. NOOP Command ........................................... 25
  81. 6.1.3. LOGOUT Command ......................................... 26
  82. Crispin Standards Track [Page 2]
  83. RFC 3501 IMAPv4 March 2003
  84. 6.2. Client Commands - Not Authenticated State .............. 26
  85. 6.2.1. STARTTLS Command ....................................... 27
  86. 6.2.2. AUTHENTICATE Command ................................... 28
  87. 6.2.3. LOGIN Command .......................................... 30
  88. 6.3. Client Commands - Authenticated State .................. 31
  89. 6.3.1. SELECT Command ......................................... 32
  90. 6.3.2. EXAMINE Command ........................................ 34
  91. 6.3.3. CREATE Command ......................................... 34
  92. 6.3.4. DELETE Command ......................................... 35
  93. 6.3.5. RENAME Command ......................................... 37
  94. 6.3.6. SUBSCRIBE Command ...................................... 39
  95. 6.3.7. UNSUBSCRIBE Command .................................... 39
  96. 6.3.8. LIST Command ........................................... 40
  97. 6.3.9. LSUB Command ........................................... 43
  98. 6.3.10. STATUS Command ......................................... 44
  99. 6.3.11. APPEND Command ......................................... 46
  100. 6.4. Client Commands - Selected State ....................... 47
  101. 6.4.1. CHECK Command .......................................... 47
  102. 6.4.2. CLOSE Command .......................................... 48
  103. 6.4.3. EXPUNGE Command ........................................ 49
  104. 6.4.4. SEARCH Command ......................................... 49
  105. 6.4.5. FETCH Command .......................................... 54
  106. 6.4.6. STORE Command .......................................... 58
  107. 6.4.7. COPY Command ........................................... 59
  108. 6.4.8. UID Command ............................................ 60
  109. 6.5. Client Commands - Experimental/Expansion ............... 62
  110. 6.5.1. X<atom> Command ........................................ 62
  111. 7. Server Responses ....................................... 62
  112. 7.1. Server Responses - Status Responses .................... 63
  113. 7.1.1. OK Response ............................................ 65
  114. 7.1.2. NO Response ............................................ 66
  115. 7.1.3. BAD Response ........................................... 66
  116. 7.1.4. PREAUTH Response ....................................... 67
  117. 7.1.5. BYE Response ........................................... 67
  118. 7.2. Server Responses - Server and Mailbox Status ........... 68
  119. 7.2.1. CAPABILITY Response .................................... 68
  120. 7.2.2. LIST Response .......................................... 69
  121. 7.2.3. LSUB Response .......................................... 70
  122. 7.2.4 STATUS Response ........................................ 70
  123. 7.2.5. SEARCH Response ........................................ 71
  124. 7.2.6. FLAGS Response ......................................... 71
  125. 7.3. Server Responses - Mailbox Size ........................ 71
  126. 7.3.1. EXISTS Response ........................................ 71
  127. 7.3.2. RECENT Response ........................................ 72
  128. 7.4. Server Responses - Message Status ...................... 72
  129. 7.4.1. EXPUNGE Response ....................................... 72
  130. 7.4.2. FETCH Response ......................................... 73
  131. 7.5. Server Responses - Command Continuation Request ........ 79
  132. Crispin Standards Track [Page 3]
  133. RFC 3501 IMAPv4 March 2003
  134. 8. Sample IMAP4rev1 connection ............................ 80
  135. 9. Formal Syntax .......................................... 81
  136. 10. Author's Note .......................................... 92
  137. 11. Security Considerations ................................ 92
  138. 11.1. STARTTLS Security Considerations ....................... 92
  139. 11.2. Other Security Considerations .......................... 93
  140. 12. IANA Considerations .................................... 94
  141. Appendices ..................................................... 95
  142. A. References ............................................. 95
  143. B. Changes from RFC 2060 .................................. 97
  144. C. Key Word Index ......................................... 103
  145. Author's Address ............................................... 107
  146. Full Copyright Statement ....................................... 108
  147. IMAP4rev1 Protocol Specification
  148. 1. How to Read This Document
  149. 1.1. Organization of This Document
  150. This document is written from the point of view of the implementor of
  151. an IMAP4rev1 client or server. Beyond the protocol overview in
  152. section 2, it is not optimized for someone trying to understand the
  153. operation of the protocol. The material in sections 3 through 5
  154. provides the general context and definitions with which IMAP4rev1
  155. operates.
  156. Sections 6, 7, and 9 describe the IMAP commands, responses, and
  157. syntax, respectively. The relationships among these are such that it
  158. is almost impossible to understand any of them separately. In
  159. particular, do not attempt to deduce command syntax from the command
  160. section alone; instead refer to the Formal Syntax section.
  161. 1.2. Conventions Used in This Document
  162. "Conventions" are basic principles or procedures. Document
  163. conventions are noted in this section.
  164. In examples, "C:" and "S:" indicate lines sent by the client and
  165. server respectively.
  166. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  167. "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in this document are to
  168. be interpreted as described in [KEYWORDS].
  169. The word "can" (not "may") is used to refer to a possible
  170. circumstance or situation, as opposed to an optional facility of the
  171. protocol.
  172. Crispin Standards Track [Page 4]
  173. RFC 3501 IMAPv4 March 2003
  174. "User" is used to refer to a human user, whereas "client" refers to
  175. the software being run by the user.
  176. "Connection" refers to the entire sequence of client/server
  177. interaction from the initial establishment of the network connection
  178. until its termination.
  179. "Session" refers to the sequence of client/server interaction from
  180. the time that a mailbox is selected (SELECT or EXAMINE command) until
  181. the time that selection ends (SELECT or EXAMINE of another mailbox,
  182. CLOSE command, or connection termination).
  183. Characters are 7-bit US-ASCII unless otherwise specified. Other
  184. character sets are indicated using a "CHARSET", as described in
  185. [MIME-IMT] and defined in [CHARSET]. CHARSETs have important
  186. additional semantics in addition to defining character set; refer to
  187. these documents for more detail.
  188. There are several protocol conventions in IMAP. These refer to
  189. aspects of the specification which are not strictly part of the IMAP
  190. protocol, but reflect generally-accepted practice. Implementations
  191. need to be aware of these conventions, and avoid conflicts whether or
  192. not they implement the convention. For example, "&" may not be used
  193. as a hierarchy delimiter since it conflicts with the Mailbox
  194. International Naming Convention, and other uses of "&" in mailbox
  195. names are impacted as well.
  196. 1.3. Special Notes to Implementors
  197. Implementors of the IMAP protocol are strongly encouraged to read the
  198. IMAP implementation recommendations document [IMAP-IMPLEMENTATION] in
  199. conjunction with this document, to help understand the intricacies of
  200. this protocol and how best to build an interoperable product.
  201. IMAP4rev1 is designed to be upwards compatible from the [IMAP2] and
  202. unpublished IMAP2bis protocols. IMAP4rev1 is largely compatible with
  203. the IMAP4 protocol described in RFC 1730; the exception being in
  204. certain facilities added in RFC 1730 that proved problematic and were
  205. subsequently removed. In the course of the evolution of IMAP4rev1,
  206. some aspects in the earlier protocols have become obsolete. Obsolete
  207. commands, responses, and data formats which an IMAP4rev1
  208. implementation can encounter when used with an earlier implementation
  209. are described in [IMAP-OBSOLETE].
  210. Other compatibility issues with IMAP2bis, the most common variant of
  211. the earlier protocol, are discussed in [IMAP-COMPAT]. A full
  212. discussion of compatibility issues with rare (and presumed extinct)
  213. Crispin Standards Track [Page 5]
  214. RFC 3501 IMAPv4 March 2003
  215. variants of [IMAP2] is in [IMAP-HISTORICAL]; this document is
  216. primarily of historical interest.
  217. IMAP was originally developed for the older [RFC-822] standard, and
  218. as a consequence several fetch items in IMAP incorporate "RFC822" in
  219. their name. With the exception of RFC822.SIZE, there are more modern
  220. replacements; for example, the modern version of RFC822.HEADER is
  221. BODY.PEEK[HEADER]. In all cases, "RFC822" should be interpreted as a
  222. reference to the updated [RFC-2822] standard.
  223. 2. Protocol Overview
  224. 2.1. Link Level
  225. The IMAP4rev1 protocol assumes a reliable data stream such as that
  226. provided by TCP. When TCP is used, an IMAP4rev1 server listens on
  227. port 143.
  228. 2.2. Commands and Responses
  229. An IMAP4rev1 connection consists of the establishment of a
  230. client/server network connection, an initial greeting from the
  231. server, and client/server interactions. These client/server
  232. interactions consist of a client command, server data, and a server
  233. completion result response.
  234. All interactions transmitted by client and server are in the form of
  235. lines, that is, strings that end with a CRLF. The protocol receiver
  236. of an IMAP4rev1 client or server is either reading a line, or is
  237. reading a sequence of octets with a known count followed by a line.
  238. 2.2.1. Client Protocol Sender and Server Protocol Receiver
  239. The client command begins an operation. Each client command is
  240. prefixed with an identifier (typically a short alphanumeric string,
  241. e.g., A0001, A0002, etc.) called a "tag". A different tag is
  242. generated by the client for each command.
  243. Clients MUST follow the syntax outlined in this specification
  244. strictly. It is a syntax error to send a command with missing or
  245. extraneous spaces or arguments.
  246. There are two cases in which a line from the client does not
  247. represent a complete command. In one case, a command argument is
  248. quoted with an octet count (see the description of literal in String
  249. under Data Formats); in the other case, the command arguments require
  250. server feedback (see the AUTHENTICATE command). In either case, the
  251. Crispin Standards Track [Page 6]
  252. RFC 3501 IMAPv4 March 2003
  253. server sends a command continuation request response if it is ready
  254. for the octets (if appropriate) and the remainder of the command.
  255. This response is prefixed with the token "+".
  256. Note: If instead, the server detected an error in the
  257. command, it sends a BAD completion response with a tag
  258. matching the command (as described below) to reject the
  259. command and prevent the client from sending any more of the
  260. command.
  261. It is also possible for the server to send a completion
  262. response for some other command (if multiple commands are
  263. in progress), or untagged data. In either case, the
  264. command continuation request is still pending; the client
  265. takes the appropriate action for the response, and reads
  266. another response from the server. In all cases, the client
  267. MUST send a complete command (including receiving all
  268. command continuation request responses and command
  269. continuations for the command) before initiating a new
  270. command.
  271. The protocol receiver of an IMAP4rev1 server reads a command line
  272. from the client, parses the command and its arguments, and transmits
  273. server data and a server command completion result response.
  274. 2.2.2. Server Protocol Sender and Client Protocol Receiver
  275. Data transmitted by the server to the client and status responses
  276. that do not indicate command completion are prefixed with the token
  277. "*", and are called untagged responses.
  278. Server data MAY be sent as a result of a client command, or MAY be
  279. sent unilaterally by the server. There is no syntactic difference
  280. between server data that resulted from a specific command and server
  281. data that were sent unilaterally.
  282. The server completion result response indicates the success or
  283. failure of the operation. It is tagged with the same tag as the
  284. client command which began the operation. Thus, if more than one
  285. command is in progress, the tag in a server completion response
  286. identifies the command to which the response applies. There are
  287. three possible server completion responses: OK (indicating success),
  288. NO (indicating failure), or BAD (indicating a protocol error such as
  289. unrecognized command or command syntax error).
  290. Servers SHOULD enforce the syntax outlined in this specification
  291. strictly. Any client command with a protocol syntax error, including
  292. (but not limited to) missing or extraneous spaces or arguments,
  293. Crispin Standards Track [Page 7]
  294. RFC 3501 IMAPv4 March 2003
  295. SHOULD be rejected, and the client given a BAD server completion
  296. response.
  297. The protocol receiver of an IMAP4rev1 client reads a response line
  298. from the server. It then takes action on the response based upon the
  299. first token of the response, which can be a tag, a "*", or a "+".
  300. A client MUST be prepared to accept any server response at all times.
  301. This includes server data that was not requested. Server data SHOULD
  302. be recorded, so that the client can reference its recorded copy
  303. rather than sending a command to the server to request the data. In
  304. the case of certain server data, the data MUST be recorded.
  305. This topic is discussed in greater detail in the Server Responses
  306. section.
  307. 2.3. Message Attributes
  308. In addition to message text, each message has several attributes
  309. associated with it. These attributes can be retrieved individually
  310. or in conjunction with other attributes or message texts.
  311. 2.3.1. Message Numbers
  312. Messages in IMAP4rev1 are accessed by one of two numbers; the unique
  313. identifier or the message sequence number.
  314. 2.3.1.1. Unique Identifier (UID) Message Attribute
  315. A 32-bit value assigned to each message, which when used with the
  316. unique identifier validity value (see below) forms a 64-bit value
  317. that MUST NOT refer to any other message in the mailbox or any
  318. subsequent mailbox with the same name forever. Unique identifiers
  319. are assigned in a strictly ascending fashion in the mailbox; as each
  320. message is added to the mailbox it is assigned a higher UID than the
  321. message(s) which were added previously. Unlike message sequence
  322. numbers, unique identifiers are not necessarily contiguous.
  323. The unique identifier of a message MUST NOT change during the
  324. session, and SHOULD NOT change between sessions. Any change of
  325. unique identifiers between sessions MUST be detectable using the
  326. UIDVALIDITY mechanism discussed below. Persistent unique identifiers
  327. are required for a client to resynchronize its state from a previous
  328. session with the server (e.g., disconnected or offline access
  329. clients); this is discussed further in [IMAP-DISC].
  330. Crispin Standards Track [Page 8]
  331. RFC 3501 IMAPv4 March 2003
  332. Associated with every mailbox are two values which aid in unique
  333. identifier handling: the next unique identifier value and the unique
  334. identifier validity value.
  335. The next unique identifier value is the predicted value that will be
  336. assigned to a new message in the mailbox. Unless the unique
  337. identifier validity also changes (see below), the next unique
  338. identifier value MUST have the following two characteristics. First,
  339. the next unique identifier value MUST NOT change unless new messages
  340. are added to the mailbox; and second, the next unique identifier
  341. value MUST change whenever new messages are added to the mailbox,
  342. even if those new messages are subsequently expunged.
  343. Note: The next unique identifier value is intended to
  344. provide a means for a client to determine whether any
  345. messages have been delivered to the mailbox since the
  346. previous time it checked this value. It is not intended to
  347. provide any guarantee that any message will have this
  348. unique identifier. A client can only assume, at the time
  349. that it obtains the next unique identifier value, that
  350. messages arriving after that time will have a UID greater
  351. than or equal to that value.
  352. The unique identifier validity value is sent in a UIDVALIDITY
  353. response code in an OK untagged response at mailbox selection time.
  354. If unique identifiers from an earlier session fail to persist in this
  355. session, the unique identifier validity value MUST be greater than
  356. the one used in the earlier session.
  357. Note: Ideally, unique identifiers SHOULD persist at all
  358. times. Although this specification recognizes that failure
  359. to persist can be unavoidable in certain server
  360. environments, it STRONGLY ENCOURAGES message store
  361. implementation techniques that avoid this problem. For
  362. example:
  363. 1) Unique identifiers MUST be strictly ascending in the
  364. mailbox at all times. If the physical message store is
  365. re-ordered by a non-IMAP agent, this requires that the
  366. unique identifiers in the mailbox be regenerated, since
  367. the former unique identifiers are no longer strictly
  368. ascending as a result of the re-ordering.
  369. 2) If the message store has no mechanism to store unique
  370. identifiers, it must regenerate unique identifiers at
  371. each session, and each session must have a unique
  372. UIDVALIDITY value.
  373. Crispin Standards Track [Page 9]
  374. RFC 3501 IMAPv4 March 2003
  375. 3) If the mailbox is deleted and a new mailbox with the
  376. same name is created at a later date, the server must
  377. either keep track of unique identifiers from the
  378. previous instance of the mailbox, or it must assign a
  379. new UIDVALIDITY value to the new instance of the
  380. mailbox. A good UIDVALIDITY value to use in this case
  381. is a 32-bit representation of the creation date/time of
  382. the mailbox. It is alright to use a constant such as
  383. 1, but only if it guaranteed that unique identifiers
  384. will never be reused, even in the case of a mailbox
  385. being deleted (or renamed) and a new mailbox by the
  386. same name created at some future time.
  387. 4) The combination of mailbox name, UIDVALIDITY, and UID
  388. must refer to a single immutable message on that server
  389. forever. In particular, the internal date, [RFC-2822]
  390. size, envelope, body structure, and message texts
  391. (RFC822, RFC822.HEADER, RFC822.TEXT, and all BODY[...]
  392. fetch data items) must never change. This does not
  393. include message numbers, nor does it include attributes
  394. that can be set by a STORE command (e.g., FLAGS).
  395. 2.3.1.2. Message Sequence Number Message Attribute
  396. A relative position from 1 to the number of messages in the mailbox.
  397. This position MUST be ordered by ascending unique identifier. As
  398. each new message is added, it is assigned a message sequence number
  399. that is 1 higher than the number of messages in the mailbox before
  400. that new message was added.
  401. Message sequence numbers can be reassigned during the session. For
  402. example, when a message is permanently removed (expunged) from the
  403. mailbox, the message sequence number for all subsequent messages is
  404. decremented. The number of messages in the mailbox is also
  405. decremented. Similarly, a new message can be assigned a message
  406. sequence number that was once held by some other message prior to an
  407. expunge.
  408. In addition to accessing messages by relative position in the
  409. mailbox, message sequence numbers can be used in mathematical
  410. calculations. For example, if an untagged "11 EXISTS" is received,
  411. and previously an untagged "8 EXISTS" was received, three new
  412. messages have arrived with message sequence numbers of 9, 10, and 11.
  413. Another example, if message 287 in a 523 message mailbox has UID
  414. 12345, there are exactly 286 messages which have lesser UIDs and 236
  415. messages which have greater UIDs.
  416. Crispin Standards Track [Page 10]
  417. RFC 3501 IMAPv4 March 2003
  418. 2.3.2. Flags Message Attribute
  419. A list of zero or more named tokens associated with the message. A
  420. flag is set by its addition to this list, and is cleared by its
  421. removal. There are two types of flags in IMAP4rev1. A flag of
  422. either type can be permanent or session-only.
  423. A system flag is a flag name that is pre-defined in this
  424. specification. All system flags begin with "\". Certain system
  425. flags (\Deleted and \Seen) have special semantics described
  426. elsewhere. The currently-defined system flags are:
  427. \Seen
  428. Message has been read
  429. \Answered
  430. Message has been answered
  431. \Flagged
  432. Message is "flagged" for urgent/special attention
  433. \Deleted
  434. Message is "deleted" for removal by later EXPUNGE
  435. \Draft
  436. Message has not completed composition (marked as a draft).
  437. \Recent
  438. Message is "recently" arrived in this mailbox. This session
  439. is the first session to have been notified about this
  440. message; if the session is read-write, subsequent sessions
  441. will not see \Recent set for this message. This flag can not
  442. be altered by the client.
  443. If it is not possible to determine whether or not this
  444. session is the first session to be notified about a message,
  445. then that message SHOULD be considered recent.
  446. If multiple connections have the same mailbox selected
  447. simultaneously, it is undefined which of these connections
  448. will see newly-arrived messages with \Recent set and which
  449. will see it without \Recent set.
  450. A keyword is defined by the server implementation. Keywords do not
  451. begin with "\". Servers MAY permit the client to define new keywords
  452. in the mailbox (see the description of the PERMANENTFLAGS response
  453. code for more information).
  454. Crispin Standards Track [Page 11]
  455. RFC 3501 IMAPv4 March 2003
  456. A flag can be permanent or session-only on a per-flag basis.
  457. Permanent flags are those which the client can add or remove from the
  458. message flags permanently; that is, concurrent and subsequent
  459. sessions will see any change in permanent flags. Changes to session
  460. flags are valid only in that session.
  461. Note: The \Recent system flag is a special case of a
  462. session flag. \Recent can not be used as an argument in a
  463. STORE or APPEND command, and thus can not be changed at
  464. all.
  465. 2.3.3. Internal Date Message Attribute
  466. The internal date and time of the message on the server. This
  467. is not the date and time in the [RFC-2822] header, but rather a
  468. date and time which reflects when the message was received. In
  469. the case of messages delivered via [SMTP], this SHOULD be the
  470. date and time of final delivery of the message as defined by
  471. [SMTP]. In the case of messages delivered by the IMAP4rev1 COPY
  472. command, this SHOULD be the internal date and time of the source
  473. message. In the case of messages delivered by the IMAP4rev1
  474. APPEND command, this SHOULD be the date and time as specified in
  475. the APPEND command description. All other cases are
  476. implementation defined.
  477. 2.3.4. [RFC-2822] Size Message Attribute
  478. The number of octets in the message, as expressed in [RFC-2822]
  479. format.
  480. 2.3.5. Envelope Structure Message Attribute
  481. A parsed representation of the [RFC-2822] header of the message.
  482. Note that the IMAP Envelope structure is not the same as an
  483. [SMTP] envelope.
  484. 2.3.6. Body Structure Message Attribute
  485. A parsed representation of the [MIME-IMB] body structure
  486. information of the message.
  487. Crispin Standards Track [Page 12]
  488. RFC 3501 IMAPv4 March 2003
  489. 2.4. Message Texts
  490. In addition to being able to fetch the full [RFC-2822] text of a
  491. message, IMAP4rev1 permits the fetching of portions of the full
  492. message text. Specifically, it is possible to fetch the
  493. [RFC-2822] message header, [RFC-2822] message body, a [MIME-IMB]
  494. body part, or a [MIME-IMB] header.
  495. 3. State and Flow Diagram
  496. Once the connection between client and server is established, an
  497. IMAP4rev1 connection is in one of four states. The initial
  498. state is identified in the server greeting. Most commands are
  499. only valid in certain states. It is a protocol error for the
  500. client to attempt a command while the connection is in an
  501. inappropriate state, and the server will respond with a BAD or
  502. NO (depending upon server implementation) command completion
  503. result.
  504. 3.1. Not Authenticated State
  505. In the not authenticated state, the client MUST supply
  506. authentication credentials before most commands will be
  507. permitted. This state is entered when a connection starts
  508. unless the connection has been pre-authenticated.
  509. 3.2. Authenticated State
  510. In the authenticated state, the client is authenticated and MUST
  511. select a mailbox to access before commands that affect messages
  512. will be permitted. This state is entered when a
  513. pre-authenticated connection starts, when acceptable
  514. authentication credentials have been provided, after an error in
  515. selecting a mailbox, or after a successful CLOSE command.
  516. 3.3. Selected State
  517. In a selected state, a mailbox has been selected to access.
  518. This state is entered when a mailbox has been successfully
  519. selected.
  520. Crispin Standards Track [Page 13]
  521. RFC 3501 IMAPv4 March 2003
  522. 3.4. Logout State
  523. In the logout state, the connection is being terminated. This
  524. state can be entered as a result of a client request (via the
  525. LOGOUT command) or by unilateral action on the part of either
  526. the client or server.
  527. If the client requests the logout state, the server MUST send an
  528. untagged BYE response and a tagged OK response to the LOGOUT
  529. command before the server closes the connection; and the client
  530. MUST read the tagged OK response to the LOGOUT command before
  531. the client closes the connection.
  532. A server MUST NOT unilaterally close the connection without
  533. sending an untagged BYE response that contains the reason for
  534. having done so. A client SHOULD NOT unilaterally close the
  535. connection, and instead SHOULD issue a LOGOUT command. If the
  536. server detects that the client has unilaterally closed the
  537. connection, the server MAY omit the untagged BYE response and
  538. simply close its connection.
  539. Crispin Standards Track [Page 14]
  540. RFC 3501 IMAPv4 March 2003
  541. +----------------------+
  542. |connection established|
  543. +----------------------+
  544. ||
  545. \/
  546. +--------------------------------------+
  547. | server greeting |
  548. +--------------------------------------+
  549. || (1) || (2) || (3)
  550. \/ || ||
  551. +-----------------+ || ||
  552. |Not Authenticated| || ||
  553. +-----------------+ || ||
  554. || (7) || (4) || ||
  555. || \/ \/ ||
  556. || +----------------+ ||
  557. || | Authenticated |<=++ ||
  558. || +----------------+ || ||
  559. || || (7) || (5) || (6) ||
  560. || || \/ || ||
  561. || || +--------+ || ||
  562. || || |Selected|==++ ||
  563. || || +--------+ ||
  564. || || || (7) ||
  565. \/ \/ \/ \/
  566. +--------------------------------------+
  567. | Logout |
  568. +--------------------------------------+
  569. ||
  570. \/
  571. +-------------------------------+
  572. |both sides close the connection|
  573. +-------------------------------+
  574. (1) connection without pre-authentication (OK greeting)
  575. (2) pre-authenticated connection (PREAUTH greeting)
  576. (3) rejected connection (BYE greeting)
  577. (4) successful LOGIN or AUTHENTICATE command
  578. (5) successful SELECT or EXAMINE command
  579. (6) CLOSE command, or failed SELECT or EXAMINE command
  580. (7) LOGOUT command, server shutdown, or connection closed
  581. Crispin Standards Track [Page 15]
  582. RFC 3501 IMAPv4 March 2003
  583. 4. Data Formats
  584. IMAP4rev1 uses textual commands and responses. Data in
  585. IMAP4rev1 can be in one of several forms: atom, number, string,
  586. parenthesized list, or NIL. Note that a particular data item
  587. may take more than one form; for example, a data item defined as
  588. using "astring" syntax may be either an atom or a string.
  589. 4.1. Atom
  590. An atom consists of one or more non-special characters.
  591. 4.2. Number
  592. A number consists of one or more digit characters, and
  593. represents a numeric value.
  594. 4.3. String
  595. A string is in one of two forms: either literal or quoted
  596. string. The literal form is the general form of string. The
  597. quoted string form is an alternative that avoids the overhead of
  598. processing a literal at the cost of limitations of characters
  599. which may be used.
  600. A literal is a sequence of zero or more octets (including CR and
  601. LF), prefix-quoted with an octet count in the form of an open
  602. brace ("{"), the number of octets, close brace ("}"), and CRLF.
  603. In the case of literals transmitted from server to client, the
  604. CRLF is immediately followed by the octet data. In the case of
  605. literals transmitted from client to server, the client MUST wait
  606. to receive a command continuation request (described later in
  607. this document) before sending the octet data (and the remainder
  608. of the command).
  609. A quoted string is a sequence of zero or more 7-bit characters,
  610. excluding CR and LF, with double quote (<">) characters at each
  611. end.
  612. The empty string is represented as either "" (a quoted string
  613. with zero characters between double quotes) or as {0} followed
  614. by CRLF (a literal with an octet count of 0).
  615. Note: Even if the octet count is 0, a client transmitting a
  616. literal MUST wait to receive a command continuation request.
  617. Crispin Standards Track [Page 16]
  618. RFC 3501 IMAPv4 March 2003
  619. 4.3.1. 8-bit and Binary Strings
  620. 8-bit textual and binary mail is supported through the use of a
  621. [MIME-IMB] content transfer encoding. IMAP4rev1 implementations MAY
  622. transmit 8-bit or multi-octet characters in literals, but SHOULD do
  623. so only when the [CHARSET] is identified.
  624. Although a BINARY body encoding is defined, unencoded binary strings
  625. are not permitted. A "binary string" is any string with NUL
  626. characters. Implementations MUST encode binary data into a textual
  627. form, such as BASE64, before transmitting the data. A string with an
  628. excessive amount of CTL characters MAY also be considered to be
  629. binary.
  630. 4.4. Parenthesized List
  631. Data structures are represented as a "parenthesized list"; a sequence
  632. of data items, delimited by space, and bounded at each end by
  633. parentheses. A parenthesized list can contain other parenthesized
  634. lists, using multiple levels of parentheses to indicate nesting.
  635. The empty list is represented as () -- a parenthesized list with no
  636. members.
  637. 4.5. NIL
  638. The special form "NIL" represents the non-existence of a particular
  639. data item that is represented as a string or parenthesized list, as
  640. distinct from the empty string "" or the empty parenthesized list ().
  641. Note: NIL is never used for any data item which takes the
  642. form of an atom. For example, a mailbox name of "NIL" is a
  643. mailbox named NIL as opposed to a non-existent mailbox
  644. name. This is because mailbox uses "astring" syntax which
  645. is an atom or a string. Conversely, an addr-name of NIL is
  646. a non-existent personal name, because addr-name uses
  647. "nstring" syntax which is NIL or a string, but never an
  648. atom.
  649. Crispin Standards Track [Page 17]
  650. RFC 3501 IMAPv4 March 2003
  651. 5. Operational Considerations
  652. The following rules are listed here to ensure that all IMAP4rev1
  653. implementations interoperate properly.
  654. 5.1. Mailbox Naming
  655. Mailbox names are 7-bit. Client implementations MUST NOT attempt to
  656. create 8-bit mailbox names, and SHOULD interpret any 8-bit mailbox
  657. names returned by LIST or LSUB as UTF-8. Server implementations
  658. SHOULD prohibit the creation of 8-bit mailbox names, and SHOULD NOT
  659. return 8-bit mailbox names in LIST or LSUB. See section 5.1.3 for
  660. more information on how to represent non-ASCII mailbox names.
  661. Note: 8-bit mailbox names were undefined in earlier
  662. versions of this protocol. Some sites used a local 8-bit
  663. character set to represent non-ASCII mailbox names. Such
  664. usage is not interoperable, and is now formally deprecated.
  665. The case-insensitive mailbox name INBOX is a special name reserved to
  666. mean "the primary mailbox for this user on this server". The
  667. interpretation of all other names is implementation-dependent.
  668. In particular, this specification takes no position on case
  669. sensitivity in non-INBOX mailbox names. Some server implementations
  670. are fully case-sensitive; others preserve case of a newly-created
  671. name but otherwise are case-insensitive; and yet others coerce names
  672. to a particular case. Client implementations MUST interact with any
  673. of these. If a server implementation interprets non-INBOX mailbox
  674. names as case-insensitive, it MUST treat names using the
  675. international naming convention specially as described in section
  676. 5.1.3.
  677. There are certain client considerations when creating a new mailbox
  678. name:
  679. 1) Any character which is one of the atom-specials (see the Formal
  680. Syntax) will require that the mailbox name be represented as a
  681. quoted string or literal.
  682. 2) CTL and other non-graphic characters are difficult to represent
  683. in a user interface and are best avoided.
  684. 3) Although the list-wildcard characters ("%" and "*") are valid
  685. in a mailbox name, it is difficult to use such mailbox names
  686. with the LIST and LSUB commands due to the conflict with
  687. wildcard interpretation.
  688. Crispin Standards Track [Page 18]
  689. RFC 3501 IMAPv4 March 2003
  690. 4) Usually, a character (determined by the server implementation)
  691. is reserved to delimit levels of hierarchy.
  692. 5) Two characters, "#" and "&", have meanings by convention, and
  693. should be avoided except when used in that convention.
  694. 5.1.1. Mailbox Hierarchy Naming
  695. If it is desired to export hierarchical mailbox names, mailbox names
  696. MUST be left-to-right hierarchical using a single character to
  697. separate levels of hierarchy. The same hierarchy separator character
  698. is used for all levels of hierarchy within a single name.
  699. 5.1.2. Mailbox Namespace Naming Convention
  700. By convention, the first hierarchical element of any mailbox name
  701. which begins with "#" identifies the "namespace" of the remainder of
  702. the name. This makes it possible to disambiguate between different
  703. types of mailbox stores, each of which have their own namespaces.
  704. For example, implementations which offer access to USENET
  705. newsgroups MAY use the "#news" namespace to partition the
  706. USENET newsgroup namespace from that of other mailboxes.
  707. Thus, the comp.mail.misc newsgroup would have a mailbox
  708. name of "#news.comp.mail.misc", and the name
  709. "comp.mail.misc" can refer to a different object (e.g., a
  710. user's private mailbox).
  711. 5.1.3. Mailbox International Naming Convention
  712. By convention, international mailbox names in IMAP4rev1 are specified
  713. using a modified version of the UTF-7 encoding described in [UTF-7].
  714. Modified UTF-7 may also be usable in servers that implement an
  715. earlier version of this protocol.
  716. In modified UTF-7, printable US-ASCII characters, except for "&",
  717. represent themselves; that is, characters with octet values 0x20-0x25
  718. and 0x27-0x7e. The character "&" (0x26) is represented by the
  719. two-octet sequence "&-".
  720. All other characters (octet values 0x00-0x1f and 0x7f-0xff) are
  721. represented in modified BASE64, with a further modification from
  722. [UTF-7] that "," is used instead of "/". Modified BASE64 MUST NOT be
  723. used to represent any printing US-ASCII character which can represent
  724. itself.
  725. Crispin Standards Track [Page 19]
  726. RFC 3501 IMAPv4 March 2003
  727. "&" is used to shift to modified BASE64 and "-" to shift back to
  728. US-ASCII. There is no implicit shift from BASE64 to US-ASCII, and
  729. null shifts ("-&" while in BASE64; note that "&-" while in US-ASCII
  730. means "&") are not permitted. However, all names start in US-ASCII,
  731. and MUST end in US-ASCII; that is, a name that ends with a non-ASCII
  732. ISO-10646 character MUST end with a "-").
  733. The purpose of these modifications is to correct the following
  734. problems with UTF-7:
  735. 1) UTF-7 uses the "+" character for shifting; this conflicts with
  736. the common use of "+" in mailbox names, in particular USENET
  737. newsgroup names.
  738. 2) UTF-7's encoding is BASE64 which uses the "/" character; this
  739. conflicts with the use of "/" as a popular hierarchy delimiter.
  740. 3) UTF-7 prohibits the unencoded usage of "\"; this conflicts with
  741. the use of "\" as a popular hierarchy delimiter.
  742. 4) UTF-7 prohibits the unencoded usage of "~"; this conflicts with
  743. the use of "~" in some servers as a home directory indicator.
  744. 5) UTF-7 permits multiple alternate forms to represent the same
  745. string; in particular, printable US-ASCII characters can be
  746. represented in encoded form.
  747. Although modified UTF-7 is a convention, it establishes certain
  748. requirements on server handling of any mailbox name with an
  749. embedded "&" character. In particular, server implementations
  750. MUST preserve the exact form of the modified BASE64 portion of a
  751. modified UTF-7 name and treat that text as case-sensitive, even if
  752. names are otherwise case-insensitive or case-folded.
  753. Server implementations SHOULD verify that any mailbox name with an
  754. embedded "&" character, used as an argument to CREATE, is: in the
  755. correctly modified UTF-7 syntax, has no superfluous shifts, and
  756. has no encoding in modified BASE64 of any printing US-ASCII
  757. character which can represent itself. However, client
  758. implementations MUST NOT depend upon the server doing this, and
  759. SHOULD NOT attempt to create a mailbox name with an embedded "&"
  760. character unless it complies with the modified UTF-7 syntax.
  761. Server implementations which export a mail store that does not
  762. follow the modified UTF-7 convention MUST convert to modified
  763. UTF-7 any mailbox name that contains either non-ASCII characters
  764. or the "&" character.
  765. Crispin Standards Track [Page 20]
  766. RFC 3501 IMAPv4 March 2003
  767. For example, here is a mailbox name which mixes English,
  768. Chinese, and Japanese text:
  769. ~peter/mail/&U,BTFw-/&ZeVnLIqe-
  770. For example, the string "&Jjo!" is not a valid mailbox
  771. name because it does not contain a shift to US-ASCII
  772. before the "!". The correct form is "&Jjo-!". The
  773. string "&U,BTFw-&ZeVnLIqe-" is not permitted because it
  774. contains a superfluous shift. The correct form is
  775. "&U,BTF2XlZyyKng-".
  776. 5.2. Mailbox Size and Message Status Updates
  777. At any time, a server can send data that the client did not request.
  778. Sometimes, such behavior is REQUIRED. For example, agents other than
  779. the server MAY add messages to the mailbox (e.g., new message
  780. delivery), change the flags of the messages in the mailbox (e.g.,
  781. simultaneous access to the same mailbox by multiple agents), or even
  782. remove messages from the mailbox. A server MUST send mailbox size
  783. updates automatically if a mailbox size change is observed during the
  784. processing of a command. A server SHOULD send message flag updates
  785. automatically, without requiring the client to request such updates
  786. explicitly.
  787. Special rules exist for server notification of a client about the
  788. removal of messages to prevent synchronization errors; see the
  789. description of the EXPUNGE response for more detail. In particular,
  790. it is NOT permitted to send an EXISTS response that would reduce the
  791. number of messages in the mailbox; only the EXPUNGE response can do
  792. this.
  793. Regardless of what implementation decisions a client makes on
  794. remembering data from the server, a client implementation MUST record
  795. mailbox size updates. It MUST NOT assume that any command after the
  796. initial mailbox selection will return the size of the mailbox.
  797. 5.3. Response when no Command in Progress
  798. Server implementations are permitted to send an untagged response
  799. (except for EXPUNGE) while there is no command in progress. Server
  800. implementations that send such responses MUST deal with flow control
  801. considerations. Specifically, they MUST either (1) verify that the
  802. size of the data does not exceed the underlying transport's available
  803. window size, or (2) use non-blocking writes.
  804. Crispin Standards Track [Page 21]
  805. RFC 3501 IMAPv4 March 2003
  806. 5.4. Autologout Timer
  807. If a server has an inactivity autologout timer, the duration of that
  808. timer MUST be at least 30 minutes. The receipt of ANY command from
  809. the client during that interval SHOULD suffice to reset the
  810. autologout timer.
  811. 5.5. Multiple Commands in Progress
  812. The client MAY send another command without waiting for the
  813. completion result response of a command, subject to ambiguity rules
  814. (see below) and flow control constraints on the underlying data
  815. stream. Similarly, a server MAY begin processing another command
  816. before processing the current command to completion, subject to
  817. ambiguity rules. However, any command continuation request responses
  818. and command continuations MUST be negotiated before any subsequent
  819. command is initiated.
  820. The exception is if an ambiguity would result because of a command
  821. that would affect the results of other commands. Clients MUST NOT
  822. send multiple commands without waiting if an ambiguity would result.
  823. If the server detects a possible ambiguity, it MUST execute commands
  824. to completion in the order given by the client.
  825. The most obvious example of ambiguity is when a command would affect
  826. the results of another command, e.g., a FETCH of a message's flags
  827. and a STORE of that same message's flags.
  828. A non-obvious ambiguity occurs with commands that permit an untagged
  829. EXPUNGE response (commands other than FETCH, STORE, and SEARCH),
  830. since an untagged EXPUNGE response can invalidate sequence numbers in
  831. a subsequent command. This is not a problem for FETCH, STORE, or
  832. SEARCH commands because servers are prohibited from sending EXPUNGE
  833. responses while any of those commands are in progress. Therefore, if
  834. the client sends any command other than FETCH, STORE, or SEARCH, it
  835. MUST wait for the completion result response before sending a command
  836. with message sequence numbers.
  837. Note: UID FETCH, UID STORE, and UID SEARCH are different
  838. commands from FETCH, STORE, and SEARCH. If the client
  839. sends a UID command, it must wait for a completion result
  840. response before sending a command with message sequence
  841. numbers.
  842. Crispin Standards Track [Page 22]
  843. RFC 3501 IMAPv4 March 2003
  844. For example, the following non-waiting command sequences are invalid:
  845. FETCH + NOOP + STORE
  846. STORE + COPY + FETCH
  847. COPY + COPY
  848. CHECK + FETCH
  849. The following are examples of valid non-waiting command sequences:
  850. FETCH + STORE + SEARCH + CHECK
  851. STORE + COPY + EXPUNGE
  852. UID SEARCH + UID SEARCH may be valid or invalid as a non-waiting
  853. command sequence, depending upon whether or not the second UID
  854. SEARCH contains message sequence numbers.
  855. 6. Client Commands
  856. IMAP4rev1 commands are described in this section. Commands are
  857. organized by the state in which the command is permitted. Commands
  858. which are permitted in multiple states are listed in the minimum
  859. permitted state (for example, commands valid in authenticated and
  860. selected state are listed in the authenticated state commands).
  861. Command arguments, identified by "Arguments:" in the command
  862. descriptions below, are described by function, not by syntax. The
  863. precise syntax of command arguments is described in the Formal Syntax
  864. section.
  865. Some commands cause specific server responses to be returned; these
  866. are identified by "Responses:" in the command descriptions below.
  867. See the response descriptions in the Responses section for
  868. information on these responses, and the Formal Syntax section for the
  869. precise syntax of these responses. It is possible for server data to
  870. be transmitted as a result of any command. Thus, commands that do
  871. not specifically require server data specify "no specific responses
  872. for this command" instead of "none".
  873. The "Result:" in the command description refers to the possible
  874. tagged status responses to a command, and any special interpretation
  875. of these status responses.
  876. The state of a connection is only changed by successful commands
  877. which are documented as changing state. A rejected command (BAD
  878. response) never changes the state of the connection or of the
  879. selected mailbox. A failed command (NO response) generally does not
  880. change the state of the connection or of the selected mailbox; the
  881. exception being the SELECT and EXAMINE commands.
  882. Crispin Standards Track [Page 23]
  883. RFC 3501 IMAPv4 March 2003
  884. 6.1. Client Commands - Any State
  885. The following commands are valid in any state: CAPABILITY, NOOP, and
  886. LOGOUT.
  887. 6.1.1. CAPABILITY Command
  888. Arguments: none
  889. Responses: REQUIRED untagged response: CAPABILITY
  890. Result: OK - capability completed
  891. BAD - command unknown or arguments invalid
  892. The CAPABILITY command requests a listing of capabilities that the
  893. server supports. The server MUST send a single untagged
  894. CAPABILITY response with "IMAP4rev1" as one of the listed
  895. capabilities before the (tagged) OK response.
  896. A capability name which begins with "AUTH=" indicates that the
  897. server supports that particular authentication mechanism. All
  898. such names are, by definition, part of this specification. For
  899. example, the authorization capability for an experimental
  900. "blurdybloop" authenticator would be "AUTH=XBLURDYBLOOP" and not
  901. "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP".
  902. Other capability names refer to extensions, revisions, or
  903. amendments to this specification. See the documentation of the
  904. CAPABILITY response for additional information. No capabilities,
  905. beyond the base IMAP4rev1 set defined in this specification, are
  906. enabled without explicit client action to invoke the capability.
  907. Client and server implementations MUST implement the STARTTLS,
  908. LOGINDISABLED, and AUTH=PLAIN (described in [IMAP-TLS])
  909. capabilities. See the Security Considerations section for
  910. important information.
  911. See the section entitled "Client Commands -
  912. Experimental/Expansion" for information about the form of site or
  913. implementation-specific capabilities.
  914. Crispin Standards Track [Page 24]
  915. RFC 3501 IMAPv4 March 2003
  916. Example: C: abcd CAPABILITY
  917. S: * CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI
  918. LOGINDISABLED
  919. S: abcd OK CAPABILITY completed
  920. C: efgh STARTTLS
  921. S: efgh OK STARTLS completed
  922. <TLS negotiation, further commands are under [TLS] layer>
  923. C: ijkl CAPABILITY
  924. S: * CAPABILITY IMAP4rev1 AUTH=GSSAPI AUTH=PLAIN
  925. S: ijkl OK CAPABILITY completed
  926. 6.1.2. NOOP Command
  927. Arguments: none
  928. Responses: no specific responses for this command (but see below)
  929. Result: OK - noop completed
  930. BAD - command unknown or arguments invalid
  931. The NOOP command always succeeds. It does nothing.
  932. Since any command can return a status update as untagged data, the
  933. NOOP command can be used as a periodic poll for new messages or
  934. message status updates during a period of inactivity (this is the
  935. preferred method to do this). The NOOP command can also be used
  936. to reset any inactivity autologout timer on the server.
  937. Example: C: a002 NOOP
  938. S: a002 OK NOOP completed
  939. . . .
  940. C: a047 NOOP
  941. S: * 22 EXPUNGE
  942. S: * 23 EXISTS
  943. S: * 3 RECENT
  944. S: * 14 FETCH (FLAGS (\Seen \Deleted))
  945. S: a047 OK NOOP completed
  946. Crispin Standards Track [Page 25]
  947. RFC 3501 IMAPv4 March 2003
  948. 6.1.3. LOGOUT Command
  949. Arguments: none
  950. Responses: REQUIRED untagged response: BYE
  951. Result: OK - logout completed
  952. BAD - command unknown or arguments invalid
  953. The LOGOUT command informs the server that the client is done with
  954. the connection. The server MUST send a BYE untagged response
  955. before the (tagged) OK response, and then close the network
  956. connection.
  957. Example: C: A023 LOGOUT
  958. S: * BYE IMAP4rev1 Server logging out
  959. S: A023 OK LOGOUT completed
  960. (Server and client then close the connection)
  961. 6.2. Client Commands - Not Authenticated State
  962. In the not authenticated state, the AUTHENTICATE or LOGIN command
  963. establishes authentication and enters the authenticated state. The
  964. AUTHENTICATE command provides a general mechanism for a variety of
  965. authentication techniques, privacy protection, and integrity
  966. checking; whereas the LOGIN command uses a traditional user name and
  967. plaintext password pair and has no means of establishing privacy
  968. protection or integrity checking.
  969. The STARTTLS command is an alternate form of establishing session
  970. privacy protection and integrity checking, but does not establish
  971. authentication or enter the authenticated state.
  972. Server implementations MAY allow access to certain mailboxes without
  973. establishing authentication. This can be done by means of the
  974. ANONYMOUS [SASL] authenticator described in [ANONYMOUS]. An older
  975. convention is a LOGIN command using the userid "anonymous"; in this
  976. case, a password is required although the server may choose to accept
  977. any password. The restrictions placed on anonymous users are
  978. implementation-dependent.
  979. Once authenticated (including as anonymous), it is not possible to
  980. re-enter not authenticated state.
  981. Crispin Standards Track [Page 26]
  982. RFC 3501 IMAPv4 March 2003
  983. In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
  984. the following commands are valid in the not authenticated state:
  985. STARTTLS, AUTHENTICATE and LOGIN. See the Security Considerations
  986. section for important information about these commands.
  987. 6.2.1. STARTTLS Command
  988. Arguments: none
  989. Responses: no specific response for this command
  990. Result: OK - starttls completed, begin TLS negotiation
  991. BAD - command unknown or arguments invalid
  992. A [TLS] negotiation begins immediately after the CRLF at the end
  993. of the tagged OK response from the server. Once a client issues a
  994. STARTTLS command, it MUST NOT issue further commands until a
  995. server response is seen and the [TLS] negotiation is complete.
  996. The server remains in the non-authenticated state, even if client
  997. credentials are supplied during the [TLS] negotiation. This does
  998. not preclude an authentication mechanism such as EXTERNAL (defined
  999. in [SASL]) from using client identity determined by the [TLS]
  1000. negotiation.
  1001. Once [TLS] has been started, the client MUST discard cached
  1002. information about server capabilities and SHOULD re-issue the
  1003. CAPABILITY command. This is necessary to protect against man-in-
  1004. the-middle attacks which alter the capabilities list prior to
  1005. STARTTLS. The server MAY advertise different capabilities after
  1006. STARTTLS.
  1007. Example: C: a001 CAPABILITY
  1008. S: * CAPABILITY IMAP4rev1 STARTTLS LOGINDISABLED
  1009. S: a001 OK CAPABILITY completed
  1010. C: a002 STARTTLS
  1011. S: a002 OK Begin TLS negotiation now
  1012. <TLS negotiation, further commands are under [TLS] layer>
  1013. C: a003 CAPABILITY
  1014. S: * CAPABILITY IMAP4rev1 AUTH=PLAIN
  1015. S: a003 OK CAPABILITY completed
  1016. C: a004 LOGIN joe password
  1017. S: a004 OK LOGIN completed
  1018. Crispin Standards Track [Page 27]
  1019. RFC 3501 IMAPv4 March 2003
  1020. 6.2.2. AUTHENTICATE Command
  1021. Arguments: authentication mechanism name
  1022. Responses: continuation data can be requested
  1023. Result: OK - authenticate completed, now in authenticated state
  1024. NO - authenticate failure: unsupported authentication
  1025. mechanism, credentials rejected
  1026. BAD - command unknown or arguments invalid,
  1027. authentication exchange cancelled
  1028. The AUTHENTICATE command indicates a [SASL] authentication
  1029. mechanism to the server. If the server supports the requested
  1030. authentication mechanism, it performs an authentication protocol
  1031. exchange to authenticate and identify the client. It MAY also
  1032. negotiate an OPTIONAL security layer for subsequent protocol
  1033. interactions. If the requested authentication mechanism is not
  1034. supported, the server SHOULD reject the AUTHENTICATE command by
  1035. sending a tagged NO response.
  1036. The AUTHENTICATE command does not support the optional "initial
  1037. response" feature of [SASL]. Section 5.1 of [SASL] specifies how
  1038. to handle an authentication mechanism which uses an initial
  1039. response.
  1040. The service name specified by this protocol's profile of [SASL] is
  1041. "imap".
  1042. The authentication protocol exchange consists of a series of
  1043. server challenges and client responses that are specific to the
  1044. authentication mechanism. A server challenge consists of a
  1045. command continuation request response with the "+" token followed
  1046. by a BASE64 encoded string. The client response consists of a
  1047. single line consisting of a BASE64 encoded string. If the client
  1048. wishes to cancel an authentication exchange, it issues a line
  1049. consisting of a single "*". If the server receives such a
  1050. response, it MUST reject the AUTHENTICATE command by sending a
  1051. tagged BAD response.
  1052. If a security layer is negotiated through the [SASL]
  1053. authentication exchange, it takes effect immediately following the
  1054. CRLF that concludes the authentication exchange for the client,
  1055. and the CRLF of the tagged OK response for the server.
  1056. While client and server implementations MUST implement the
  1057. AUTHENTICATE command itself, it is not required to implement any
  1058. authentication mechanisms other than the PLAIN mechanism described
  1059. Crispin Standards Track [Page 28]
  1060. RFC 3501 IMAPv4 March 2003
  1061. in [IMAP-TLS]. Also, an authentication mechanism is not required
  1062. to support any security layers.
  1063. Note: a server implementation MUST implement a
  1064. configuration in which it does NOT permit any plaintext
  1065. password mechanisms, unless either the STARTTLS command
  1066. has been negotiated or some other mechanism that
  1067. protects the session from password snooping has been
  1068. provided. Server sites SHOULD NOT use any configuration
  1069. which permits a plaintext password mechanism without
  1070. such a protection mechanism against password snooping.
  1071. Client and server implementations SHOULD implement
  1072. additional [SASL] mechanisms that do not use plaintext
  1073. passwords, such the GSSAPI mechanism described in [SASL]
  1074. and/or the [DIGEST-MD5] mechanism.
  1075. Servers and clients can support multiple authentication
  1076. mechanisms. The server SHOULD list its supported authentication
  1077. mechanisms in the response to the CAPABILITY command so that the
  1078. client knows which authentication mechanisms to use.
  1079. A server MAY include a CAPABILITY response code in the tagged OK
  1080. response of a successful AUTHENTICATE command in order to send
  1081. capabilities automatically. It is unnecessary for a client to
  1082. send a separate CAPABILITY command if it recognizes these
  1083. automatic capabilities. This should only be done if a security
  1084. layer was not negotiated by the AUTHENTICATE command, because the
  1085. tagged OK response as part of an AUTHENTICATE command is not
  1086. protected by encryption/integrity checking. [SASL] requires the
  1087. client to re-issue a CAPABILITY command in this case.
  1088. If an AUTHENTICATE command fails with a NO response, the client
  1089. MAY try another authentication mechanism by issuing another
  1090. AUTHENTICATE command. It MAY also attempt to authenticate by
  1091. using the LOGIN command (see section 6.2.3 for more detail). In
  1092. other words, the client MAY request authentication types in
  1093. decreasing order of preference, with the LOGIN command as a last
  1094. resort.
  1095. The authorization identity passed from the client to the server
  1096. during the authentication exchange is interpreted by the server as
  1097. the user name whose privileges the client is requesting.
  1098. Crispin Standards Track [Page 29]
  1099. RFC 3501 IMAPv4 March 2003
  1100. Example: S: * OK IMAP4rev1 Server
  1101. C: A001 AUTHENTICATE GSSAPI
  1102. S: +
  1103. C: YIIB+wYJKoZIhvcSAQICAQBuggHqMIIB5qADAgEFoQMCAQ6iBw
  1104. MFACAAAACjggEmYYIBIjCCAR6gAwIBBaESGxB1Lndhc2hpbmd0
  1105. b24uZWR1oi0wK6ADAgEDoSQwIhsEaW1hcBsac2hpdmFtcy5jYW
  1106. Mud2FzaGluZ3Rvbi5lZHWjgdMwgdCgAwIBAaEDAgEDooHDBIHA
  1107. cS1GSa5b+fXnPZNmXB9SjL8Ollj2SKyb+3S0iXMljen/jNkpJX
  1108. AleKTz6BQPzj8duz8EtoOuNfKgweViyn/9B9bccy1uuAE2HI0y
  1109. C/PHXNNU9ZrBziJ8Lm0tTNc98kUpjXnHZhsMcz5Mx2GR6dGknb
  1110. I0iaGcRerMUsWOuBmKKKRmVMMdR9T3EZdpqsBd7jZCNMWotjhi
  1111. vd5zovQlFqQ2Wjc2+y46vKP/iXxWIuQJuDiisyXF0Y8+5GTpAL
  1112. pHDc1/pIGmMIGjoAMCAQGigZsEgZg2on5mSuxoDHEA1w9bcW9n
  1113. FdFxDKpdrQhVGVRDIzcCMCTzvUboqb5KjY1NJKJsfjRQiBYBdE
  1114. NKfzK+g5DlV8nrw81uOcP8NOQCLR5XkoMHC0Dr/80ziQzbNqhx
  1115. O6652Npft0LQwJvenwDI13YxpwOdMXzkWZN/XrEqOWp6GCgXTB
  1116. vCyLWLlWnbaUkZdEYbKHBPjd8t/1x5Yg==
  1117. S: + YGgGCSqGSIb3EgECAgIAb1kwV6ADAgEFoQMCAQ+iSzBJoAMC
  1118. AQGiQgRAtHTEuOP2BXb9sBYFR4SJlDZxmg39IxmRBOhXRKdDA0
  1119. uHTCOT9Bq3OsUTXUlk0CsFLoa8j+gvGDlgHuqzWHPSQg==
  1120. C:
  1121. S: + YDMGCSqGSIb3EgECAgIBAAD/////6jcyG4GE3KkTzBeBiVHe
  1122. ceP2CWY0SR0fAQAgAAQEBAQ=
  1123. C: YDMGCSqGSIb3EgECAgIBAAD/////3LQBHXTpFfZgrejpLlLImP
  1124. wkhbfa2QteAQAgAG1yYwE=
  1125. S: A001 OK GSSAPI authentication successful
  1126. Note: The line breaks within server challenges and client
  1127. responses are for editorial clarity and are not in real
  1128. authenticators.
  1129. 6.2.3. LOGIN Command
  1130. Arguments: user name
  1131. password
  1132. Responses: no specific responses for this command
  1133. Result: OK - login completed, now in authenticated state
  1134. NO - login failure: user name or password rejected
  1135. BAD - command unknown or arguments invalid
  1136. The LOGIN command identifies the client to the server and carries
  1137. the plaintext password authenticating this user.
  1138. Crispin Standards Track [Page 30]
  1139. RFC 3501 IMAPv4 March 2003
  1140. A server MAY include a CAPABILITY response code in the tagged OK
  1141. response to a successful LOGIN command in order to send
  1142. capabilities automatically. It is unnecessary for a client to
  1143. send a separate CAPABILITY command if it recognizes these
  1144. automatic capabilities.
  1145. Example: C: a001 LOGIN SMITH SESAME
  1146. S: a001 OK LOGIN completed
  1147. Note: Use of the LOGIN command over an insecure network
  1148. (such as the Internet) is a security risk, because anyone
  1149. monitoring network traffic can obtain plaintext passwords.
  1150. The LOGIN command SHOULD NOT be used except as a last
  1151. resort, and it is recommended that client implementations
  1152. have a means to disable any automatic use of the LOGIN
  1153. command.
  1154. Unless either the STARTTLS command has been negotiated or
  1155. some other mechanism that protects the session from
  1156. password snooping has been provided, a server
  1157. implementation MUST implement a configuration in which it
  1158. advertises the LOGINDISABLED capability and does NOT permit
  1159. the LOGIN command. Server sites SHOULD NOT use any
  1160. configuration which permits the LOGIN command without such
  1161. a protection mechanism against password snooping. A client
  1162. implementation MUST NOT send a LOGIN command if the
  1163. LOGINDISABLED capability is advertised.
  1164. 6.3. Client Commands - Authenticated State
  1165. In the authenticated state, commands that manipulate mailboxes as
  1166. atomic entities are permitted. Of these commands, the SELECT and
  1167. EXAMINE commands will select a mailbox for access and enter the
  1168. selected state.
  1169. In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
  1170. the following commands are valid in the authenticated state: SELECT,
  1171. EXAMINE, CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB,
  1172. STATUS, and APPEND.
  1173. Crispin Standards Track [Page 31]
  1174. RFC 3501 IMAPv4 March 2003
  1175. 6.3.1. SELECT Command
  1176. Arguments: mailbox name
  1177. Responses: REQUIRED untagged responses: FLAGS, EXISTS, RECENT
  1178. REQUIRED OK untagged responses: UNSEEN, PERMANENTFLAGS,
  1179. UIDNEXT, UIDVALIDITY
  1180. Result: OK - select completed, now in selected state
  1181. NO - select failure, now in authenticated state: no
  1182. such mailbox, can't access mailbox
  1183. BAD - command unknown or arguments invalid
  1184. The SELECT command selects a mailbox so that messages in the
  1185. mailbox can be accessed. Before returning an OK to the client,
  1186. the server MUST send the following untagged data to the client.
  1187. Note that earlier versions of this protocol only required the
  1188. FLAGS, EXISTS, and RECENT untagged data; consequently, client
  1189. implementations SHOULD implement default behavior for missing data
  1190. as discussed with the individual item.
  1191. FLAGS Defined flags in the mailbox. See the description
  1192. of the FLAGS response for more detail.
  1193. <n> EXISTS The number of messages in the mailbox. See the
  1194. description of the EXISTS response for more detail.
  1195. <n> RECENT The number of messages with the \Recent flag set.
  1196. See the description of the RECENT response for more
  1197. detail.
  1198. OK [UNSEEN <n>]
  1199. The message sequence number of the first unseen
  1200. message in the mailbox. If this is missing, the
  1201. client can not make any assumptions about the first
  1202. unseen message in the mailbox, and needs to issue a
  1203. SEARCH command if it wants to find it.
  1204. OK [PERMANENTFLAGS (<list of flags>)]
  1205. A list of message flags that the client can change
  1206. permanently. If this is missing, the client should
  1207. assume that all flags can be changed permanently.
  1208. OK [UIDNEXT <n>]
  1209. The next unique identifier value. Refer to section
  1210. 2.3.1.1 for more information. If this is missing,
  1211. the client can not make any assumptions about the
  1212. next unique identifier value.
  1213. Crispin Standards Track [Page 32]
  1214. RFC 3501 IMAPv4 March 2003
  1215. OK [UIDVALIDITY <n>]
  1216. The unique identifier validity value. Refer to
  1217. section 2.3.1.1 for more information. If this is
  1218. missing, the server does not support unique
  1219. identifiers.
  1220. Only one mailbox can be selected at a time in a connection;
  1221. simultaneous access to multiple mailboxes requires multiple
  1222. connections. The SELECT command automatically deselects any
  1223. currently selected mailbox before attempting the new selection.
  1224. Consequently, if a mailbox is selected and a SELECT command that
  1225. fails is attempted, no mailbox is selected.
  1226. If the client is permitted to modify the mailbox, the server
  1227. SHOULD prefix the text of the tagged OK response with the
  1228. "[READ-WRITE]" response code.
  1229. If the client is not permitted to modify the mailbox but is
  1230. permitted read access, the mailbox is selected as read-only, and
  1231. the server MUST prefix the text of the tagged OK response to
  1232. SELECT with the "[READ-ONLY]" response code. Read-only access
  1233. through SELECT differs from the EXAMINE command in that certain
  1234. read-only mailboxes MAY permit the change of permanent state on a
  1235. per-user (as opposed to global) basis. Netnews messages marked in
  1236. a server-based .newsrc file are an example of such per-user
  1237. permanent state that can be modified with read-only mailboxes.
  1238. Example: C: A142 SELECT INBOX
  1239. S: * 172 EXISTS
  1240. S: * 1 RECENT
  1241. S: * OK [UNSEEN 12] Message 12 is first unseen
  1242. S: * OK [UIDVALIDITY 3857529045] UIDs valid
  1243. S: * OK [UIDNEXT 4392] Predicted next UID
  1244. S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  1245. S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited
  1246. S: A142 OK [READ-WRITE] SELECT completed
  1247. Crispin Standards Track [Page 33]
  1248. RFC 3501 IMAPv4 March 2003
  1249. 6.3.2. EXAMINE Command
  1250. Arguments: mailbox name
  1251. Responses: REQUIRED untagged responses: FLAGS, EXISTS, RECENT
  1252. REQUIRED OK untagged responses: UNSEEN, PERMANENTFLAGS,
  1253. UIDNEXT, UIDVALIDITY
  1254. Result: OK - examine completed, now in selected state
  1255. NO - examine failure, now in authenticated state: no
  1256. such mailbox, can't access mailbox
  1257. BAD - command unknown or arguments invalid
  1258. The EXAMINE command is identical to SELECT and returns the same
  1259. output; however, the selected mailbox is identified as read-only.
  1260. No changes to the permanent state of the mailbox, including
  1261. per-user state, are permitted; in particular, EXAMINE MUST NOT
  1262. cause messages to lose the \Recent flag.
  1263. The text of the tagged OK response to the EXAMINE command MUST
  1264. begin with the "[READ-ONLY]" response code.
  1265. Example: C: A932 EXAMINE blurdybloop
  1266. S: * 17 EXISTS
  1267. S: * 2 RECENT
  1268. S: * OK [UNSEEN 8] Message 8 is first unseen
  1269. S: * OK [UIDVALIDITY 3857529045] UIDs valid
  1270. S: * OK [UIDNEXT 4392] Predicted next UID
  1271. S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  1272. S: * OK [PERMANENTFLAGS ()] No permanent flags permitted
  1273. S: A932 OK [READ-ONLY] EXAMINE completed
  1274. 6.3.3. CREATE Command
  1275. Arguments: mailbox name
  1276. Responses: no specific responses for this command
  1277. Result: OK - create completed
  1278. NO - create failure: can't create mailbox with that name
  1279. BAD - command unknown or arguments invalid
  1280. The CREATE command creates a mailbox with the given name. An OK
  1281. response is returned only if a new mailbox with that name has been
  1282. created. It is an error to attempt to create INBOX or a mailbox
  1283. with a name that refers to an extant mailbox. Any error in
  1284. creation will return a tagged NO response.
  1285. Crispin Standards Track [Page 34]
  1286. RFC 3501 IMAPv4 March 2003
  1287. If the mailbox name is suffixed with the server's hierarchy
  1288. separator character (as returned from the server by a LIST
  1289. command), this is a declaration that the client intends to create
  1290. mailbox names under this name in the hierarchy. Server
  1291. implementations that do not require this declaration MUST ignore
  1292. the declaration. In any case, the name created is without the
  1293. trailing hierarchy delimiter.
  1294. If the server's hierarchy separator character appears elsewhere in
  1295. the name, the server SHOULD create any superior hierarchical names
  1296. that are needed for the CREATE command to be successfully
  1297. completed. In other words, an attempt to create "foo/bar/zap" on
  1298. a server in which "/" is the hierarchy separator character SHOULD
  1299. create foo/ and foo/bar/ if they do not already exist.
  1300. If a new mailbox is created with the same name as a mailbox which
  1301. was deleted, its unique identifiers MUST be greater than any
  1302. unique identifiers used in the previous incarnation of the mailbox
  1303. UNLESS the new incarnation has a different unique identifier
  1304. validity value. See the description of the UID command for more
  1305. detail.
  1306. Example: C: A003 CREATE owatagusiam/
  1307. S: A003 OK CREATE completed
  1308. C: A004 CREATE owatagusiam/blurdybloop
  1309. S: A004 OK CREATE completed
  1310. Note: The interpretation of this example depends on whether
  1311. "/" was returned as the hierarchy separator from LIST. If
  1312. "/" is the hierarchy separator, a new level of hierarchy
  1313. named "owatagusiam" with a member called "blurdybloop" is
  1314. created. Otherwise, two mailboxes at the same hierarchy
  1315. level are created.
  1316. 6.3.4. DELETE Command
  1317. Arguments: mailbox name
  1318. Responses: no specific responses for this command
  1319. Result: OK - delete completed
  1320. NO - delete failure: can't delete mailbox with that name
  1321. BAD - command unknown or arguments invalid
  1322. Crispin Standards Track [Page 35]
  1323. RFC 3501 IMAPv4 March 2003
  1324. The DELETE command permanently removes the mailbox with the given
  1325. name. A tagged OK response is returned only if the mailbox has
  1326. been deleted. It is an error to attempt to delete INBOX or a
  1327. mailbox name that does not exist.
  1328. The DELETE command MUST NOT remove inferior hierarchical names.
  1329. For example, if a mailbox "foo" has an inferior "foo.bar"
  1330. (assuming "." is the hierarchy delimiter character), removing
  1331. "foo" MUST NOT remove "foo.bar". It is an error to attempt to
  1332. delete a name that has inferior hierarchical names and also has
  1333. the \Noselect mailbox name attribute (see the description of the
  1334. LIST response for more details).
  1335. It is permitted to delete a name that has inferior hierarchical
  1336. names and does not have the \Noselect mailbox name attribute. In
  1337. this case, all messages in that mailbox are removed, and the name
  1338. will acquire the \Noselect mailbox name attribute.
  1339. The value of the highest-used unique identifier of the deleted
  1340. mailbox MUST be preserved so that a new mailbox created with the
  1341. same name will not reuse the identifiers of the former
  1342. incarnation, UNLESS the new incarnation has a different unique
  1343. identifier validity value. See the description of the UID command
  1344. for more detail.
  1345. Examples: C: A682 LIST "" *
  1346. S: * LIST () "/" blurdybloop
  1347. S: * LIST (\Noselect) "/" foo
  1348. S: * LIST () "/" foo/bar
  1349. S: A682 OK LIST completed
  1350. C: A683 DELETE blurdybloop
  1351. S: A683 OK DELETE completed
  1352. C: A684 DELETE foo
  1353. S: A684 NO Name "foo" has inferior hierarchical names
  1354. C: A685 DELETE foo/bar
  1355. S: A685 OK DELETE Completed
  1356. C: A686 LIST "" *
  1357. S: * LIST (\Noselect) "/" foo
  1358. S: A686 OK LIST completed
  1359. C: A687 DELETE foo
  1360. S: A687 OK DELETE Completed
  1361. Crispin Standards Track [Page 36]
  1362. RFC 3501 IMAPv4 March 2003
  1363. C: A82 LIST "" *
  1364. S: * LIST () "." blurdybloop
  1365. S: * LIST () "." foo
  1366. S: * LIST () "." foo.bar
  1367. S: A82 OK LIST completed
  1368. C: A83 DELETE blurdybloop
  1369. S: A83 OK DELETE completed
  1370. C: A84 DELETE foo
  1371. S: A84 OK DELETE Completed
  1372. C: A85 LIST "" *
  1373. S: * LIST () "." foo.bar
  1374. S: A85 OK LIST completed
  1375. C: A86 LIST "" %
  1376. S: * LIST (\Noselect) "." foo
  1377. S: A86 OK LIST completed
  1378. 6.3.5. RENAME Command
  1379. Arguments: existing mailbox name
  1380. new mailbox name
  1381. Responses: no specific responses for this command
  1382. Result: OK - rename completed
  1383. NO - rename failure: can't rename mailbox with that name,
  1384. can't rename to mailbox with that name
  1385. BAD - command unknown or arguments invalid
  1386. The RENAME command changes the name of a mailbox. A tagged OK
  1387. response is returned only if the mailbox has been renamed. It is
  1388. an error to attempt to rename from a mailbox name that does not
  1389. exist or to a mailbox name that already exists. Any error in
  1390. renaming will return a tagged NO response.
  1391. If the name has inferior hierarchical names, then the inferior
  1392. hierarchical names MUST also be renamed. For example, a rename of
  1393. "foo" to "zap" will rename "foo/bar" (assuming "/" is the
  1394. hierarchy delimiter character) to "zap/bar".
  1395. If the server's hierarchy separator character appears in the name,
  1396. the server SHOULD create any superior hierarchical names that are
  1397. needed for the RENAME command to complete successfully. In other
  1398. words, an attempt to rename "foo/bar/zap" to baz/rag/zowie on a
  1399. server in which "/" is the hierarchy separator character SHOULD
  1400. create baz/ and baz/rag/ if they do not already exist.
  1401. Crispin Standards Track [Page 37]
  1402. RFC 3501 IMAPv4 March 2003
  1403. The value of the highest-used unique identifier of the old mailbox
  1404. name MUST be preserved so that a new mailbox created with the same
  1405. name will not reuse the identifiers of the former incarnation,
  1406. UNLESS the new incarnation has a different unique identifier
  1407. validity value. See the description of the UID command for more
  1408. detail.
  1409. Renaming INBOX is permitted, and has special behavior. It moves
  1410. all messages in INBOX to a new mailbox with the given name,
  1411. leaving INBOX empty. If the server implementation supports
  1412. inferior hierarchical names of INBOX, these are unaffected by a
  1413. rename of INBOX.
  1414. Examples: C: A682 LIST "" *
  1415. S: * LIST () "/" blurdybloop
  1416. S: * LIST (\Noselect) "/" foo
  1417. S: * LIST () "/" foo/bar
  1418. S: A682 OK LIST completed
  1419. C: A683 RENAME blurdybloop sarasoop
  1420. S: A683 OK RENAME completed
  1421. C: A684 RENAME foo zowie
  1422. S: A684 OK RENAME Completed
  1423. C: A685 LIST "" *
  1424. S: * LIST () "/" sarasoop
  1425. S: * LIST (\Noselect) "/" zowie
  1426. S: * LIST () "/" zowie/bar
  1427. S: A685 OK LIST completed
  1428. C: Z432 LIST "" *
  1429. S: * LIST () "." INBOX
  1430. S: * LIST () "." INBOX.bar
  1431. S: Z432 OK LIST completed
  1432. C: Z433 RENAME INBOX old-mail
  1433. S: Z433 OK RENAME completed
  1434. C: Z434 LIST "" *
  1435. S: * LIST () "." INBOX
  1436. S: * LIST () "." INBOX.bar
  1437. S: * LIST () "." old-mail
  1438. S: Z434 OK LIST completed
  1439. Crispin Standards Track [Page 38]
  1440. RFC 3501 IMAPv4 March 2003
  1441. 6.3.6. SUBSCRIBE Command
  1442. Arguments: mailbox
  1443. Responses: no specific responses for this command
  1444. Result: OK - subscribe completed
  1445. NO - subscribe failure: can't subscribe to that name
  1446. BAD - command unknown or arguments invalid
  1447. The SUBSCRIBE command adds the specified mailbox name to the
  1448. server's set of "active" or "subscribed" mailboxes as returned by
  1449. the LSUB command. This command returns a tagged OK response only
  1450. if the subscription is successful.
  1451. A server MAY validate the mailbox argument to SUBSCRIBE to verify
  1452. that it exists. However, it MUST NOT unilaterally remove an
  1453. existing mailbox name from the subscription list even if a mailbox
  1454. by that name no longer exists.
  1455. Note: This requirement is because a server site can
  1456. choose to routinely remove a mailbox with a well-known
  1457. name (e.g., "system-alerts") after its contents expire,
  1458. with the intention of recreating it when new contents
  1459. are appropriate.
  1460. Example: C: A002 SUBSCRIBE #news.comp.mail.mime
  1461. S: A002 OK SUBSCRIBE completed
  1462. 6.3.7. UNSUBSCRIBE Command
  1463. Arguments: mailbox name
  1464. Responses: no specific responses for this command
  1465. Result: OK - unsubscribe completed
  1466. NO - unsubscribe failure: can't unsubscribe that name
  1467. BAD - command unknown or arguments invalid
  1468. The UNSUBSCRIBE command removes the specified mailbox name from
  1469. the server's set of "active" or "subscribed" mailboxes as returned
  1470. by the LSUB command. This command returns a tagged OK response
  1471. only if the unsubscription is successful.
  1472. Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime
  1473. S: A002 OK UNSUBSCRIBE completed
  1474. Crispin Standards Track [Page 39]
  1475. RFC 3501 IMAPv4 March 2003
  1476. 6.3.8. LIST Command
  1477. Arguments: reference name
  1478. mailbox name with possible wildcards
  1479. Responses: untagged responses: LIST
  1480. Result: OK - list completed
  1481. NO - list failure: can't list that reference or name
  1482. BAD - command unknown or arguments invalid
  1483. The LIST command returns a subset of names from the complete set
  1484. of all names available to the client. Zero or more untagged LIST
  1485. replies are returned, containing the name attributes, hierarchy
  1486. delimiter, and name; see the description of the LIST reply for
  1487. more detail.
  1488. The LIST command SHOULD return its data quickly, without undue
  1489. delay. For example, it SHOULD NOT go to excess trouble to
  1490. calculate the \Marked or \Unmarked status or perform other
  1491. processing; if each name requires 1 second of processing, then a
  1492. list of 1200 names would take 20 minutes!
  1493. An empty ("" string) reference name argument indicates that the
  1494. mailbox name is interpreted as by SELECT. The returned mailbox
  1495. names MUST match the supplied mailbox name pattern. A non-empty
  1496. reference name argument is the name of a mailbox or a level of
  1497. mailbox hierarchy, and indicates the context in which the mailbox
  1498. name is interpreted.
  1499. An empty ("" string) mailbox name argument is a special request to
  1500. return the hierarchy delimiter and the root name of the name given
  1501. in the reference. The value returned as the root MAY be the empty
  1502. string if the reference is non-rooted or is an empty string. In
  1503. all cases, a hierarchy delimiter (or NIL if there is no hierarchy)
  1504. is returned. This permits a client to get the hierarchy delimiter
  1505. (or find out that the mailbox names are flat) even when no
  1506. mailboxes by that name currently exist.
  1507. The reference and mailbox name arguments are interpreted into a
  1508. canonical form that represents an unambiguous left-to-right
  1509. hierarchy. The returned mailbox names will be in the interpreted
  1510. form.
  1511. Crispin Standards Track [Page 40]
  1512. RFC 3501 IMAPv4 March 2003
  1513. Note: The interpretation of the reference argument is
  1514. implementation-defined. It depends upon whether the
  1515. server implementation has a concept of the "current
  1516. working directory" and leading "break out characters",
  1517. which override the current working directory.
  1518. For example, on a server which exports a UNIX or NT
  1519. filesystem, the reference argument contains the current
  1520. working directory, and the mailbox name argument would
  1521. contain the name as interpreted in the current working
  1522. directory.
  1523. If a server implementation has no concept of break out
  1524. characters, the canonical form is normally the reference
  1525. name appended with the mailbox name. Note that if the
  1526. server implements the namespace convention (section
  1527. 5.1.2), "#" is a break out character and must be treated
  1528. as such.
  1529. If the reference argument is not a level of mailbox
  1530. hierarchy (that is, it is a \NoInferiors name), and/or
  1531. the reference argument does not end with the hierarchy
  1532. delimiter, it is implementation-dependent how this is
  1533. interpreted. For example, a reference of "foo/bar" and
  1534. mailbox name of "rag/baz" could be interpreted as
  1535. "foo/bar/rag/baz", "foo/barrag/baz", or "foo/rag/baz".
  1536. A client SHOULD NOT use such a reference argument except
  1537. at the explicit request of the user. A hierarchical
  1538. browser MUST NOT make any assumptions about server
  1539. interpretation of the reference unless the reference is
  1540. a level of mailbox hierarchy AND ends with the hierarchy
  1541. delimiter.
  1542. Any part of the reference argument that is included in the
  1543. interpreted form SHOULD prefix the interpreted form. It SHOULD
  1544. also be in the same form as the reference name argument. This
  1545. rule permits the client to determine if the returned mailbox name
  1546. is in the context of the reference argument, or if something about
  1547. the mailbox argument overrode the reference argument. Without
  1548. this rule, the client would have to have knowledge of the server's
  1549. naming semantics including what characters are "breakouts" that
  1550. override a naming context.
  1551. Crispin Standards Track [Page 41]
  1552. RFC 3501 IMAPv4 March 2003
  1553. For example, here are some examples of how references
  1554. and mailbox names might be interpreted on a UNIX-based
  1555. server:
  1556. Reference Mailbox Name Interpretation
  1557. ------------ ------------ --------------
  1558. ~smith/Mail/ foo.* ~smith/Mail/foo.*
  1559. archive/ % archive/%
  1560. #news. comp.mail.* #news.comp.mail.*
  1561. ~smith/Mail/ /usr/doc/foo /usr/doc/foo
  1562. archive/ ~fred/Mail/* ~fred/Mail/*
  1563. The first three examples demonstrate interpretations in
  1564. the context of the reference argument. Note that
  1565. "~smith/Mail" SHOULD NOT be transformed into something
  1566. like "/u2/users/smith/Mail", or it would be impossible
  1567. for the client to determine that the interpretation was
  1568. in the context of the reference.
  1569. The character "*" is a wildcard, and matches zero or more
  1570. characters at this position. The character "%" is similar to "*",
  1571. but it does not match a hierarchy delimiter. If the "%" wildcard
  1572. is the last character of a mailbox name argument, matching levels
  1573. of hierarchy are also returned. If these levels of hierarchy are
  1574. not also selectable mailboxes, they are returned with the
  1575. \Noselect mailbox name attribute (see the description of the LIST
  1576. response for more details).
  1577. Server implementations are permitted to "hide" otherwise
  1578. accessible mailboxes from the wildcard characters, by preventing
  1579. certain characters or names from matching a wildcard in certain
  1580. situations. For example, a UNIX-based server might restrict the
  1581. interpretation of "*" so that an initial "/" character does not
  1582. match.
  1583. The special name INBOX is included in the output from LIST, if
  1584. INBOX is supported by this server for this user and if the
  1585. uppercase string "INBOX" matches the interpreted reference and
  1586. mailbox name arguments with wildcards as described above. The
  1587. criteria for omitting INBOX is whether SELECT INBOX will return
  1588. failure; it is not relevant whether the user's real INBOX resides
  1589. on this or some other server.
  1590. Crispin Standards Track [Page 42]
  1591. RFC 3501 IMAPv4 March 2003
  1592. Example: C: A101 LIST "" ""
  1593. S: * LIST (\Noselect) "/" ""
  1594. S: A101 OK LIST Completed
  1595. C: A102 LIST #news.comp.mail.misc ""
  1596. S: * LIST (\Noselect) "." #news.
  1597. S: A102 OK LIST Completed
  1598. C: A103 LIST /usr/staff/jones ""
  1599. S: * LIST (\Noselect) "/" /
  1600. S: A103 OK LIST Completed
  1601. C: A202 LIST ~/Mail/ %
  1602. S: * LIST (\Noselect) "/" ~/Mail/foo
  1603. S: * LIST () "/" ~/Mail/meetings
  1604. S: A202 OK LIST completed
  1605. 6.3.9. LSUB Command
  1606. Arguments: reference name
  1607. mailbox name with possible wildcards
  1608. Responses: untagged responses: LSUB
  1609. Result: OK - lsub completed
  1610. NO - lsub failure: can't list that reference or name
  1611. BAD - command unknown or arguments invalid
  1612. The LSUB command returns a subset of names from the set of names
  1613. that the user has declared as being "active" or "subscribed".
  1614. Zero or more untagged LSUB replies are returned. The arguments to
  1615. LSUB are in the same form as those for LIST.
  1616. The returned untagged LSUB response MAY contain different mailbox
  1617. flags from a LIST untagged response. If this should happen, the
  1618. flags in the untagged LIST are considered more authoritative.
  1619. A special situation occurs when using LSUB with the % wildcard.
  1620. Consider what happens if "foo/bar" (with a hierarchy delimiter of
  1621. "/") is subscribed but "foo" is not. A "%" wildcard to LSUB must
  1622. return foo, not foo/bar, in the LSUB response, and it MUST be
  1623. flagged with the \Noselect attribute.
  1624. The server MUST NOT unilaterally remove an existing mailbox name
  1625. from the subscription list even if a mailbox by that name no
  1626. longer exists.
  1627. Crispin Standards Track [Page 43]
  1628. RFC 3501 IMAPv4 March 2003
  1629. Example: C: A002 LSUB "#news." "comp.mail.*"
  1630. S: * LSUB () "." #news.comp.mail.mime
  1631. S: * LSUB () "." #news.comp.mail.misc
  1632. S: A002 OK LSUB completed
  1633. C: A003 LSUB "#news." "comp.%"
  1634. S: * LSUB (\NoSelect) "." #news.comp.mail
  1635. S: A003 OK LSUB completed
  1636. 6.3.10. STATUS Command
  1637. Arguments: mailbox name
  1638. status data item names
  1639. Responses: untagged responses: STATUS
  1640. Result: OK - status completed
  1641. NO - status failure: no status for that name
  1642. BAD - command unknown or arguments invalid
  1643. The STATUS command requests the status of the indicated mailbox.
  1644. It does not change the currently selected mailbox, nor does it
  1645. affect the state of any messages in the queried mailbox (in
  1646. particular, STATUS MUST NOT cause messages to lose the \Recent
  1647. flag).
  1648. The STATUS command provides an alternative to opening a second
  1649. IMAP4rev1 connection and doing an EXAMINE command on a mailbox to
  1650. query that mailbox's status without deselecting the current
  1651. mailbox in the first IMAP4rev1 connection.
  1652. Unlike the LIST command, the STATUS command is not guaranteed to
  1653. be fast in its response. Under certain circumstances, it can be
  1654. quite slow. In some implementations, the server is obliged to
  1655. open the mailbox read-only internally to obtain certain status
  1656. information. Also unlike the LIST command, the STATUS command
  1657. does not accept wildcards.
  1658. Note: The STATUS command is intended to access the
  1659. status of mailboxes other than the currently selected
  1660. mailbox. Because the STATUS command can cause the
  1661. mailbox to be opened internally, and because this
  1662. information is available by other means on the selected
  1663. mailbox, the STATUS command SHOULD NOT be used on the
  1664. currently selected mailbox.
  1665. Crispin Standards Track [Page 44]
  1666. RFC 3501 IMAPv4 March 2003
  1667. The STATUS command MUST NOT be used as a "check for new
  1668. messages in the selected mailbox" operation (refer to
  1669. sections 7, 7.3.1, and 7.3.2 for more information about
  1670. the proper method for new message checking).
  1671. Because the STATUS command is not guaranteed to be fast
  1672. in its results, clients SHOULD NOT expect to be able to
  1673. issue many consecutive STATUS commands and obtain
  1674. reasonable performance.
  1675. The currently defined status data items that can be requested are:
  1676. MESSAGES
  1677. The number of messages in the mailbox.
  1678. RECENT
  1679. The number of messages with the \Recent flag set.
  1680. UIDNEXT
  1681. The next unique identifier value of the mailbox. Refer to
  1682. section 2.3.1.1 for more information.
  1683. UIDVALIDITY
  1684. The unique identifier validity value of the mailbox. Refer to
  1685. section 2.3.1.1 for more information.
  1686. UNSEEN
  1687. The number of messages which do not have the \Seen flag set.
  1688. Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES)
  1689. S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292)
  1690. S: A042 OK STATUS completed
  1691. Crispin Standards Track [Page 45]
  1692. RFC 3501 IMAPv4 March 2003
  1693. 6.3.11. APPEND Command
  1694. Arguments: mailbox name
  1695. OPTIONAL flag parenthesized list
  1696. OPTIONAL date/time string
  1697. message literal
  1698. Responses: no specific responses for this command
  1699. Result: OK - append completed
  1700. NO - append error: can't append to that mailbox, error
  1701. in flags or date/time or message text
  1702. BAD - command unknown or arguments invalid
  1703. The APPEND command appends the literal argument as a new message
  1704. to the end of the specified destination mailbox. This argument
  1705. SHOULD be in the format of an [RFC-2822] message. 8-bit
  1706. characters are permitted in the message. A server implementation
  1707. that is unable to preserve 8-bit data properly MUST be able to
  1708. reversibly convert 8-bit APPEND data to 7-bit using a [MIME-IMB]
  1709. content transfer encoding.
  1710. Note: There MAY be exceptions, e.g., draft messages, in
  1711. which required [RFC-2822] header lines are omitted in
  1712. the message literal argument to APPEND. The full
  1713. implications of doing so MUST be understood and
  1714. carefully weighed.
  1715. If a flag parenthesized list is specified, the flags SHOULD be set
  1716. in the resulting message; otherwise, the flag list of the
  1717. resulting message is set to empty by default. In either case, the
  1718. Recent flag is also set.
  1719. If a date-time is specified, the internal date SHOULD be set in
  1720. the resulting message; otherwise, the internal date of the
  1721. resulting message is set to the current date and time by default.
  1722. If the append is unsuccessful for any reason, the mailbox MUST be
  1723. restored to its state before the APPEND attempt; no partial
  1724. appending is permitted.
  1725. If the destination mailbox does not exist, a server MUST return an
  1726. error, and MUST NOT automatically create the mailbox. Unless it
  1727. is certain that the destination mailbox can not be created, the
  1728. server MUST send the response code "[TRYCREATE]" as the prefix of
  1729. the text of the tagged NO response. This gives a hint to the
  1730. client that it can attempt a CREATE command and retry the APPEND
  1731. if the CREATE is successful.
  1732. Crispin Standards Track [Page 46]
  1733. RFC 3501 IMAPv4 March 2003
  1734. If the mailbox is currently selected, the normal new message
  1735. actions SHOULD occur. Specifically, the server SHOULD notify the
  1736. client immediately via an untagged EXISTS response. If the server
  1737. does not do so, the client MAY issue a NOOP command (or failing
  1738. that, a CHECK command) after one or more APPEND commands.
  1739. Example: C: A003 APPEND saved-messages (\Seen) {310}
  1740. S: + Ready for literal data
  1741. C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  1742. C: From: Fred Foobar <foobar@Blurdybloop.COM>
  1743. C: Subject: afternoon meeting
  1744. C: To: mooch@owatagu.siam.edu
  1745. C: Message-Id: <B27397-0100000@Blurdybloop.COM>
  1746. C: MIME-Version: 1.0
  1747. C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  1748. C:
  1749. C: Hello Joe, do you think we can meet at 3:30 tomorrow?
  1750. C:
  1751. S: A003 OK APPEND completed
  1752. Note: The APPEND command is not used for message delivery,
  1753. because it does not provide a mechanism to transfer [SMTP]
  1754. envelope information.
  1755. 6.4. Client Commands - Selected State
  1756. In the selected state, commands that manipulate messages in a mailbox
  1757. are permitted.
  1758. In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
  1759. and the authenticated state commands (SELECT, EXAMINE, CREATE,
  1760. DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB, STATUS, and
  1761. APPEND), the following commands are valid in the selected state:
  1762. CHECK, CLOSE, EXPUNGE, SEARCH, FETCH, STORE, COPY, and UID.
  1763. 6.4.1. CHECK Command
  1764. Arguments: none
  1765. Responses: no specific responses for this command
  1766. Result: OK - check completed
  1767. BAD - command unknown or arguments invalid
  1768. The CHECK command requests a checkpoint of the currently selected
  1769. mailbox. A checkpoint refers to any implementation-dependent
  1770. housekeeping associated with the mailbox (e.g., resolving the
  1771. server's in-memory state of the mailbox with the state on its
  1772. Crispin Standards Track [Page 47]
  1773. RFC 3501 IMAPv4 March 2003
  1774. disk) that is not normally executed as part of each command. A
  1775. checkpoint MAY take a non-instantaneous amount of real time to
  1776. complete. If a server implementation has no such housekeeping
  1777. considerations, CHECK is equivalent to NOOP.
  1778. There is no guarantee that an EXISTS untagged response will happen
  1779. as a result of CHECK. NOOP, not CHECK, SHOULD be used for new
  1780. message polling.
  1781. Example: C: FXXZ CHECK
  1782. S: FXXZ OK CHECK Completed
  1783. 6.4.2. CLOSE Command
  1784. Arguments: none
  1785. Responses: no specific responses for this command
  1786. Result: OK - close completed, now in authenticated state
  1787. BAD - command unknown or arguments invalid
  1788. The CLOSE command permanently removes all messages that have the
  1789. \Deleted flag set from the currently selected mailbox, and returns
  1790. to the authenticated state from the selected state. No untagged
  1791. EXPUNGE responses are sent.
  1792. No messages are removed, and no error is given, if the mailbox is
  1793. selected by an EXAMINE command or is otherwise selected read-only.
  1794. Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT
  1795. command MAY be issued without previously issuing a CLOSE command.
  1796. The SELECT, EXAMINE, and LOGOUT commands implicitly close the
  1797. currently selected mailbox without doing an expunge. However,
  1798. when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT
  1799. sequence is considerably faster than an EXPUNGE-LOGOUT or
  1800. EXPUNGE-SELECT because no untagged EXPUNGE responses (which the
  1801. client would probably ignore) are sent.
  1802. Example: C: A341 CLOSE
  1803. S: A341 OK CLOSE completed
  1804. Crispin Standards Track [Page 48]
  1805. RFC 3501 IMAPv4 March 2003
  1806. 6.4.3. EXPUNGE Command
  1807. Arguments: none
  1808. Responses: untagged responses: EXPUNGE
  1809. Result: OK - expunge completed
  1810. NO - expunge failure: can't expunge (e.g., permission
  1811. denied)
  1812. BAD - command unknown or arguments invalid
  1813. The EXPUNGE command permanently removes all messages that have the
  1814. \Deleted flag set from the currently selected mailbox. Before
  1815. returning an OK to the client, an untagged EXPUNGE response is
  1816. sent for each message that is removed.
  1817. Example: C: A202 EXPUNGE
  1818. S: * 3 EXPUNGE
  1819. S: * 3 EXPUNGE
  1820. S: * 5 EXPUNGE
  1821. S: * 8 EXPUNGE
  1822. S: A202 OK EXPUNGE completed
  1823. Note: In this example, messages 3, 4, 7, and 11 had the
  1824. \Deleted flag set. See the description of the EXPUNGE
  1825. response for further explanation.
  1826. 6.4.4. SEARCH Command
  1827. Arguments: OPTIONAL [CHARSET] specification
  1828. searching criteria (one or more)
  1829. Responses: REQUIRED untagged response: SEARCH
  1830. Result: OK - search completed
  1831. NO - search error: can't search that [CHARSET] or
  1832. criteria
  1833. BAD - command unknown or arguments invalid
  1834. The SEARCH command searches the mailbox for messages that match
  1835. the given searching criteria. Searching criteria consist of one
  1836. or more search keys. The untagged SEARCH response from the server
  1837. contains a listing of message sequence numbers corresponding to
  1838. those messages that match the searching criteria.
  1839. Crispin Standards Track [Page 49]
  1840. RFC 3501 IMAPv4 March 2003
  1841. When multiple keys are specified, the result is the intersection
  1842. (AND function) of all the messages that match those keys. For
  1843. example, the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers
  1844. to all deleted messages from Smith that were placed in the mailbox
  1845. since February 1, 1994. A search key can also be a parenthesized
  1846. list of one or more search keys (e.g., for use with the OR and NOT
  1847. keys).
  1848. Server implementations MAY exclude [MIME-IMB] body parts with
  1849. terminal content media types other than TEXT and MESSAGE from
  1850. consideration in SEARCH matching.
  1851. The OPTIONAL [CHARSET] specification consists of the word
  1852. "CHARSET" followed by a registered [CHARSET]. It indicates the
  1853. [CHARSET] of the strings that appear in the search criteria.
  1854. [MIME-IMB] content transfer encodings, and [MIME-HDRS] strings in
  1855. [RFC-2822]/[MIME-IMB] headers, MUST be decoded before comparing
  1856. text in a [CHARSET] other than US-ASCII. US-ASCII MUST be
  1857. supported; other [CHARSET]s MAY be supported.
  1858. If the server does not support the specified [CHARSET], it MUST
  1859. return a tagged NO response (not a BAD). This response SHOULD
  1860. contain the BADCHARSET response code, which MAY list the
  1861. [CHARSET]s supported by the server.
  1862. In all search keys that use strings, a message matches the key if
  1863. the string is a substring of the field. The matching is
  1864. case-insensitive.
  1865. The defined search keys are as follows. Refer to the Formal
  1866. Syntax section for the precise syntactic definitions of the
  1867. arguments.
  1868. <sequence set>
  1869. Messages with message sequence numbers corresponding to the
  1870. specified message sequence number set.
  1871. ALL
  1872. All messages in the mailbox; the default initial key for
  1873. ANDing.
  1874. ANSWERED
  1875. Messages with the \Answered flag set.
  1876. Crispin Standards Track [Page 50]
  1877. RFC 3501 IMAPv4 March 2003
  1878. BCC <string>
  1879. Messages that contain the specified string in the envelope
  1880. structure's BCC field.
  1881. BEFORE <date>
  1882. Messages whose internal date (disregarding time and timezone)
  1883. is earlier than the specified date.
  1884. BODY <string>
  1885. Messages that contain the specified string in the body of the
  1886. message.
  1887. CC <string>
  1888. Messages that contain the specified string in the envelope
  1889. structure's CC field.
  1890. DELETED
  1891. Messages with the \Deleted flag set.
  1892. DRAFT
  1893. Messages with the \Draft flag set.
  1894. FLAGGED
  1895. Messages with the \Flagged flag set.
  1896. FROM <string>
  1897. Messages that contain the specified string in the envelope
  1898. structure's FROM field.
  1899. HEADER <field-name> <string>
  1900. Messages that have a header with the specified field-name (as
  1901. defined in [RFC-2822]) and that contains the specified string
  1902. in the text of the header (what comes after the colon). If the
  1903. string to search is zero-length, this matches all messages that
  1904. have a header line with the specified field-name regardless of
  1905. the contents.
  1906. KEYWORD <flag>
  1907. Messages with the specified keyword flag set.
  1908. LARGER <n>
  1909. Messages with an [RFC-2822] size larger than the specified
  1910. number of octets.
  1911. NEW
  1912. Messages that have the \Recent flag set but not the \Seen flag.
  1913. This is functionally equivalent to "(RECENT UNSEEN)".
  1914. Crispin Standards Track [Page 51]
  1915. RFC 3501 IMAPv4 March 2003
  1916. NOT <search-key>
  1917. Messages that do not match the specified search key.
  1918. OLD
  1919. Messages that do not have the \Recent flag set. This is
  1920. functionally equivalent to "NOT RECENT" (as opposed to "NOT
  1921. NEW").
  1922. ON <date>
  1923. Messages whose internal date (disregarding time and timezone)
  1924. is within the specified date.
  1925. OR <search-key1> <search-key2>
  1926. Messages that match either search key.
  1927. RECENT
  1928. Messages that have the \Recent flag set.
  1929. SEEN
  1930. Messages that have the \Seen flag set.
  1931. SENTBEFORE <date>
  1932. Messages whose [RFC-2822] Date: header (disregarding time and
  1933. timezone) is earlier than the specified date.
  1934. SENTON <date>
  1935. Messages whose [RFC-2822] Date: header (disregarding time and
  1936. timezone) is within the specified date.
  1937. SENTSINCE <date>
  1938. Messages whose [RFC-2822] Date: header (disregarding time and
  1939. timezone) is within or later than the specified date.
  1940. SINCE <date>
  1941. Messages whose internal date (disregarding time and timezone)
  1942. is within or later than the specified date.
  1943. SMALLER <n>
  1944. Messages with an [RFC-2822] size smaller than the specified
  1945. number of octets.
  1946. Crispin Standards Track [Page 52]
  1947. RFC 3501 IMAPv4 March 2003
  1948. SUBJECT <string>
  1949. Messages that contain the specified string in the envelope
  1950. structure's SUBJECT field.
  1951. TEXT <string>
  1952. Messages that contain the specified string in the header or
  1953. body of the message.
  1954. TO <string>
  1955. Messages that contain the specified string in the envelope
  1956. structure's TO field.
  1957. UID <sequence set>
  1958. Messages with unique identifiers corresponding to the specified
  1959. unique identifier set. Sequence set ranges are permitted.
  1960. UNANSWERED
  1961. Messages that do not have the \Answered flag set.
  1962. UNDELETED
  1963. Messages that do not have the \Deleted flag set.
  1964. UNDRAFT
  1965. Messages that do not have the \Draft flag set.
  1966. UNFLAGGED
  1967. Messages that do not have the \Flagged flag set.
  1968. UNKEYWORD <flag>
  1969. Messages that do not have the specified keyword flag set.
  1970. UNSEEN
  1971. Messages that do not have the \Seen flag set.
  1972. Crispin Standards Track [Page 53]
  1973. RFC 3501 IMAPv4 March 2003
  1974. Example: C: A282 SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith"
  1975. S: * SEARCH 2 84 882
  1976. S: A282 OK SEARCH completed
  1977. C: A283 SEARCH TEXT "string not in mailbox"
  1978. S: * SEARCH
  1979. S: A283 OK SEARCH completed
  1980. C: A284 SEARCH CHARSET UTF-8 TEXT {6}
  1981. C: XXXXXX
  1982. S: * SEARCH 43
  1983. S: A284 OK SEARCH completed
  1984. Note: Since this document is restricted to 7-bit ASCII
  1985. text, it is not possible to show actual UTF-8 data. The
  1986. "XXXXXX" is a placeholder for what would be 6 octets of
  1987. 8-bit data in an actual transaction.
  1988. 6.4.5. FETCH Command
  1989. Arguments: sequence set
  1990. message data item names or macro
  1991. Responses: untagged responses: FETCH
  1992. Result: OK - fetch completed
  1993. NO - fetch error: can't fetch that data
  1994. BAD - command unknown or arguments invalid
  1995. The FETCH command retrieves data associated with a message in the
  1996. mailbox. The data items to be fetched can be either a single atom
  1997. or a parenthesized list.
  1998. Most data items, identified in the formal syntax under the
  1999. msg-att-static rule, are static and MUST NOT change for any
  2000. particular message. Other data items, identified in the formal
  2001. syntax under the msg-att-dynamic rule, MAY change, either as a
  2002. result of a STORE command or due to external events.
  2003. For example, if a client receives an ENVELOPE for a
  2004. message when it already knows the envelope, it can
  2005. safely ignore the newly transmitted envelope.
  2006. There are three macros which specify commonly-used sets of data
  2007. items, and can be used instead of data items. A macro must be
  2008. used by itself, and not in conjunction with other macros or data
  2009. items.
  2010. Crispin Standards Track [Page 54]
  2011. RFC 3501 IMAPv4 March 2003
  2012. ALL
  2013. Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)
  2014. FAST
  2015. Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE)
  2016. FULL
  2017. Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE
  2018. BODY)
  2019. The currently defined data items that can be fetched are:
  2020. BODY
  2021. Non-extensible form of BODYSTRUCTURE.
  2022. BODY[<section>]<<partial>>
  2023. The text of a particular body section. The section
  2024. specification is a set of zero or more part specifiers
  2025. delimited by periods. A part specifier is either a part number
  2026. or one of the following: HEADER, HEADER.FIELDS,
  2027. HEADER.FIELDS.NOT, MIME, and TEXT. An empty section
  2028. specification refers to the entire message, including the
  2029. header.
  2030. Every message has at least one part number. Non-[MIME-IMB]
  2031. messages, and non-multipart [MIME-IMB] messages with no
  2032. encapsulated message, only have a part 1.
  2033. Multipart messages are assigned consecutive part numbers, as
  2034. they occur in the message. If a particular part is of type
  2035. message or multipart, its parts MUST be indicated by a period
  2036. followed by the part number within that nested multipart part.
  2037. A part of type MESSAGE/RFC822 also has nested part numbers,
  2038. referring to parts of the MESSAGE part's body.
  2039. The HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, and TEXT part
  2040. specifiers can be the sole part specifier or can be prefixed by
  2041. one or more numeric part specifiers, provided that the numeric
  2042. part specifier refers to a part of type MESSAGE/RFC822. The
  2043. MIME part specifier MUST be prefixed by one or more numeric
  2044. part specifiers.
  2045. The HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part
  2046. specifiers refer to the [RFC-2822] header of the message or of
  2047. an encapsulated [MIME-IMT] MESSAGE/RFC822 message.
  2048. HEADER.FIELDS and HEADER.FIELDS.NOT are followed by a list of
  2049. field-name (as defined in [RFC-2822]) names, and return a
  2050. Crispin Standards Track [Page 55]
  2051. RFC 3501 IMAPv4 March 2003
  2052. subset of the header. The subset returned by HEADER.FIELDS
  2053. contains only those header fields with a field-name that
  2054. matches one of the names in the list; similarly, the subset
  2055. returned by HEADER.FIELDS.NOT contains only the header fields
  2056. with a non-matching field-name. The field-matching is
  2057. case-insensitive but otherwise exact. Subsetting does not
  2058. exclude the [RFC-2822] delimiting blank line between the header
  2059. and the body; the blank line is included in all header fetches,
  2060. except in the case of a message which has no body and no blank
  2061. line.
  2062. The MIME part specifier refers to the [MIME-IMB] header for
  2063. this part.
  2064. The TEXT part specifier refers to the text body of the message,
  2065. omitting the [RFC-2822] header.
  2066. Here is an example of a complex message with some of its
  2067. part specifiers:
  2068. HEADER ([RFC-2822] header of the message)
  2069. TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED
  2070. 1 TEXT/PLAIN
  2071. 2 APPLICATION/OCTET-STREAM
  2072. 3 MESSAGE/RFC822
  2073. 3.HEADER ([RFC-2822] header of the message)
  2074. 3.TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED
  2075. 3.1 TEXT/PLAIN
  2076. 3.2 APPLICATION/OCTET-STREAM
  2077. 4 MULTIPART/MIXED
  2078. 4.1 IMAGE/GIF
  2079. 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF)
  2080. 4.2 MESSAGE/RFC822
  2081. 4.2.HEADER ([RFC-2822] header of the message)
  2082. 4.2.TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED
  2083. 4.2.1 TEXT/PLAIN
  2084. 4.2.2 MULTIPART/ALTERNATIVE
  2085. 4.2.2.1 TEXT/PLAIN
  2086. 4.2.2.2 TEXT/RICHTEXT
  2087. It is possible to fetch a substring of the designated text.
  2088. This is done by appending an open angle bracket ("<"), the
  2089. octet position of the first desired octet, a period, the
  2090. maximum number of octets desired, and a close angle bracket
  2091. (">") to the part specifier. If the starting octet is beyond
  2092. the end of the text, an empty string is returned.
  2093. Crispin Standards Track [Page 56]
  2094. RFC 3501 IMAPv4 March 2003
  2095. Any partial fetch that attempts to read beyond the end of the
  2096. text is truncated as appropriate. A partial fetch that starts
  2097. at octet 0 is returned as a partial fetch, even if this
  2098. truncation happened.
  2099. Note: This means that BODY[]<0.2048> of a 1500-octet message
  2100. will return BODY[]<0> with a literal of size 1500, not
  2101. BODY[].
  2102. Note: A substring fetch of a HEADER.FIELDS or
  2103. HEADER.FIELDS.NOT part specifier is calculated after
  2104. subsetting the header.
  2105. The \Seen flag is implicitly set; if this causes the flags to
  2106. change, they SHOULD be included as part of the FETCH responses.
  2107. BODY.PEEK[<section>]<<partial>>
  2108. An alternate form of BODY[<section>] that does not implicitly
  2109. set the \Seen flag.
  2110. BODYSTRUCTURE
  2111. The [MIME-IMB] body structure of the message. This is computed
  2112. by the server by parsing the [MIME-IMB] header fields in the
  2113. [RFC-2822] header and [MIME-IMB] headers.
  2114. ENVELOPE
  2115. The envelope structure of the message. This is computed by the
  2116. server by parsing the [RFC-2822] header into the component
  2117. parts, defaulting various fields as necessary.
  2118. FLAGS
  2119. The flags that are set for this message.
  2120. INTERNALDATE
  2121. The internal date of the message.
  2122. RFC822
  2123. Functionally equivalent to BODY[], differing in the syntax of
  2124. the resulting untagged FETCH data (RFC822 is returned).
  2125. RFC822.HEADER
  2126. Functionally equivalent to BODY.PEEK[HEADER], differing in the
  2127. syntax of the resulting untagged FETCH data (RFC822.HEADER is
  2128. returned).
  2129. RFC822.SIZE
  2130. The [RFC-2822] size of the message.
  2131. Crispin Standards Track [Page 57]
  2132. RFC 3501 IMAPv4 March 2003
  2133. RFC822.TEXT
  2134. Functionally equivalent to BODY[TEXT], differing in the syntax
  2135. of the resulting untagged FETCH data (RFC822.TEXT is returned).
  2136. UID
  2137. The unique identifier for the message.
  2138. Example: C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)])
  2139. S: * 2 FETCH ....
  2140. S: * 3 FETCH ....
  2141. S: * 4 FETCH ....
  2142. S: A654 OK FETCH completed
  2143. 6.4.6. STORE Command
  2144. Arguments: sequence set
  2145. message data item name
  2146. value for message data item
  2147. Responses: untagged responses: FETCH
  2148. Result: OK - store completed
  2149. NO - store error: can't store that data
  2150. BAD - command unknown or arguments invalid
  2151. The STORE command alters data associated with a message in the
  2152. mailbox. Normally, STORE will return the updated value of the
  2153. data with an untagged FETCH response. A suffix of ".SILENT" in
  2154. the data item name prevents the untagged FETCH, and the server
  2155. SHOULD assume that the client has determined the updated value
  2156. itself or does not care about the updated value.
  2157. Note: Regardless of whether or not the ".SILENT" suffix
  2158. was used, the server SHOULD send an untagged FETCH
  2159. response if a change to a message's flags from an
  2160. external source is observed. The intent is that the
  2161. status of the flags is determinate without a race
  2162. condition.
  2163. Crispin Standards Track [Page 58]
  2164. RFC 3501 IMAPv4 March 2003
  2165. The currently defined data items that can be stored are:
  2166. FLAGS <flag list>
  2167. Replace the flags for the message (other than \Recent) with the
  2168. argument. The new value of the flags is returned as if a FETCH
  2169. of those flags was done.
  2170. FLAGS.SILENT <flag list>
  2171. Equivalent to FLAGS, but without returning a new value.
  2172. +FLAGS <flag list>
  2173. Add the argument to the flags for the message. The new value
  2174. of the flags is returned as if a FETCH of those flags was done.
  2175. +FLAGS.SILENT <flag list>
  2176. Equivalent to +FLAGS, but without returning a new value.
  2177. -FLAGS <flag list>
  2178. Remove the argument from the flags for the message. The new
  2179. value of the flags is returned as if a FETCH of those flags was
  2180. done.
  2181. -FLAGS.SILENT <flag list>
  2182. Equivalent to -FLAGS, but without returning a new value.
  2183. Example: C: A003 STORE 2:4 +FLAGS (\Deleted)
  2184. S: * 2 FETCH (FLAGS (\Deleted \Seen))
  2185. S: * 3 FETCH (FLAGS (\Deleted))
  2186. S: * 4 FETCH (FLAGS (\Deleted \Flagged \Seen))
  2187. S: A003 OK STORE completed
  2188. 6.4.7. COPY Command
  2189. Arguments: sequence set
  2190. mailbox name
  2191. Responses: no specific responses for this command
  2192. Result: OK - copy completed
  2193. NO - copy error: can't copy those messages or to that
  2194. name
  2195. BAD - command unknown or arguments invalid
  2196. Crispin Standards Track [Page 59]
  2197. RFC 3501 IMAPv4 March 2003
  2198. The COPY command copies the specified message(s) to the end of the
  2199. specified destination mailbox. The flags and internal date of the
  2200. message(s) SHOULD be preserved, and the Recent flag SHOULD be set,
  2201. in the copy.
  2202. If the destination mailbox does not exist, a server SHOULD return
  2203. an error. It SHOULD NOT automatically create the mailbox. Unless
  2204. it is certain that the destination mailbox can not be created, the
  2205. server MUST send the response code "[TRYCREATE]" as the prefix of
  2206. the text of the tagged NO response. This gives a hint to the
  2207. client that it can attempt a CREATE command and retry the COPY if
  2208. the CREATE is successful.
  2209. If the COPY command is unsuccessful for any reason, server
  2210. implementations MUST restore the destination mailbox to its state
  2211. before the COPY attempt.
  2212. Example: C: A003 COPY 2:4 MEETING
  2213. S: A003 OK COPY completed
  2214. 6.4.8. UID Command
  2215. Arguments: command name
  2216. command arguments
  2217. Responses: untagged responses: FETCH, SEARCH
  2218. Result: OK - UID command completed
  2219. NO - UID command error
  2220. BAD - command unknown or arguments invalid
  2221. The UID command has two forms. In the first form, it takes as its
  2222. arguments a COPY, FETCH, or STORE command with arguments
  2223. appropriate for the associated command. However, the numbers in
  2224. the sequence set argument are unique identifiers instead of
  2225. message sequence numbers. Sequence set ranges are permitted, but
  2226. there is no guarantee that unique identifiers will be contiguous.
  2227. A non-existent unique identifier is ignored without any error
  2228. message generated. Thus, it is possible for a UID FETCH command
  2229. to return an OK without any data or a UID COPY or UID STORE to
  2230. return an OK without performing any operations.
  2231. In the second form, the UID command takes a SEARCH command with
  2232. SEARCH command arguments. The interpretation of the arguments is
  2233. the same as with SEARCH; however, the numbers returned in a SEARCH
  2234. response for a UID SEARCH command are unique identifiers instead
  2235. Crispin Standards Track [Page 60]
  2236. RFC 3501 IMAPv4 March 2003
  2237. of message sequence numbers. For example, the command UID SEARCH
  2238. 1:100 UID 443:557 returns the unique identifiers corresponding to
  2239. the intersection of two sequence sets, the message sequence number
  2240. range 1:100 and the UID range 443:557.
  2241. Note: in the above example, the UID range 443:557
  2242. appears. The same comment about a non-existent unique
  2243. identifier being ignored without any error message also
  2244. applies here. Hence, even if neither UID 443 or 557
  2245. exist, this range is valid and would include an existing
  2246. UID 495.
  2247. Also note that a UID range of 559:* always includes the
  2248. UID of the last message in the mailbox, even if 559 is
  2249. higher than any assigned UID value. This is because the
  2250. contents of a range are independent of the order of the
  2251. range endpoints. Thus, any UID range with * as one of
  2252. the endpoints indicates at least one message (the
  2253. message with the highest numbered UID), unless the
  2254. mailbox is empty.
  2255. The number after the "*" in an untagged FETCH response is always a
  2256. message sequence number, not a unique identifier, even for a UID
  2257. command response. However, server implementations MUST implicitly
  2258. include the UID message data item as part of any FETCH response
  2259. caused by a UID command, regardless of whether a UID was specified
  2260. as a message data item to the FETCH.
  2261. Note: The rule about including the UID message data item as part
  2262. of a FETCH response primarily applies to the UID FETCH and UID
  2263. STORE commands, including a UID FETCH command that does not
  2264. include UID as a message data item. Although it is unlikely that
  2265. the other UID commands will cause an untagged FETCH, this rule
  2266. applies to these commands as well.
  2267. Example: C: A999 UID FETCH 4827313:4828442 FLAGS
  2268. S: * 23 FETCH (FLAGS (\Seen) UID 4827313)
  2269. S: * 24 FETCH (FLAGS (\Seen) UID 4827943)
  2270. S: * 25 FETCH (FLAGS (\Seen) UID 4828442)
  2271. S: A999 OK UID FETCH completed
  2272. Crispin Standards Track [Page 61]
  2273. RFC 3501 IMAPv4 March 2003
  2274. 6.5. Client Commands - Experimental/Expansion
  2275. 6.5.1. X<atom> Command
  2276. Arguments: implementation defined
  2277. Responses: implementation defined
  2278. Result: OK - command completed
  2279. NO - failure
  2280. BAD - command unknown or arguments invalid
  2281. Any command prefixed with an X is an experimental command.
  2282. Commands which are not part of this specification, a standard or
  2283. standards-track revision of this specification, or an
  2284. IESG-approved experimental protocol, MUST use the X prefix.
  2285. Any added untagged responses issued by an experimental command
  2286. MUST also be prefixed with an X. Server implementations MUST NOT
  2287. send any such untagged responses, unless the client requested it
  2288. by issuing the associated experimental command.
  2289. Example: C: a441 CAPABILITY
  2290. S: * CAPABILITY IMAP4rev1 XPIG-LATIN
  2291. S: a441 OK CAPABILITY completed
  2292. C: A442 XPIG-LATIN
  2293. S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay
  2294. S: A442 OK XPIG-LATIN ompleted-cay
  2295. 7. Server Responses
  2296. Server responses are in three forms: status responses, server data,
  2297. and command continuation request. The information contained in a
  2298. server response, identified by "Contents:" in the response
  2299. descriptions below, is described by function, not by syntax. The
  2300. precise syntax of server responses is described in the Formal Syntax
  2301. section.
  2302. The client MUST be prepared to accept any response at all times.
  2303. Status responses can be tagged or untagged. Tagged status responses
  2304. indicate the completion result (OK, NO, or BAD status) of a client
  2305. command, and have a tag matching the command.
  2306. Some status responses, and all server data, are untagged. An
  2307. untagged response is indicated by the token "*" instead of a tag.
  2308. Untagged status responses indicate server greeting, or server status
  2309. Crispin Standards Track [Page 62]
  2310. RFC 3501 IMAPv4 March 2003
  2311. that does not indicate the completion of a command (for example, an
  2312. impending system shutdown alert). For historical reasons, untagged
  2313. server data responses are also called "unsolicited data", although
  2314. strictly speaking, only unilateral server data is truly
  2315. "unsolicited".
  2316. Certain server data MUST be recorded by the client when it is
  2317. received; this is noted in the description of that data. Such data
  2318. conveys critical information which affects the interpretation of all
  2319. subsequent commands and responses (e.g., updates reflecting the
  2320. creation or destruction of messages).
  2321. Other server data SHOULD be recorded for later reference; if the
  2322. client does not need to record the data, or if recording the data has
  2323. no obvious purpose (e.g., a SEARCH response when no SEARCH command is
  2324. in progress), the data SHOULD be ignored.
  2325. An example of unilateral untagged server data occurs when the IMAP
  2326. connection is in the selected state. In the selected state, the
  2327. server checks the mailbox for new messages as part of command
  2328. execution. Normally, this is part of the execution of every command;
  2329. hence, a NOOP command suffices to check for new messages. If new
  2330. messages are found, the server sends untagged EXISTS and RECENT
  2331. responses reflecting the new size of the mailbox. Server
  2332. implementations that offer multiple simultaneous access to the same
  2333. mailbox SHOULD also send appropriate unilateral untagged FETCH and
  2334. EXPUNGE responses if another agent changes the state of any message
  2335. flags or expunges any messages.
  2336. Command continuation request responses use the token "+" instead of a
  2337. tag. These responses are sent by the server to indicate acceptance
  2338. of an incomplete client command and readiness for the remainder of
  2339. the command.
  2340. 7.1. Server Responses - Status Responses
  2341. Status responses are OK, NO, BAD, PREAUTH and BYE. OK, NO, and BAD
  2342. can be tagged or untagged. PREAUTH and BYE are always untagged.
  2343. Status responses MAY include an OPTIONAL "response code". A response
  2344. code consists of data inside square brackets in the form of an atom,
  2345. possibly followed by a space and arguments. The response code
  2346. contains additional information or status codes for client software
  2347. beyond the OK/NO/BAD condition, and are defined when there is a
  2348. specific action that a client can take based upon the additional
  2349. information.
  2350. Crispin Standards Track [Page 63]
  2351. RFC 3501 IMAPv4 March 2003
  2352. The currently defined response codes are:
  2353. ALERT
  2354. The human-readable text contains a special alert that MUST be
  2355. presented to the user in a fashion that calls the user's
  2356. attention to the message.
  2357. BADCHARSET
  2358. Optionally followed by a parenthesized list of charsets. A
  2359. SEARCH failed because the given charset is not supported by
  2360. this implementation. If the optional list of charsets is
  2361. given, this lists the charsets that are supported by this
  2362. implementation.
  2363. CAPABILITY
  2364. Followed by a list of capabilities. This can appear in the
  2365. initial OK or PREAUTH response to transmit an initial
  2366. capabilities list. This makes it unnecessary for a client to
  2367. send a separate CAPABILITY command if it recognizes this
  2368. response.
  2369. PARSE
  2370. The human-readable text represents an error in parsing the
  2371. [RFC-2822] header or [MIME-IMB] headers of a message in the
  2372. mailbox.
  2373. PERMANENTFLAGS
  2374. Followed by a parenthesized list of flags, indicates which of
  2375. the known flags the client can change permanently. Any flags
  2376. that are in the FLAGS untagged response, but not the
  2377. PERMANENTFLAGS list, can not be set permanently. If the client
  2378. attempts to STORE a flag that is not in the PERMANENTFLAGS
  2379. list, the server will either ignore the change or store the
  2380. state change for the remainder of the current session only.
  2381. The PERMANENTFLAGS list can also include the special flag \*,
  2382. which indicates that it is possible to create new keywords by
  2383. attempting to store those flags in the mailbox.
  2384. Crispin Standards Track [Page 64]
  2385. RFC 3501 IMAPv4 March 2003
  2386. READ-ONLY
  2387. The mailbox is selected read-only, or its access while selected
  2388. has changed from read-write to read-only.
  2389. READ-WRITE
  2390. The mailbox is selected read-write, or its access while
  2391. selected has changed from read-only to read-write.
  2392. TRYCREATE
  2393. An APPEND or COPY attempt is failing because the target mailbox
  2394. does not exist (as opposed to some other reason). This is a
  2395. hint to the client that the operation can succeed if the
  2396. mailbox is first created by the CREATE command.
  2397. UIDNEXT
  2398. Followed by a decimal number, indicates the next unique
  2399. identifier value. Refer to section 2.3.1.1 for more
  2400. information.
  2401. UIDVALIDITY
  2402. Followed by a decimal number, indicates the unique identifier
  2403. validity value. Refer to section 2.3.1.1 for more information.
  2404. UNSEEN
  2405. Followed by a decimal number, indicates the number of the first
  2406. message without the \Seen flag set.
  2407. Additional response codes defined by particular client or server
  2408. implementations SHOULD be prefixed with an "X" until they are
  2409. added to a revision of this protocol. Client implementations
  2410. SHOULD ignore response codes that they do not recognize.
  2411. 7.1.1. OK Response
  2412. Contents: OPTIONAL response code
  2413. human-readable text
  2414. The OK response indicates an information message from the server.
  2415. When tagged, it indicates successful completion of the associated
  2416. command. The human-readable text MAY be presented to the user as
  2417. an information message. The untagged form indicates an
  2418. Crispin Standards Track [Page 65]
  2419. RFC 3501 IMAPv4 March 2003
  2420. information-only message; the nature of the information MAY be
  2421. indicated by a response code.
  2422. The untagged form is also used as one of three possible greetings
  2423. at connection startup. It indicates that the connection is not
  2424. yet authenticated and that a LOGIN command is needed.
  2425. Example: S: * OK IMAP4rev1 server ready
  2426. C: A001 LOGIN fred blurdybloop
  2427. S: * OK [ALERT] System shutdown in 10 minutes
  2428. S: A001 OK LOGIN Completed
  2429. 7.1.2. NO Response
  2430. Contents: OPTIONAL response code
  2431. human-readable text
  2432. The NO response indicates an operational error message from the
  2433. server. When tagged, it indicates unsuccessful completion of the
  2434. associated command. The untagged form indicates a warning; the
  2435. command can still complete successfully. The human-readable text
  2436. describes the condition.
  2437. Example: C: A222 COPY 1:2 owatagusiam
  2438. S: * NO Disk is 98% full, please delete unnecessary data
  2439. S: A222 OK COPY completed
  2440. C: A223 COPY 3:200 blurdybloop
  2441. S: * NO Disk is 98% full, please delete unnecessary data
  2442. S: * NO Disk is 99% full, please delete unnecessary data
  2443. S: A223 NO COPY failed: disk is full
  2444. 7.1.3. BAD Response
  2445. Contents: OPTIONAL response code
  2446. human-readable text
  2447. The BAD response indicates an error message from the server. When
  2448. tagged, it reports a protocol-level error in the client's command;
  2449. the tag indicates the command that caused the error. The untagged
  2450. form indicates a protocol-level error for which the associated
  2451. command can not be determined; it can also indicate an internal
  2452. server failure. The human-readable text describes the condition.
  2453. Crispin Standards Track [Page 66]
  2454. RFC 3501 IMAPv4 March 2003
  2455. Example: C: ...very long command line...
  2456. S: * BAD Command line too long
  2457. C: ...empty line...
  2458. S: * BAD Empty command line
  2459. C: A443 EXPUNGE
  2460. S: * BAD Disk crash, attempting salvage to a new disk!
  2461. S: * OK Salvage successful, no data lost
  2462. S: A443 OK Expunge completed
  2463. 7.1.4. PREAUTH Response
  2464. Contents: OPTIONAL response code
  2465. human-readable text
  2466. The PREAUTH response is always untagged, and is one of three
  2467. possible greetings at connection startup. It indicates that the
  2468. connection has already been authenticated by external means; thus
  2469. no LOGIN command is needed.
  2470. Example: S: * PREAUTH IMAP4rev1 server logged in as Smith
  2471. 7.1.5. BYE Response
  2472. Contents: OPTIONAL response code
  2473. human-readable text
  2474. The BYE response is always untagged, and indicates that the server
  2475. is about to close the connection. The human-readable text MAY be
  2476. displayed to the user in a status report by the client. The BYE
  2477. response is sent under one of four conditions:
  2478. 1) as part of a normal logout sequence. The server will close
  2479. the connection after sending the tagged OK response to the
  2480. LOGOUT command.
  2481. 2) as a panic shutdown announcement. The server closes the
  2482. connection immediately.
  2483. 3) as an announcement of an inactivity autologout. The server
  2484. closes the connection immediately.
  2485. 4) as one of three possible greetings at connection startup,
  2486. indicating that the server is not willing to accept a
  2487. connection from this client. The server closes the
  2488. connection immediately.
  2489. Crispin Standards Track [Page 67]
  2490. RFC 3501 IMAPv4 March 2003
  2491. The difference between a BYE that occurs as part of a normal
  2492. LOGOUT sequence (the first case) and a BYE that occurs because of
  2493. a failure (the other three cases) is that the connection closes
  2494. immediately in the failure case. In all cases the client SHOULD
  2495. continue to read response data from the server until the
  2496. connection is closed; this will ensure that any pending untagged
  2497. or completion responses are read and processed.
  2498. Example: S: * BYE Autologout; idle for too long
  2499. 7.2. Server Responses - Server and Mailbox Status
  2500. These responses are always untagged. This is how server and mailbox
  2501. status data are transmitted from the server to the client. Many of
  2502. these responses typically result from a command with the same name.
  2503. 7.2.1. CAPABILITY Response
  2504. Contents: capability listing
  2505. The CAPABILITY response occurs as a result of a CAPABILITY
  2506. command. The capability listing contains a space-separated
  2507. listing of capability names that the server supports. The
  2508. capability listing MUST include the atom "IMAP4rev1".
  2509. In addition, client and server implementations MUST implement the
  2510. STARTTLS, LOGINDISABLED, and AUTH=PLAIN (described in [IMAP-TLS])
  2511. capabilities. See the Security Considerations section for
  2512. important information.
  2513. A capability name which begins with "AUTH=" indicates that the
  2514. server supports that particular authentication mechanism.
  2515. The LOGINDISABLED capability indicates that the LOGIN command is
  2516. disabled, and that the server will respond with a tagged NO
  2517. response to any attempt to use the LOGIN command even if the user
  2518. name and password are valid. An IMAP client MUST NOT issue the
  2519. LOGIN command if the server advertises the LOGINDISABLED
  2520. capability.
  2521. Other capability names indicate that the server supports an
  2522. extension, revision, or amendment to the IMAP4rev1 protocol.
  2523. Server responses MUST conform to this document until the client
  2524. issues a command that uses the associated capability.
  2525. Capability names MUST either begin with "X" or be standard or
  2526. standards-track IMAP4rev1 extensions, revisions, or amendments
  2527. registered with IANA. A server MUST NOT offer unregistered or
  2528. Crispin Standards Track [Page 68]
  2529. RFC 3501 IMAPv4 March 2003
  2530. non-standard capability names, unless such names are prefixed with
  2531. an "X".
  2532. Client implementations SHOULD NOT require any capability name
  2533. other than "IMAP4rev1", and MUST ignore any unknown capability
  2534. names.
  2535. A server MAY send capabilities automatically, by using the
  2536. CAPABILITY response code in the initial PREAUTH or OK responses,
  2537. and by sending an updated CAPABILITY response code in the tagged
  2538. OK response as part of a successful authentication. It is
  2539. unnecessary for a client to send a separate CAPABILITY command if
  2540. it recognizes these automatic capabilities.
  2541. Example: S: * CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI XPIG-LATIN
  2542. 7.2.2. LIST Response
  2543. Contents: name attributes
  2544. hierarchy delimiter
  2545. name
  2546. The LIST response occurs as a result of a LIST command. It
  2547. returns a single name that matches the LIST specification. There
  2548. can be multiple LIST responses for a single LIST command.
  2549. Four name attributes are defined:
  2550. \Noinferiors
  2551. It is not possible for any child levels of hierarchy to exist
  2552. under this name; no child levels exist now and none can be
  2553. created in the future.
  2554. \Noselect
  2555. It is not possible to use this name as a selectable mailbox.
  2556. \Marked
  2557. The mailbox has been marked "interesting" by the server; the
  2558. mailbox probably contains messages that have been added since
  2559. the last time the mailbox was selected.
  2560. \Unmarked
  2561. The mailbox does not contain any additional messages since the
  2562. last time the mailbox was selected.
  2563. Crispin Standards Track [Page 69]
  2564. RFC 3501 IMAPv4 March 2003
  2565. If it is not feasible for the server to determine whether or not
  2566. the mailbox is "interesting", or if the name is a \Noselect name,
  2567. the server SHOULD NOT send either \Marked or \Unmarked.
  2568. The hierarchy delimiter is a character used to delimit levels of
  2569. hierarchy in a mailbox name. A client can use it to create child
  2570. mailboxes, and to search higher or lower levels of naming
  2571. hierarchy. All children of a top-level hierarchy node MUST use
  2572. the same separator character. A NIL hierarchy delimiter means
  2573. that no hierarchy exists; the name is a "flat" name.
  2574. The name represents an unambiguous left-to-right hierarchy, and
  2575. MUST be valid for use as a reference in LIST and LSUB commands.
  2576. Unless \Noselect is indicated, the name MUST also be valid as an
  2577. argument for commands, such as SELECT, that accept mailbox names.
  2578. Example: S: * LIST (\Noselect) "/" ~/Mail/foo
  2579. 7.2.3. LSUB Response
  2580. Contents: name attributes
  2581. hierarchy delimiter
  2582. name
  2583. The LSUB response occurs as a result of an LSUB command. It
  2584. returns a single name that matches the LSUB specification. There
  2585. can be multiple LSUB responses for a single LSUB command. The
  2586. data is identical in format to the LIST response.
  2587. Example: S: * LSUB () "." #news.comp.mail.misc
  2588. 7.2.4 STATUS Response
  2589. Contents: name
  2590. status parenthesized list
  2591. The STATUS response occurs as a result of an STATUS command. It
  2592. returns the mailbox name that matches the STATUS specification and
  2593. the requested mailbox status information.
  2594. Example: S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292)
  2595. Crispin Standards Track [Page 70]
  2596. RFC 3501 IMAPv4 March 2003
  2597. 7.2.5. SEARCH Response
  2598. Contents: zero or more numbers
  2599. The SEARCH response occurs as a result of a SEARCH or UID SEARCH
  2600. command. The number(s) refer to those messages that match the
  2601. search criteria. For SEARCH, these are message sequence numbers;
  2602. for UID SEARCH, these are unique identifiers. Each number is
  2603. delimited by a space.
  2604. Example: S: * SEARCH 2 3 6
  2605. 7.2.6. FLAGS Response
  2606. Contents: flag parenthesized list
  2607. The FLAGS response occurs as a result of a SELECT or EXAMINE
  2608. command. The flag parenthesized list identifies the flags (at a
  2609. minimum, the system-defined flags) that are applicable for this
  2610. mailbox. Flags other than the system flags can also exist,
  2611. depending on server implementation.
  2612. The update from the FLAGS response MUST be recorded by the client.
  2613. Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  2614. 7.3. Server Responses - Mailbox Size
  2615. These responses are always untagged. This is how changes in the size
  2616. of the mailbox are transmitted from the server to the client.
  2617. Immediately following the "*" token is a number that represents a
  2618. message count.
  2619. 7.3.1. EXISTS Response
  2620. Contents: none
  2621. The EXISTS response reports the number of messages in the mailbox.
  2622. This response occurs as a result of a SELECT or EXAMINE command,
  2623. and if the size of the mailbox changes (e.g., new messages).
  2624. The update from the EXISTS response MUST be recorded by the
  2625. client.
  2626. Example: S: * 23 EXISTS
  2627. Crispin Standards Track [Page 71]
  2628. RFC 3501 IMAPv4 March 2003
  2629. 7.3.2. RECENT Response
  2630. Contents: none
  2631. The RECENT response reports the number of messages with the
  2632. \Recent flag set. This response occurs as a result of a SELECT or
  2633. EXAMINE command, and if the size of the mailbox changes (e.g., new
  2634. messages).
  2635. Note: It is not guaranteed that the message sequence
  2636. numbers of recent messages will be a contiguous range of
  2637. the highest n messages in the mailbox (where n is the
  2638. value reported by the RECENT response). Examples of
  2639. situations in which this is not the case are: multiple
  2640. clients having the same mailbox open (the first session
  2641. to be notified will see it as recent, others will
  2642. probably see it as non-recent), and when the mailbox is
  2643. re-ordered by a non-IMAP agent.
  2644. The only reliable way to identify recent messages is to
  2645. look at message flags to see which have the \Recent flag
  2646. set, or to do a SEARCH RECENT.
  2647. The update from the RECENT response MUST be recorded by the
  2648. client.
  2649. Example: S: * 5 RECENT
  2650. 7.4. Server Responses - Message Status
  2651. These responses are always untagged. This is how message data are
  2652. transmitted from the server to the client, often as a result of a
  2653. command with the same name. Immediately following the "*" token is a
  2654. number that represents a message sequence number.
  2655. 7.4.1. EXPUNGE Response
  2656. Contents: none
  2657. The EXPUNGE response reports that the specified message sequence
  2658. number has been permanently removed from the mailbox. The message
  2659. sequence number for each successive message in the mailbox is
  2660. immediately decremented by 1, and this decrement is reflected in
  2661. message sequence numbers in subsequent responses (including other
  2662. untagged EXPUNGE responses).
  2663. Crispin Standards Track [Page 72]
  2664. RFC 3501 IMAPv4 March 2003
  2665. The EXPUNGE response also decrements the number of messages in the
  2666. mailbox; it is not necessary to send an EXISTS response with the
  2667. new value.
  2668. As a result of the immediate decrement rule, message sequence
  2669. numbers that appear in a set of successive EXPUNGE responses
  2670. depend upon whether the messages are removed starting from lower
  2671. numbers to higher numbers, or from higher numbers to lower
  2672. numbers. For example, if the last 5 messages in a 9-message
  2673. mailbox are expunged, a "lower to higher" server will send five
  2674. untagged EXPUNGE responses for message sequence number 5, whereas
  2675. a "higher to lower server" will send successive untagged EXPUNGE
  2676. responses for message sequence numbers 9, 8, 7, 6, and 5.
  2677. An EXPUNGE response MUST NOT be sent when no command is in
  2678. progress, nor while responding to a FETCH, STORE, or SEARCH
  2679. command. This rule is necessary to prevent a loss of
  2680. synchronization of message sequence numbers between client and
  2681. server. A command is not "in progress" until the complete command
  2682. has been received; in particular, a command is not "in progress"
  2683. during the negotiation of command continuation.
  2684. Note: UID FETCH, UID STORE, and UID SEARCH are different
  2685. commands from FETCH, STORE, and SEARCH. An EXPUNGE
  2686. response MAY be sent during a UID command.
  2687. The update from the EXPUNGE response MUST be recorded by the
  2688. client.
  2689. Example: S: * 44 EXPUNGE
  2690. 7.4.2. FETCH Response
  2691. Contents: message data
  2692. The FETCH response returns data about a message to the client.
  2693. The data are pairs of data item names and their values in
  2694. parentheses. This response occurs as the result of a FETCH or
  2695. STORE command, as well as by unilateral server decision (e.g.,
  2696. flag updates).
  2697. The current data items are:
  2698. BODY
  2699. A form of BODYSTRUCTURE without extension data.
  2700. Crispin Standards Track [Page 73]
  2701. RFC 3501 IMAPv4 March 2003
  2702. BODY[<section>]<<origin octet>>
  2703. A string expressing the body contents of the specified section.
  2704. The string SHOULD be interpreted by the client according to the
  2705. content transfer encoding, body type, and subtype.
  2706. If the origin octet is specified, this string is a substring of
  2707. the entire body contents, starting at that origin octet. This
  2708. means that BODY[]<0> MAY be truncated, but BODY[] is NEVER
  2709. truncated.
  2710. Note: The origin octet facility MUST NOT be used by a server
  2711. in a FETCH response unless the client specifically requested
  2712. it by means of a FETCH of a BODY[<section>]<<partial>> data
  2713. item.
  2714. 8-bit textual data is permitted if a [CHARSET] identifier is
  2715. part of the body parameter parenthesized list for this section.
  2716. Note that headers (part specifiers HEADER or MIME, or the
  2717. header portion of a MESSAGE/RFC822 part), MUST be 7-bit; 8-bit
  2718. characters are not permitted in headers. Note also that the
  2719. [RFC-2822] delimiting blank line between the header and the
  2720. body is not affected by header line subsetting; the blank line
  2721. is always included as part of header data, except in the case
  2722. of a message which has no body and no blank line.
  2723. Non-textual data such as binary data MUST be transfer encoded
  2724. into a textual form, such as BASE64, prior to being sent to the
  2725. client. To derive the original binary data, the client MUST
  2726. decode the transfer encoded string.
  2727. BODYSTRUCTURE
  2728. A parenthesized list that describes the [MIME-IMB] body
  2729. structure of a message. This is computed by the server by
  2730. parsing the [MIME-IMB] header fields, defaulting various fields
  2731. as necessary.
  2732. For example, a simple text message of 48 lines and 2279 octets
  2733. can have a body structure of: ("TEXT" "PLAIN" ("CHARSET"
  2734. "US-ASCII") NIL NIL "7BIT" 2279 48)
  2735. Multiple parts are indicated by parenthesis nesting. Instead
  2736. of a body type as the first element of the parenthesized list,
  2737. there is a sequence of one or more nested body structures. The
  2738. second element of the parenthesized list is the multipart
  2739. subtype (mixed, digest, parallel, alternative, etc.).
  2740. Crispin Standards Track [Page 74]
  2741. RFC 3501 IMAPv4 March 2003
  2742. For example, a two part message consisting of a text and a
  2743. BASE64-encoded text attachment can have a body structure of:
  2744. (("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1152
  2745. 23)("TEXT" "PLAIN" ("CHARSET" "US-ASCII" "NAME" "cc.diff")
  2746. "<960723163407.20117h@cac.washington.edu>" "Compiler diff"
  2747. "BASE64" 4554 73) "MIXED")
  2748. Extension data follows the multipart subtype. Extension data
  2749. is never returned with the BODY fetch, but can be returned with
  2750. a BODYSTRUCTURE fetch. Extension data, if present, MUST be in
  2751. the defined order. The extension data of a multipart body part
  2752. are in the following order:
  2753. body parameter parenthesized list
  2754. A parenthesized list of attribute/value pairs [e.g., ("foo"
  2755. "bar" "baz" "rag") where "bar" is the value of "foo", and
  2756. "rag" is the value of "baz"] as defined in [MIME-IMB].
  2757. body disposition
  2758. A parenthesized list, consisting of a disposition type
  2759. string, followed by a parenthesized list of disposition
  2760. attribute/value pairs as defined in [DISPOSITION].
  2761. body language
  2762. A string or parenthesized list giving the body language
  2763. value as defined in [LANGUAGE-TAGS].
  2764. body location
  2765. A string list giving the body content URI as defined in
  2766. [LOCATION].
  2767. Any following extension data are not yet defined in this
  2768. version of the protocol. Such extension data can consist of
  2769. zero or more NILs, strings, numbers, or potentially nested
  2770. parenthesized lists of such data. Client implementations that
  2771. do a BODYSTRUCTURE fetch MUST be prepared to accept such
  2772. extension data. Server implementations MUST NOT send such
  2773. extension data until it has been defined by a revision of this
  2774. protocol.
  2775. The basic fields of a non-multipart body part are in the
  2776. following order:
  2777. body type
  2778. A string giving the content media type name as defined in
  2779. [MIME-IMB].
  2780. Crispin Standards Track [Page 75]
  2781. RFC 3501 IMAPv4 March 2003
  2782. body subtype
  2783. A string giving the content subtype name as defined in
  2784. [MIME-IMB].
  2785. body parameter parenthesized list
  2786. A parenthesized list of attribute/value pairs [e.g., ("foo"
  2787. "bar" "baz" "rag") where "bar" is the value of "foo" and
  2788. "rag" is the value of "baz"] as defined in [MIME-IMB].
  2789. body id
  2790. A string giving the content id as defined in [MIME-IMB].
  2791. body description
  2792. A string giving the content description as defined in
  2793. [MIME-IMB].
  2794. body encoding
  2795. A string giving the content transfer encoding as defined in
  2796. [MIME-IMB].
  2797. body size
  2798. A number giving the size of the body in octets. Note that
  2799. this size is the size in its transfer encoding and not the
  2800. resulting size after any decoding.
  2801. A body type of type MESSAGE and subtype RFC822 contains,
  2802. immediately after the basic fields, the envelope structure,
  2803. body structure, and size in text lines of the encapsulated
  2804. message.
  2805. A body type of type TEXT contains, immediately after the basic
  2806. fields, the size of the body in text lines. Note that this
  2807. size is the size in its content transfer encoding and not the
  2808. resulting size after any decoding.
  2809. Extension data follows the basic fields and the type-specific
  2810. fields listed above. Extension data is never returned with the
  2811. BODY fetch, but can be returned with a BODYSTRUCTURE fetch.
  2812. Extension data, if present, MUST be in the defined order.
  2813. The extension data of a non-multipart body part are in the
  2814. following order:
  2815. body MD5
  2816. A string giving the body MD5 value as defined in [MD5].
  2817. Crispin Standards Track [Page 76]
  2818. RFC 3501 IMAPv4 March 2003
  2819. body disposition
  2820. A parenthesized list with the same content and function as
  2821. the body disposition for a multipart body part.
  2822. body language
  2823. A string or parenthesized list giving the body language
  2824. value as defined in [LANGUAGE-TAGS].
  2825. body location
  2826. A string list giving the body content URI as defined in
  2827. [LOCATION].
  2828. Any following extension data are not yet defined in this
  2829. version of the protocol, and would be as described above under
  2830. multipart extension data.
  2831. ENVELOPE
  2832. A parenthesized list that describes the envelope structure of a
  2833. message. This is computed by the server by parsing the
  2834. [RFC-2822] header into the component parts, defaulting various
  2835. fields as necessary.
  2836. The fields of the envelope structure are in the following
  2837. order: date, subject, from, sender, reply-to, to, cc, bcc,
  2838. in-reply-to, and message-id. The date, subject, in-reply-to,
  2839. and message-id fields are strings. The from, sender, reply-to,
  2840. to, cc, and bcc fields are parenthesized lists of address
  2841. structures.
  2842. An address structure is a parenthesized list that describes an
  2843. electronic mail address. The fields of an address structure
  2844. are in the following order: personal name, [SMTP]
  2845. at-domain-list (source route), mailbox name, and host name.
  2846. [RFC-2822] group syntax is indicated by a special form of
  2847. address structure in which the host name field is NIL. If the
  2848. mailbox name field is also NIL, this is an end of group marker
  2849. (semi-colon in RFC 822 syntax). If the mailbox name field is
  2850. non-NIL, this is a start of group marker, and the mailbox name
  2851. field holds the group name phrase.
  2852. If the Date, Subject, In-Reply-To, and Message-ID header lines
  2853. are absent in the [RFC-2822] header, the corresponding member
  2854. of the envelope is NIL; if these header lines are present but
  2855. empty the corresponding member of the envelope is the empty
  2856. string.
  2857. Crispin Standards Track [Page 77]
  2858. RFC 3501 IMAPv4 March 2003
  2859. Note: some servers may return a NIL envelope member in the
  2860. "present but empty" case. Clients SHOULD treat NIL and
  2861. empty string as identical.
  2862. Note: [RFC-2822] requires that all messages have a valid
  2863. Date header. Therefore, the date member in the envelope can
  2864. not be NIL or the empty string.
  2865. Note: [RFC-2822] requires that the In-Reply-To and
  2866. Message-ID headers, if present, have non-empty content.
  2867. Therefore, the in-reply-to and message-id members in the
  2868. envelope can not be the empty string.
  2869. If the From, To, cc, and bcc header lines are absent in the
  2870. [RFC-2822] header, or are present but empty, the corresponding
  2871. member of the envelope is NIL.
  2872. If the Sender or Reply-To lines are absent in the [RFC-2822]
  2873. header, or are present but empty, the server sets the
  2874. corresponding member of the envelope to be the same value as
  2875. the from member (the client is not expected to know to do
  2876. this).
  2877. Note: [RFC-2822] requires that all messages have a valid
  2878. From header. Therefore, the from, sender, and reply-to
  2879. members in the envelope can not be NIL.
  2880. FLAGS
  2881. A parenthesized list of flags that are set for this message.
  2882. INTERNALDATE
  2883. A string representing the internal date of the message.
  2884. RFC822
  2885. Equivalent to BODY[].
  2886. RFC822.HEADER
  2887. Equivalent to BODY[HEADER]. Note that this did not result in
  2888. \Seen being set, because RFC822.HEADER response data occurs as
  2889. a result of a FETCH of RFC822.HEADER. BODY[HEADER] response
  2890. data occurs as a result of a FETCH of BODY[HEADER] (which sets
  2891. \Seen) or BODY.PEEK[HEADER] (which does not set \Seen).
  2892. RFC822.SIZE
  2893. A number expressing the [RFC-2822] size of the message.
  2894. Crispin Standards Track [Page 78]
  2895. RFC 3501 IMAPv4 March 2003
  2896. RFC822.TEXT
  2897. Equivalent to BODY[TEXT].
  2898. UID
  2899. A number expressing the unique identifier of the message.
  2900. Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827)
  2901. 7.5. Server Responses - Command Continuation Request
  2902. The command continuation request response is indicated by a "+" token
  2903. instead of a tag. This form of response indicates that the server is
  2904. ready to accept the continuation of a command from the client. The
  2905. remainder of this response is a line of text.
  2906. This response is used in the AUTHENTICATE command to transmit server
  2907. data to the client, and request additional client data. This
  2908. response is also used if an argument to any command is a literal.
  2909. The client is not permitted to send the octets of the literal unless
  2910. the server indicates that it is expected. This permits the server to
  2911. process commands and reject errors on a line-by-line basis. The
  2912. remainder of the command, including the CRLF that terminates a
  2913. command, follows the octets of the literal. If there are any
  2914. additional command arguments, the literal octets are followed by a
  2915. space and those arguments.
  2916. Example: C: A001 LOGIN {11}
  2917. S: + Ready for additional command text
  2918. C: FRED FOOBAR {7}
  2919. S: + Ready for additional command text
  2920. C: fat man
  2921. S: A001 OK LOGIN completed
  2922. C: A044 BLURDYBLOOP {102856}
  2923. S: A044 BAD No such command as "BLURDYBLOOP"
  2924. Crispin Standards Track [Page 79]
  2925. RFC 3501 IMAPv4 March 2003
  2926. 8. Sample IMAP4rev1 connection
  2927. The following is a transcript of an IMAP4rev1 connection. A long
  2928. line in this sample is broken for editorial clarity.
  2929. S: * OK IMAP4rev1 Service Ready
  2930. C: a001 login mrc secret
  2931. S: a001 OK LOGIN completed
  2932. C: a002 select inbox
  2933. S: * 18 EXISTS
  2934. S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  2935. S: * 2 RECENT
  2936. S: * OK [UNSEEN 17] Message 17 is the first unseen message
  2937. S: * OK [UIDVALIDITY 3857529045] UIDs valid
  2938. S: a002 OK [READ-WRITE] SELECT completed
  2939. C: a003 fetch 12 full
  2940. S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700"
  2941. RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)"
  2942. "IMAP4rev1 WG mtg summary and minutes"
  2943. (("Terry Gray" NIL "gray" "cac.washington.edu"))
  2944. (("Terry Gray" NIL "gray" "cac.washington.edu"))
  2945. (("Terry Gray" NIL "gray" "cac.washington.edu"))
  2946. ((NIL NIL "imap" "cac.washington.edu"))
  2947. ((NIL NIL "minutes" "CNRI.Reston.VA.US")
  2948. ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL
  2949. "<B27397-0100000@cac.washington.edu>")
  2950. BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028
  2951. 92))
  2952. S: a003 OK FETCH completed
  2953. C: a004 fetch 12 body[header]
  2954. S: * 12 FETCH (BODY[HEADER] {342}
  2955. S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT)
  2956. S: From: Terry Gray <gray@cac.washington.edu>
  2957. S: Subject: IMAP4rev1 WG mtg summary and minutes
  2958. S: To: imap@cac.washington.edu
  2959. S: cc: minutes@CNRI.Reston.VA.US, John Klensin <KLENSIN@MIT.EDU>
  2960. S: Message-Id: <B27397-0100000@cac.washington.edu>
  2961. S: MIME-Version: 1.0
  2962. S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  2963. S:
  2964. S: )
  2965. S: a004 OK FETCH completed
  2966. C: a005 store 12 +flags \deleted
  2967. S: * 12 FETCH (FLAGS (\Seen \Deleted))
  2968. S: a005 OK +FLAGS completed
  2969. C: a006 logout
  2970. S: * BYE IMAP4rev1 server terminating connection
  2971. S: a006 OK LOGOUT completed
  2972. Crispin Standards Track [Page 80]
  2973. RFC 3501 IMAPv4 March 2003
  2974. 9. Formal Syntax
  2975. The following syntax specification uses the Augmented Backus-Naur
  2976. Form (ABNF) notation as specified in [ABNF].
  2977. In the case of alternative or optional rules in which a later rule
  2978. overlaps an earlier rule, the rule which is listed earlier MUST take
  2979. priority. For example, "\Seen" when parsed as a flag is the \Seen
  2980. flag name and not a flag-extension, even though "\Seen" can be parsed
  2981. as a flag-extension. Some, but not all, instances of this rule are
  2982. noted below.
  2983. Note: [ABNF] rules MUST be followed strictly; in
  2984. particular:
  2985. (1) Except as noted otherwise, all alphabetic characters
  2986. are case-insensitive. The use of upper or lower case
  2987. characters to define token strings is for editorial clarity
  2988. only. Implementations MUST accept these strings in a
  2989. case-insensitive fashion.
  2990. (2) In all cases, SP refers to exactly one space. It is
  2991. NOT permitted to substitute TAB, insert additional spaces,
  2992. or otherwise treat SP as being equivalent to LWSP.
  2993. (3) The ASCII NUL character, %x00, MUST NOT be used at any
  2994. time.
  2995. address = "(" addr-name SP addr-adl SP addr-mailbox SP
  2996. addr-host ")"
  2997. addr-adl = nstring
  2998. ; Holds route from [RFC-2822] route-addr if
  2999. ; non-NIL
  3000. addr-host = nstring
  3001. ; NIL indicates [RFC-2822] group syntax.
  3002. ; Otherwise, holds [RFC-2822] domain name
  3003. addr-mailbox = nstring
  3004. ; NIL indicates end of [RFC-2822] group; if
  3005. ; non-NIL and addr-host is NIL, holds
  3006. ; [RFC-2822] group name.
  3007. ; Otherwise, holds [RFC-2822] local-part
  3008. ; after removing [RFC-2822] quoting
  3009. Crispin Standards Track [Page 81]
  3010. RFC 3501 IMAPv4 March 2003
  3011. addr-name = nstring
  3012. ; If non-NIL, holds phrase from [RFC-2822]
  3013. ; mailbox after removing [RFC-2822] quoting
  3014. append = "APPEND" SP mailbox [SP flag-list] [SP date-time] SP
  3015. literal
  3016. astring = 1*ASTRING-CHAR / string
  3017. ASTRING-CHAR = ATOM-CHAR / resp-specials
  3018. atom = 1*ATOM-CHAR
  3019. ATOM-CHAR = <any CHAR except atom-specials>
  3020. atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards /
  3021. quoted-specials / resp-specials
  3022. authenticate = "AUTHENTICATE" SP auth-type *(CRLF base64)
  3023. auth-type = atom
  3024. ; Defined by [SASL]
  3025. base64 = *(4base64-char) [base64-terminal]
  3026. base64-char = ALPHA / DIGIT / "+" / "/"
  3027. ; Case-sensitive
  3028. base64-terminal = (2base64-char "==") / (3base64-char "=")
  3029. body = "(" (body-type-1part / body-type-mpart) ")"
  3030. body-extension = nstring / number /
  3031. "(" body-extension *(SP body-extension) ")"
  3032. ; Future expansion. Client implementations
  3033. ; MUST accept body-extension fields. Server
  3034. ; implementations MUST NOT generate
  3035. ; body-extension fields except as defined by
  3036. ; future standard or standards-track
  3037. ; revisions of this specification.
  3038. body-ext-1part = body-fld-md5 [SP body-fld-dsp [SP body-fld-lang
  3039. [SP body-fld-loc *(SP body-extension)]]]
  3040. ; MUST NOT be returned on non-extensible
  3041. ; "BODY" fetch
  3042. Crispin Standards Track [Page 82]
  3043. RFC 3501 IMAPv4 March 2003
  3044. body-ext-mpart = body-fld-param [SP body-fld-dsp [SP body-fld-lang
  3045. [SP body-fld-loc *(SP body-extension)]]]
  3046. ; MUST NOT be returned on non-extensible
  3047. ; "BODY" fetch
  3048. body-fields = body-fld-param SP body-fld-id SP body-fld-desc SP
  3049. body-fld-enc SP body-fld-octets
  3050. body-fld-desc = nstring
  3051. body-fld-dsp = "(" string SP body-fld-param ")" / nil
  3052. body-fld-enc = (DQUOTE ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
  3053. "QUOTED-PRINTABLE") DQUOTE) / string
  3054. body-fld-id = nstring
  3055. body-fld-lang = nstring / "(" string *(SP string) ")"
  3056. body-fld-loc = nstring
  3057. body-fld-lines = number
  3058. body-fld-md5 = nstring
  3059. body-fld-octets = number
  3060. body-fld-param = "(" string SP string *(SP string SP string) ")" / nil
  3061. body-type-1part = (body-type-basic / body-type-msg / body-type-text)
  3062. [SP body-ext-1part]
  3063. body-type-basic = media-basic SP body-fields
  3064. ; MESSAGE subtype MUST NOT be "RFC822"
  3065. body-type-mpart = 1*body SP media-subtype
  3066. [SP body-ext-mpart]
  3067. body-type-msg = media-message SP body-fields SP envelope
  3068. SP body SP body-fld-lines
  3069. body-type-text = media-text SP body-fields SP body-fld-lines
  3070. capability = ("AUTH=" auth-type) / atom
  3071. ; New capabilities MUST begin with "X" or be
  3072. ; registered with IANA as standard or
  3073. ; standards-track
  3074. Crispin Standards Track [Page 83]
  3075. RFC 3501 IMAPv4 March 2003
  3076. capability-data = "CAPABILITY" *(SP capability) SP "IMAP4rev1"
  3077. *(SP capability)
  3078. ; Servers MUST implement the STARTTLS, AUTH=PLAIN,
  3079. ; and LOGINDISABLED capabilities
  3080. ; Servers which offer RFC 1730 compatibility MUST
  3081. ; list "IMAP4" as the first capability.
  3082. CHAR8 = %x01-ff
  3083. ; any OCTET except NUL, %x00
  3084. command = tag SP (command-any / command-auth / command-nonauth /
  3085. command-select) CRLF
  3086. ; Modal based on state
  3087. command-any = "CAPABILITY" / "LOGOUT" / "NOOP" / x-command
  3088. ; Valid in all states
  3089. command-auth = append / create / delete / examine / list / lsub /
  3090. rename / select / status / subscribe / unsubscribe
  3091. ; Valid only in Authenticated or Selected state
  3092. command-nonauth = login / authenticate / "STARTTLS"
  3093. ; Valid only when in Not Authenticated state
  3094. command-select = "CHECK" / "CLOSE" / "EXPUNGE" / copy / fetch / store /
  3095. uid / search
  3096. ; Valid only when in Selected state
  3097. continue-req = "+" SP (resp-text / base64) CRLF
  3098. copy = "COPY" SP sequence-set SP mailbox
  3099. create = "CREATE" SP mailbox
  3100. ; Use of INBOX gives a NO error
  3101. date = date-text / DQUOTE date-text DQUOTE
  3102. date-day = 1*2DIGIT
  3103. ; Day of month
  3104. date-day-fixed = (SP DIGIT) / 2DIGIT
  3105. ; Fixed-format version of date-day
  3106. date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
  3107. "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
  3108. date-text = date-day "-" date-month "-" date-year
  3109. Crispin Standards Track [Page 84]
  3110. RFC 3501 IMAPv4 March 2003
  3111. date-year = 4DIGIT
  3112. date-time = DQUOTE date-day-fixed "-" date-month "-" date-year
  3113. SP time SP zone DQUOTE
  3114. delete = "DELETE" SP mailbox
  3115. ; Use of INBOX gives a NO error
  3116. digit-nz = %x31-39
  3117. ; 1-9
  3118. envelope = "(" env-date SP env-subject SP env-from SP
  3119. env-sender SP env-reply-to SP env-to SP env-cc SP
  3120. env-bcc SP env-in-reply-to SP env-message-id ")"
  3121. env-bcc = "(" 1*address ")" / nil
  3122. env-cc = "(" 1*address ")" / nil
  3123. env-date = nstring
  3124. env-from = "(" 1*address ")" / nil
  3125. env-in-reply-to = nstring
  3126. env-message-id = nstring
  3127. env-reply-to = "(" 1*address ")" / nil
  3128. env-sender = "(" 1*address ")" / nil
  3129. env-subject = nstring
  3130. env-to = "(" 1*address ")" / nil
  3131. examine = "EXAMINE" SP mailbox
  3132. fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" /
  3133. fetch-att / "(" fetch-att *(SP fetch-att) ")")
  3134. fetch-att = "ENVELOPE" / "FLAGS" / "INTERNALDATE" /
  3135. "RFC822" [".HEADER" / ".SIZE" / ".TEXT"] /
  3136. "BODY" ["STRUCTURE"] / "UID" /
  3137. "BODY" section ["<" number "." nz-number ">"] /
  3138. "BODY.PEEK" section ["<" number "." nz-number ">"]
  3139. Crispin Standards Track [Page 85]
  3140. RFC 3501 IMAPv4 March 2003
  3141. flag = "\Answered" / "\Flagged" / "\Deleted" /
  3142. "\Seen" / "\Draft" / flag-keyword / flag-extension
  3143. ; Does not include "\Recent"
  3144. flag-extension = "\" atom
  3145. ; Future expansion. Client implementations
  3146. ; MUST accept flag-extension flags. Server
  3147. ; implementations MUST NOT generate
  3148. ; flag-extension flags except as defined by
  3149. ; future standard or standards-track
  3150. ; revisions of this specification.
  3151. flag-fetch = flag / "\Recent"
  3152. flag-keyword = atom
  3153. flag-list = "(" [flag *(SP flag)] ")"
  3154. flag-perm = flag / "\*"
  3155. greeting = "*" SP (resp-cond-auth / resp-cond-bye) CRLF
  3156. header-fld-name = astring
  3157. header-list = "(" header-fld-name *(SP header-fld-name) ")"
  3158. list = "LIST" SP mailbox SP list-mailbox
  3159. list-mailbox = 1*list-char / string
  3160. list-char = ATOM-CHAR / list-wildcards / resp-specials
  3161. list-wildcards = "%" / "*"
  3162. literal = "{" number "}" CRLF *CHAR8
  3163. ; Number represents the number of CHAR8s
  3164. login = "LOGIN" SP userid SP password
  3165. lsub = "LSUB" SP mailbox SP list-mailbox
  3166. Crispin Standards Track [Page 86]
  3167. RFC 3501 IMAPv4 March 2003
  3168. mailbox = "INBOX" / astring
  3169. ; INBOX is case-insensitive. All case variants of
  3170. ; INBOX (e.g., "iNbOx") MUST be interpreted as INBOX
  3171. ; not as an astring. An astring which consists of
  3172. ; the case-insensitive sequence "I" "N" "B" "O" "X"
  3173. ; is considered to be INBOX and not an astring.
  3174. ; Refer to section 5.1 for further
  3175. ; semantic details of mailbox names.
  3176. mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list /
  3177. "LSUB" SP mailbox-list / "SEARCH" *(SP nz-number) /
  3178. "STATUS" SP mailbox SP "(" [status-att-list] ")" /
  3179. number SP "EXISTS" / number SP "RECENT"
  3180. mailbox-list = "(" [mbx-list-flags] ")" SP
  3181. (DQUOTE QUOTED-CHAR DQUOTE / nil) SP mailbox
  3182. mbx-list-flags = *(mbx-list-oflag SP) mbx-list-sflag
  3183. *(SP mbx-list-oflag) /
  3184. mbx-list-oflag *(SP mbx-list-oflag)
  3185. mbx-list-oflag = "\Noinferiors" / flag-extension
  3186. ; Other flags; multiple possible per LIST response
  3187. mbx-list-sflag = "\Noselect" / "\Marked" / "\Unmarked"
  3188. ; Selectability flags; only one per LIST response
  3189. media-basic = ((DQUOTE ("APPLICATION" / "AUDIO" / "IMAGE" /
  3190. "MESSAGE" / "VIDEO") DQUOTE) / string) SP
  3191. media-subtype
  3192. ; Defined in [MIME-IMT]
  3193. media-message = DQUOTE "MESSAGE" DQUOTE SP DQUOTE "RFC822" DQUOTE
  3194. ; Defined in [MIME-IMT]
  3195. media-subtype = string
  3196. ; Defined in [MIME-IMT]
  3197. media-text = DQUOTE "TEXT" DQUOTE SP media-subtype
  3198. ; Defined in [MIME-IMT]
  3199. message-data = nz-number SP ("EXPUNGE" / ("FETCH" SP msg-att))
  3200. msg-att = "(" (msg-att-dynamic / msg-att-static)
  3201. *(SP (msg-att-dynamic / msg-att-static)) ")"
  3202. msg-att-dynamic = "FLAGS" SP "(" [flag-fetch *(SP flag-fetch)] ")"
  3203. ; MAY change for a message
  3204. Crispin Standards Track [Page 87]
  3205. RFC 3501 IMAPv4 March 2003
  3206. msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time /
  3207. "RFC822" [".HEADER" / ".TEXT"] SP nstring /
  3208. "RFC822.SIZE" SP number /
  3209. "BODY" ["STRUCTURE"] SP body /
  3210. "BODY" section ["<" number ">"] SP nstring /
  3211. "UID" SP uniqueid
  3212. ; MUST NOT change for a message
  3213. nil = "NIL"
  3214. nstring = string / nil
  3215. number = 1*DIGIT
  3216. ; Unsigned 32-bit integer
  3217. ; (0 <= n < 4,294,967,296)
  3218. nz-number = digit-nz *DIGIT
  3219. ; Non-zero unsigned 32-bit integer
  3220. ; (0 < n < 4,294,967,296)
  3221. password = astring
  3222. quoted = DQUOTE *QUOTED-CHAR DQUOTE
  3223. QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> /
  3224. "\" quoted-specials
  3225. quoted-specials = DQUOTE / "\"
  3226. rename = "RENAME" SP mailbox SP mailbox
  3227. ; Use of INBOX as a destination gives a NO error
  3228. response = *(continue-req / response-data) response-done
  3229. response-data = "*" SP (resp-cond-state / resp-cond-bye /
  3230. mailbox-data / message-data / capability-data) CRLF
  3231. response-done = response-tagged / response-fatal
  3232. response-fatal = "*" SP resp-cond-bye CRLF
  3233. ; Server closes connection immediately
  3234. response-tagged = tag SP resp-cond-state CRLF
  3235. resp-cond-auth = ("OK" / "PREAUTH") SP resp-text
  3236. ; Authentication condition
  3237. Crispin Standards Track [Page 88]
  3238. RFC 3501 IMAPv4 March 2003
  3239. resp-cond-bye = "BYE" SP resp-text
  3240. resp-cond-state = ("OK" / "NO" / "BAD") SP resp-text
  3241. ; Status condition
  3242. resp-specials = "]"
  3243. resp-text = ["[" resp-text-code "]" SP] text
  3244. resp-text-code = "ALERT" /
  3245. "BADCHARSET" [SP "(" astring *(SP astring) ")" ] /
  3246. capability-data / "PARSE" /
  3247. "PERMANENTFLAGS" SP "("
  3248. [flag-perm *(SP flag-perm)] ")" /
  3249. "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
  3250. "UIDNEXT" SP nz-number / "UIDVALIDITY" SP nz-number /
  3251. "UNSEEN" SP nz-number /
  3252. atom [SP 1*<any TEXT-CHAR except "]">]
  3253. search = "SEARCH" [SP "CHARSET" SP astring] 1*(SP search-key)
  3254. ; CHARSET argument to MUST be registered with IANA
  3255. search-key = "ALL" / "ANSWERED" / "BCC" SP astring /
  3256. "BEFORE" SP date / "BODY" SP astring /
  3257. "CC" SP astring / "DELETED" / "FLAGGED" /
  3258. "FROM" SP astring / "KEYWORD" SP flag-keyword /
  3259. "NEW" / "OLD" / "ON" SP date / "RECENT" / "SEEN" /
  3260. "SINCE" SP date / "SUBJECT" SP astring /
  3261. "TEXT" SP astring / "TO" SP astring /
  3262. "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /
  3263. "UNKEYWORD" SP flag-keyword / "UNSEEN" /
  3264. ; Above this line were in [IMAP2]
  3265. "DRAFT" / "HEADER" SP header-fld-name SP astring /
  3266. "LARGER" SP number / "NOT" SP search-key /
  3267. "OR" SP search-key SP search-key /
  3268. "SENTBEFORE" SP date / "SENTON" SP date /
  3269. "SENTSINCE" SP date / "SMALLER" SP number /
  3270. "UID" SP sequence-set / "UNDRAFT" / sequence-set /
  3271. "(" search-key *(SP search-key) ")"
  3272. section = "[" [section-spec] "]"
  3273. section-msgtext = "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list /
  3274. "TEXT"
  3275. ; top-level or MESSAGE/RFC822 part
  3276. section-part = nz-number *("." nz-number)
  3277. ; body part nesting
  3278. Crispin Standards Track [Page 89]
  3279. RFC 3501 IMAPv4 March 2003
  3280. section-spec = section-msgtext / (section-part ["." section-text])
  3281. section-text = section-msgtext / "MIME"
  3282. ; text other than actual body part (headers, etc.)
  3283. select = "SELECT" SP mailbox
  3284. seq-number = nz-number / "*"
  3285. ; message sequence number (COPY, FETCH, STORE
  3286. ; commands) or unique identifier (UID COPY,
  3287. ; UID FETCH, UID STORE commands).
  3288. ; * represents the largest number in use. In
  3289. ; the case of message sequence numbers, it is
  3290. ; the number of messages in a non-empty mailbox.
  3291. ; In the case of unique identifiers, it is the
  3292. ; unique identifier of the last message in the
  3293. ; mailbox or, if the mailbox is empty, the
  3294. ; mailbox's current UIDNEXT value.
  3295. ; The server should respond with a tagged BAD
  3296. ; response to a command that uses a message
  3297. ; sequence number greater than the number of
  3298. ; messages in the selected mailbox. This
  3299. ; includes "*" if the selected mailbox is empty.
  3300. seq-range = seq-number ":" seq-number
  3301. ; two seq-number values and all values between
  3302. ; these two regardless of order.
  3303. ; Example: 2:4 and 4:2 are equivalent and indicate
  3304. ; values 2, 3, and 4.
  3305. ; Example: a unique identifier sequence range of
  3306. ; 3291:* includes the UID of the last message in
  3307. ; the mailbox, even if that value is less than 3291.
  3308. sequence-set = (seq-number / seq-range) *("," sequence-set)
  3309. ; set of seq-number values, regardless of order.
  3310. ; Servers MAY coalesce overlaps and/or execute the
  3311. ; sequence in any order.
  3312. ; Example: a message sequence number set of
  3313. ; 2,4:7,9,12:* for a mailbox with 15 messages is
  3314. ; equivalent to 2,4,5,6,7,9,12,13,14,15
  3315. ; Example: a message sequence number set of *:4,5:7
  3316. ; for a mailbox with 10 messages is equivalent to
  3317. ; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered and
  3318. ; overlap coalesced to be 4,5,6,7,8,9,10.
  3319. status = "STATUS" SP mailbox SP
  3320. "(" status-att *(SP status-att) ")"
  3321. Crispin Standards Track [Page 90]
  3322. RFC 3501 IMAPv4 March 2003
  3323. status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" /
  3324. "UNSEEN"
  3325. status-att-list = status-att SP number *(SP status-att SP number)
  3326. store = "STORE" SP sequence-set SP store-att-flags
  3327. store-att-flags = (["+" / "-"] "FLAGS" [".SILENT"]) SP
  3328. (flag-list / (flag *(SP flag)))
  3329. string = quoted / literal
  3330. subscribe = "SUBSCRIBE" SP mailbox
  3331. tag = 1*<any ASTRING-CHAR except "+">
  3332. text = 1*TEXT-CHAR
  3333. TEXT-CHAR = <any CHAR except CR and LF>
  3334. time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
  3335. ; Hours minutes seconds
  3336. uid = "UID" SP (copy / fetch / search / store)
  3337. ; Unique identifiers used instead of message
  3338. ; sequence numbers
  3339. uniqueid = nz-number
  3340. ; Strictly ascending
  3341. unsubscribe = "UNSUBSCRIBE" SP mailbox
  3342. userid = astring
  3343. x-command = "X" atom <experimental command arguments>
  3344. zone = ("+" / "-") 4DIGIT
  3345. ; Signed four-digit value of hhmm representing
  3346. ; hours and minutes east of Greenwich (that is,
  3347. ; the amount that the given time differs from
  3348. ; Universal Time). Subtracting the timezone
  3349. ; from the given time will give the UT form.
  3350. ; The Universal Time zone is "+0000".
  3351. Crispin Standards Track [Page 91]
  3352. RFC 3501 IMAPv4 March 2003
  3353. 10. Author's Note
  3354. This document is a revision or rewrite of earlier documents, and
  3355. supercedes the protocol specification in those documents: RFC 2060,
  3356. RFC 1730, unpublished IMAP2bis.TXT document, RFC 1176, and RFC 1064.
  3357. 11. Security Considerations
  3358. IMAP4rev1 protocol transactions, including electronic mail data, are
  3359. sent in the clear over the network unless protection from snooping is
  3360. negotiated. This can be accomplished either by the use of STARTTLS,
  3361. negotiated privacy protection in the AUTHENTICATE command, or some
  3362. other protection mechanism.
  3363. 11.1. STARTTLS Security Considerations
  3364. The specification of the STARTTLS command and LOGINDISABLED
  3365. capability in this document replaces that in [IMAP-TLS]. [IMAP-TLS]
  3366. remains normative for the PLAIN [SASL] authenticator.
  3367. IMAP client and server implementations MUST implement the
  3368. TLS_RSA_WITH_RC4_128_MD5 [TLS] cipher suite, and SHOULD implement the
  3369. TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA [TLS] cipher suite. This is
  3370. important as it assures that any two compliant implementations can be
  3371. configured to interoperate. All other cipher suites are OPTIONAL.
  3372. Note that this is a change from section 2.1 of [IMAP-TLS].
  3373. During the [TLS] negotiation, the client MUST check its understanding
  3374. of the server hostname against the server's identity as presented in
  3375. the server Certificate message, in order to prevent man-in-the-middle
  3376. attacks. If the match fails, the client SHOULD either ask for
  3377. explicit user confirmation, or terminate the connection and indicate
  3378. that the server's identity is suspect. Matching is performed
  3379. according to these rules:
  3380. The client MUST use the server hostname it used to open the
  3381. connection as the value to compare against the server name
  3382. as expressed in the server certificate. The client MUST
  3383. NOT use any form of the server hostname derived from an
  3384. insecure remote source (e.g., insecure DNS lookup). CNAME
  3385. canonicalization is not done.
  3386. If a subjectAltName extension of type dNSName is present in
  3387. the certificate, it SHOULD be used as the source of the
  3388. server's identity.
  3389. Matching is case-insensitive.
  3390. Crispin Standards Track [Page 92]
  3391. RFC 3501 IMAPv4 March 2003
  3392. A "*" wildcard character MAY be used as the left-most name
  3393. component in the certificate. For example, *.example.com
  3394. would match a.example.com, foo.example.com, etc. but would
  3395. not match example.com.
  3396. If the certificate contains multiple names (e.g., more than
  3397. one dNSName field), then a match with any one of the fields
  3398. is considered acceptable.
  3399. Both the client and server MUST check the result of the STARTTLS
  3400. command and subsequent [TLS] negotiation to see whether acceptable
  3401. authentication or privacy was achieved.
  3402. 11.2. Other Security Considerations
  3403. A server error message for an AUTHENTICATE command which fails due to
  3404. invalid credentials SHOULD NOT detail why the credentials are
  3405. invalid.
  3406. Use of the LOGIN command sends passwords in the clear. This can be
  3407. avoided by using the AUTHENTICATE command with a [SASL] mechanism
  3408. that does not use plaintext passwords, by first negotiating
  3409. encryption via STARTTLS or some other protection mechanism.
  3410. A server implementation MUST implement a configuration that, at the
  3411. time of authentication, requires:
  3412. (1) The STARTTLS command has been negotiated.
  3413. OR
  3414. (2) Some other mechanism that protects the session from password
  3415. snooping has been provided.
  3416. OR
  3417. (3) The following measures are in place:
  3418. (a) The LOGINDISABLED capability is advertised, and [SASL]
  3419. mechanisms (such as PLAIN) using plaintext passwords are NOT
  3420. advertised in the CAPABILITY list.
  3421. AND
  3422. (b) The LOGIN command returns an error even if the password is
  3423. correct.
  3424. AND
  3425. (c) The AUTHENTICATE command returns an error with all [SASL]
  3426. mechanisms that use plaintext passwords, even if the password
  3427. is correct.
  3428. A server error message for a failing LOGIN command SHOULD NOT specify
  3429. that the user name, as opposed to the password, is invalid.
  3430. A server SHOULD have mechanisms in place to limit or delay failed
  3431. AUTHENTICATE/LOGIN attempts.
  3432. Crispin Standards Track [Page 93]
  3433. RFC 3501 IMAPv4 March 2003
  3434. Additional security considerations are discussed in the section
  3435. discussing the AUTHENTICATE and LOGIN commands.
  3436. 12. IANA Considerations
  3437. IMAP4 capabilities are registered by publishing a standards track or
  3438. IESG approved experimental RFC. The registry is currently located
  3439. at:
  3440. http://www.iana.org/assignments/imap4-capabilities
  3441. As this specification revises the STARTTLS and LOGINDISABLED
  3442. extensions previously defined in [IMAP-TLS], the registry will be
  3443. updated accordingly.
  3444. Crispin Standards Track [Page 94]
  3445. RFC 3501 IMAPv4 March 2003
  3446. Appendices
  3447. A. Normative References
  3448. The following documents contain definitions or specifications that
  3449. are necessary to understand this document properly:
  3450. [ABNF] Crocker, D. and P. Overell, "Augmented BNF for
  3451. Syntax Specifications: ABNF", RFC 2234,
  3452. November 1997.
  3453. [ANONYMOUS] Newman, C., "Anonymous SASL Mechanism", RFC
  3454. 2245, November 1997.
  3455. [CHARSET] Freed, N. and J. Postel, "IANA Character Set
  3456. Registration Procedures", RFC 2978, October
  3457. 2000.
  3458. [DIGEST-MD5] Leach, P. and C. Newman, "Using Digest
  3459. Authentication as a SASL Mechanism", RFC 2831,
  3460. May 2000.
  3461. [DISPOSITION] Troost, R., Dorner, S. and K. Moore,
  3462. "Communicating Presentation Information in
  3463. Internet Messages: The Content-Disposition
  3464. Header", RFC 2183, August 1997.
  3465. [IMAP-TLS] Newman, C., "Using TLS with IMAP, POP3 and
  3466. ACAP", RFC 2595, June 1999.
  3467. [KEYWORDS] Bradner, S., "Key words for use in RFCs to
  3468. Indicate Requirement Levels", BCP 14, RFC 2119,
  3469. March 1997.
  3470. [LANGUAGE-TAGS] Alvestrand, H., "Tags for the Identification of
  3471. Languages", BCP 47, RFC 3066, January 2001.
  3472. [LOCATION] Palme, J., Hopmann, A. and N. Shelness, "MIME
  3473. Encapsulation of Aggregate Documents, such as
  3474. HTML (MHTML)", RFC 2557, March 1999.
  3475. [MD5] Myers, J. and M. Rose, "The Content-MD5 Header
  3476. Field", RFC 1864, October 1995.
  3477. Crispin Standards Track [Page 95]
  3478. RFC 3501 IMAPv4 March 2003
  3479. [MIME-HDRS] Moore, K., "MIME (Multipurpose Internet Mail
  3480. Extensions) Part Three: Message Header
  3481. Extensions for Non-ASCII Text", RFC 2047,
  3482. November 1996.
  3483. [MIME-IMB] Freed, N. and N. Borenstein, "MIME
  3484. (Multipurpose Internet Mail Extensions) Part
  3485. One: Format of Internet Message Bodies", RFC
  3486. 2045, November 1996.
  3487. [MIME-IMT] Freed, N. and N. Borenstein, "MIME
  3488. (Multipurpose Internet Mail Extensions) Part
  3489. Two: Media Types", RFC 2046, November 1996.
  3490. [RFC-2822] Resnick, P., "Internet Message Format", RFC
  3491. 2822, April 2001.
  3492. [SASL] Myers, J., "Simple Authentication and Security
  3493. Layer (SASL)", RFC 2222, October 1997.
  3494. [TLS] Dierks, T. and C. Allen, "The TLS Protocol
  3495. Version 1.0", RFC 2246, January 1999.
  3496. [UTF-7] Goldsmith, D. and M. Davis, "UTF-7: A Mail-Safe
  3497. Transformation Format of Unicode", RFC 2152,
  3498. May 1997.
  3499. The following documents describe quality-of-implementation issues
  3500. that should be carefully considered when implementing this protocol:
  3501. [IMAP-IMPLEMENTATION] Leiba, B., "IMAP Implementation
  3502. Recommendations", RFC 2683, September 1999.
  3503. [IMAP-MULTIACCESS] Gahrns, M., "IMAP4 Multi-Accessed Mailbox
  3504. Practice", RFC 2180, July 1997.
  3505. A.1 Informative References
  3506. The following documents describe related protocols:
  3507. [IMAP-DISC] Austein, R., "Synchronization Operations for
  3508. Disconnected IMAP4 Clients", Work in Progress.
  3509. [IMAP-MODEL] Crispin, M., "Distributed Electronic Mail
  3510. Models in IMAP4", RFC 1733, December 1994.
  3511. Crispin Standards Track [Page 96]
  3512. RFC 3501 IMAPv4 March 2003
  3513. [ACAP] Newman, C. and J. Myers, "ACAP -- Application
  3514. Configuration Access Protocol", RFC 2244,
  3515. November 1997.
  3516. [SMTP] Klensin, J., "Simple Mail Transfer Protocol",
  3517. STD 10, RFC 2821, April 2001.
  3518. The following documents are historical or describe historical aspects
  3519. of this protocol:
  3520. [IMAP-COMPAT] Crispin, M., "IMAP4 Compatibility with
  3521. IMAP2bis", RFC 2061, December 1996.
  3522. [IMAP-HISTORICAL] Crispin, M., "IMAP4 Compatibility with IMAP2
  3523. and IMAP2bis", RFC 1732, December 1994.
  3524. [IMAP-OBSOLETE] Crispin, M., "Internet Message Access Protocol
  3525. - Obsolete Syntax", RFC 2062, December 1996.
  3526. [IMAP2] Crispin, M., "Interactive Mail Access Protocol
  3527. - Version 2", RFC 1176, August 1990.
  3528. [RFC-822] Crocker, D., "Standard for the Format of ARPA
  3529. Internet Text Messages", STD 11, RFC 822,
  3530. August 1982.
  3531. [RFC-821] Postel, J., "Simple Mail Transfer Protocol",
  3532. STD 10, RFC 821, August 1982.
  3533. B. Changes from RFC 2060
  3534. 1) Clarify description of unique identifiers and their semantics.
  3535. 2) Fix the SELECT description to clarify that UIDVALIDITY is required
  3536. in the SELECT and EXAMINE responses.
  3537. 3) Added an example of a failing search.
  3538. 4) Correct store-att-flags: "#flag" should be "1#flag".
  3539. 5) Made search and section rules clearer.
  3540. 6) Correct the STORE example.
  3541. 7) Correct "BASE645" misspelling.
  3542. 8) Remove extraneous close parenthesis in example of two-part message
  3543. with text and BASE64 attachment.
  3544. Crispin Standards Track [Page 97]
  3545. RFC 3501 IMAPv4 March 2003
  3546. 9) Remove obsolete "MAILBOX" response from mailbox-data.
  3547. 10) A spurious "<" in the rule for mailbox-data was removed.
  3548. 11) Add CRLF to continue-req.
  3549. 12) Specifically exclude "]" from the atom in resp-text-code.
  3550. 13) Clarify that clients and servers should adhere strictly to the
  3551. protocol syntax.
  3552. 14) Emphasize in 5.2 that EXISTS can not be used to shrink a mailbox.
  3553. 15) Add NEWNAME to resp-text-code.
  3554. 16) Clarify that the empty string, not NIL, is used as arguments to
  3555. LIST.
  3556. 17) Clarify that NIL can be returned as a hierarchy delimiter for the
  3557. empty string mailbox name argument if the mailbox namespace is flat.
  3558. 18) Clarify that addr-mailbox and addr-name have RFC-2822 quoting
  3559. removed.
  3560. 19) Update UTF-7 reference.
  3561. 20) Fix example in 6.3.11.
  3562. 21) Clarify that non-existent UIDs are ignored.
  3563. 22) Update DISPOSITION reference.
  3564. 23) Expand state diagram.
  3565. 24) Clarify that partial fetch responses are only returned in
  3566. response to a partial fetch command.
  3567. 25) Add UIDNEXT response code. Correct UIDVALIDITY definition
  3568. reference.
  3569. 26) Further clarification of "can" vs. "MAY".
  3570. 27) Reference RFC-2119.
  3571. 28) Clarify that superfluous shifts are not permitted in modified
  3572. UTF-7.
  3573. 29) Clarify that there are no implicit shifts in modified UTF-7.
  3574. Crispin Standards Track [Page 98]
  3575. RFC 3501 IMAPv4 March 2003
  3576. 30) Clarify that "INBOX" in a mailbox name is always INBOX, even if
  3577. it is given as a string.
  3578. 31) Add missing open parenthesis in media-basic grammar rule.
  3579. 32) Correct attribute syntax in mailbox-data.
  3580. 33) Add UIDNEXT to EXAMINE responses.
  3581. 34) Clarify UNSEEN, PERMANENTFLAGS, UIDVALIDITY, and UIDNEXT
  3582. responses in SELECT and EXAMINE. They are required now, but weren't
  3583. in older versions.
  3584. 35) Update references with RFC numbers.
  3585. 36) Flush text-mime2.
  3586. 37) Clarify that modified UTF-7 names must be case-sensitive and that
  3587. violating the convention should be avoided.
  3588. 38) Correct UID FETCH example.
  3589. 39) Clarify UID FETCH, UID STORE, and UID SEARCH vs. untagged EXPUNGE
  3590. responses.
  3591. 40) Clarify the use of the word "convention".
  3592. 41) Clarify that a command is not "in progress" until it has been
  3593. fully received (specifically, that a command is not "in progress"
  3594. during command continuation negotiation).
  3595. 42) Clarify envelope defaulting.
  3596. 43) Clarify that SP means one and only one space character.
  3597. 44) Forbid silly states in LIST response.
  3598. 45) Clarify that the ENVELOPE, INTERNALDATE, RFC822*, BODY*, and UID
  3599. for a message is static.
  3600. 46) Add BADCHARSET response code.
  3601. 47) Update formal syntax to [ABNF] conventions.
  3602. 48) Clarify trailing hierarchy delimiter in CREATE semantics.
  3603. 49) Clarify that the "blank line" is the [RFC-2822] delimiting blank
  3604. line.
  3605. Crispin Standards Track [Page 99]
  3606. RFC 3501 IMAPv4 March 2003
  3607. 50) Clarify that RENAME should also create hierarchy as needed for
  3608. the command to complete.
  3609. 51) Fix body-ext-mpart to not require language if disposition
  3610. present.
  3611. 52) Clarify the RFC822.HEADER response.
  3612. 53) Correct missing space after charset astring in search.
  3613. 54) Correct missing quote for BADCHARSET in resp-text-code.
  3614. 55) Clarify that ALL, FAST, and FULL preclude any other data items
  3615. appearing.
  3616. 56) Clarify semantics of reference argument in LIST.
  3617. 57) Clarify that a null string for SEARCH HEADER X-FOO means any
  3618. message with a header line with a field-name of X-FOO regardless of
  3619. the text of the header.
  3620. 58) Specifically reserve 8-bit mailbox names for future use as UTF-8.
  3621. 59) It is not an error for the client to store a flag that is not in
  3622. the PERMANENTFLAGS list; however, the server will either ignore the
  3623. change or make the change in the session only.
  3624. 60) Correct/clarify the text regarding superfluous shifts.
  3625. 61) Correct typographic errors in the "Changes" section.
  3626. 62) Clarify that STATUS must not be used to check for new messages in
  3627. the selected mailbox
  3628. 63) Clarify LSUB behavior with "%" wildcard.
  3629. 64) Change AUTHORIZATION to AUTHENTICATE in section 7.5.
  3630. 65) Clarify description of multipart body type.
  3631. 66) Clarify that STORE FLAGS does not affect \Recent.
  3632. 67) Change "west" to "east" in description of timezone.
  3633. 68) Clarify that commands which break command pipelining must wait
  3634. for a completion result response.
  3635. 69) Clarify that EXAMINE does not affect \Recent.
  3636. Crispin Standards Track [Page 100]
  3637. RFC 3501 IMAPv4 March 2003
  3638. 70) Make description of MIME structure consistent.
  3639. 71) Clarify that date searches disregard the time and timezone of the
  3640. INTERNALDATE or Date: header. In other words, "ON 13-APR-2000" means
  3641. messages with an INTERNALDATE text which starts with "13-APR-2000",
  3642. even if timezone differential from the local timezone is sufficient
  3643. to move that INTERNALDATE into the previous or next day.
  3644. 72) Clarify that the header fetches don't add a blank line if one
  3645. isn't in the [RFC-2822] message.
  3646. 73) Clarify (in discussion of UIDs) that messages are immutable.
  3647. 74) Add an example of CHARSET searching.
  3648. 75) Clarify in SEARCH that keywords are a type of flag.
  3649. 76) Clarify the mandatory nature of the SELECT data responses.
  3650. 77) Add optional CAPABILITY response code in the initial OK or
  3651. PREAUTH.
  3652. 78) Add note that server can send an untagged CAPABILITY command as
  3653. part of the responses to AUTHENTICATE and LOGIN.
  3654. 79) Remove statement about it being unnecessary to issue a CAPABILITY
  3655. command more than once in a connection. That statement is no longer
  3656. true.
  3657. 80) Clarify that untagged EXPUNGE decrements the number of messages
  3658. in the mailbox.
  3659. 81) Fix definition of "body" (concatenation has tighter binding than
  3660. alternation).
  3661. 82) Add a new "Special Notes to Implementors" section with reference
  3662. to [IMAP-IMPLEMENTATION].
  3663. 83) Clarify that an untagged CAPABILITY response to an AUTHENTICATE
  3664. command should only be done if a security layer was not negotiated.
  3665. 84) Change the definition of atom to exclude "]". Update astring to
  3666. include "]" for compatibility with the past. Remove resp-text-atom.
  3667. 85) Remove NEWNAME. It can't work because mailbox names can be
  3668. literals and can include "]". Functionality can be addressed via
  3669. referrals.
  3670. Crispin Standards Track [Page 101]
  3671. RFC 3501 IMAPv4 March 2003
  3672. 86) Move modified UTF-7 rationale in order to have more logical
  3673. paragraph flow.
  3674. 87) Clarify UID uniqueness guarantees with the use of MUST.
  3675. 88) Note that clients should read response data until the connection
  3676. is closed instead of immediately closing on a BYE.
  3677. 89) Change RFC-822 references to RFC-2822.
  3678. 90) Clarify that RFC-2822 should be followed instead of RFC-822.
  3679. 91) Change recommendation of optional automatic capabilities in LOGIN
  3680. and AUTHENTICATE to use the CAPABILITY response code in the tagged
  3681. OK. This is more interoperable than an unsolicited untagged
  3682. CAPABILITY response.
  3683. 92) STARTTLS and AUTH=PLAIN are mandatory to implement; add
  3684. recommendations for other [SASL] mechanisms.
  3685. 93) Clarify that a "connection" (as opposed to "server" or "command")
  3686. is in one of the four states.
  3687. 94) Clarify that a failed or rejected command does not change state.
  3688. 95) Split references between normative and informative.
  3689. 96) Discuss authentication failure issues in security section.
  3690. 97) Clarify that a data item is not necessarily of only one data
  3691. type.
  3692. 98) Clarify that sequence ranges are independent of order.
  3693. 99) Change an example to clarify that superfluous shifts in
  3694. Modified-UTF7 can not be fixed just by omitting the shift. The
  3695. entire string must be recalculated.
  3696. 100) Change Envelope Structure definition since [RFC-2822] uses
  3697. "envelope" to refer to the [SMTP] envelope and not the envelope data
  3698. that appears in the [RFC-2822] header.
  3699. 101) Expand on RFC822.HEADER response data vs. BODY[HEADER].
  3700. 102) Clarify Logout state semantics, change ASCII art.
  3701. 103) Security changes to comply with IESG requirements.
  3702. Crispin Standards Track [Page 102]
  3703. RFC 3501 IMAPv4 March 2003
  3704. 104) Add definition for body URI.
  3705. 105) Break sequence range definition into three rules, with rewritten
  3706. descriptions for each.
  3707. 106) Move STARTTLS and LOGINDISABLED here from [IMAP-TLS].
  3708. 107) Add IANA Considerations section.
  3709. 108) Clarify valid client assumptions for new message UIDs vs.
  3710. UIDNEXT.
  3711. 109) Clarify that changes to permanentflags affect concurrent
  3712. sessions as well as subsequent sessions.
  3713. 110) Clarify that authenticated state can be entered by the CLOSE
  3714. command.
  3715. 111) Emphasize that SELECT and EXAMINE are the exceptions to the rule
  3716. that a failing command does not change state.
  3717. 112) Clarify that newly-appended messages have the Recent flag set.
  3718. 113) Clarify that newly-copied messages SHOULD have the Recent flag
  3719. set.
  3720. 114) Clarify that UID commands always return the UID in FETCH
  3721. responses.
  3722. C. Key Word Index
  3723. +FLAGS <flag list> (store command data item) ............... 59
  3724. +FLAGS.SILENT <flag list> (store command data item) ........ 59
  3725. -FLAGS <flag list> (store command data item) ............... 59
  3726. -FLAGS.SILENT <flag list> (store command data item) ........ 59
  3727. ALERT (response code) ...................................... 64
  3728. ALL (fetch item) ........................................... 55
  3729. ALL (search key) ........................................... 50
  3730. ANSWERED (search key) ...................................... 50
  3731. APPEND (command) ........................................... 45
  3732. AUTHENTICATE (command) ..................................... 27
  3733. BAD (response) ............................................. 66
  3734. BADCHARSET (response code) ................................. 64
  3735. BCC <string> (search key) .................................. 51
  3736. BEFORE <date> (search key) ................................. 51
  3737. BODY (fetch item) .......................................... 55
  3738. BODY (fetch result) ........................................ 73
  3739. BODY <string> (search key) ................................. 51
  3740. Crispin Standards Track [Page 103]
  3741. RFC 3501 IMAPv4 March 2003
  3742. BODY.PEEK[<section>]<<partial>> (fetch item) ............... 57
  3743. BODYSTRUCTURE (fetch item) ................................. 57
  3744. BODYSTRUCTURE (fetch result) ............................... 74
  3745. BODY[<section>]<<origin octet>> (fetch result) ............. 74
  3746. BODY[<section>]<<partial>> (fetch item) .................... 55
  3747. BYE (response) ............................................. 67
  3748. Body Structure (message attribute) ......................... 12
  3749. CAPABILITY (command) ....................................... 24
  3750. CAPABILITY (response code) ................................. 64
  3751. CAPABILITY (response) ...................................... 68
  3752. CC <string> (search key) ................................... 51
  3753. CHECK (command) ............................................ 47
  3754. CLOSE (command) ............................................ 48
  3755. COPY (command) ............................................. 59
  3756. CREATE (command) ........................................... 34
  3757. DELETE (command) ........................................... 35
  3758. DELETED (search key) ....................................... 51
  3759. DRAFT (search key) ......................................... 51
  3760. ENVELOPE (fetch item) ...................................... 57
  3761. ENVELOPE (fetch result) .................................... 77
  3762. EXAMINE (command) .......................................... 33
  3763. EXISTS (response) .......................................... 71
  3764. EXPUNGE (command) .......................................... 48
  3765. EXPUNGE (response) ......................................... 72
  3766. Envelope Structure (message attribute) ..................... 12
  3767. FAST (fetch item) .......................................... 55
  3768. FETCH (command) ............................................ 54
  3769. FETCH (response) ........................................... 73
  3770. FLAGGED (search key) ....................................... 51
  3771. FLAGS (fetch item) ......................................... 57
  3772. FLAGS (fetch result) ....................................... 78
  3773. FLAGS (response) ........................................... 71
  3774. FLAGS <flag list> (store command data item) ................ 59
  3775. FLAGS.SILENT <flag list> (store command data item) ......... 59
  3776. FROM <string> (search key) ................................. 51
  3777. FULL (fetch item) .......................................... 55
  3778. Flags (message attribute) .................................. 11
  3779. HEADER (part specifier) .................................... 55
  3780. HEADER <field-name> <string> (search key) .................. 51
  3781. HEADER.FIELDS <header-list> (part specifier) ............... 55
  3782. HEADER.FIELDS.NOT <header-list> (part specifier) ........... 55
  3783. INTERNALDATE (fetch item) .................................. 57
  3784. INTERNALDATE (fetch result) ................................ 78
  3785. Internal Date (message attribute) .......................... 12
  3786. KEYWORD <flag> (search key) ................................ 51
  3787. Keyword (type of flag) ..................................... 11
  3788. LARGER <n> (search key) .................................... 51
  3789. LIST (command) ............................................. 40
  3790. Crispin Standards Track [Page 104]
  3791. RFC 3501 IMAPv4 March 2003
  3792. LIST (response) ............................................ 69
  3793. LOGIN (command) ............................................ 30
  3794. LOGOUT (command) ........................................... 25
  3795. LSUB (command) ............................................. 43
  3796. LSUB (response) ............................................ 70
  3797. MAY (specification requirement term) ....................... 4
  3798. MESSAGES (status item) ..................................... 45
  3799. MIME (part specifier) ...................................... 56
  3800. MUST (specification requirement term) ...................... 4
  3801. MUST NOT (specification requirement term) .................. 4
  3802. Message Sequence Number (message attribute) ................ 10
  3803. NEW (search key) ........................................... 51
  3804. NO (response) .............................................. 66
  3805. NOOP (command) ............................................. 25
  3806. NOT <search-key> (search key) .............................. 52
  3807. OK (response) .............................................. 65
  3808. OLD (search key) ........................................... 52
  3809. ON <date> (search key) ..................................... 52
  3810. OPTIONAL (specification requirement term) .................. 4
  3811. OR <search-key1> <search-key2> (search key) ................ 52
  3812. PARSE (response code) ...................................... 64
  3813. PERMANENTFLAGS (response code) ............................. 64
  3814. PREAUTH (response) ......................................... 67
  3815. Permanent Flag (class of flag) ............................. 12
  3816. READ-ONLY (response code) .................................. 65
  3817. READ-WRITE (response code) ................................. 65
  3818. RECENT (response) .......................................... 72
  3819. RECENT (search key) ........................................ 52
  3820. RECENT (status item) ....................................... 45
  3821. RENAME (command) ........................................... 37
  3822. REQUIRED (specification requirement term) .................. 4
  3823. RFC822 (fetch item) ........................................ 57
  3824. RFC822 (fetch result) ...................................... 78
  3825. RFC822.HEADER (fetch item) ................................. 57
  3826. RFC822.HEADER (fetch result) ............................... 78
  3827. RFC822.SIZE (fetch item) ................................... 57
  3828. RFC822.SIZE (fetch result) ................................. 78
  3829. RFC822.TEXT (fetch item) ................................... 58
  3830. RFC822.TEXT (fetch result) ................................. 79
  3831. SEARCH (command) ........................................... 49
  3832. SEARCH (response) .......................................... 71
  3833. SEEN (search key) .......................................... 52
  3834. SELECT (command) ........................................... 31
  3835. SENTBEFORE <date> (search key) ............................. 52
  3836. SENTON <date> (search key) ................................. 52
  3837. SENTSINCE <date> (search key) .............................. 52
  3838. SHOULD (specification requirement term) .................... 4
  3839. SHOULD NOT (specification requirement term) ................ 4
  3840. Crispin Standards Track [Page 105]
  3841. RFC 3501 IMAPv4 March 2003
  3842. SINCE <date> (search key) .................................. 52
  3843. SMALLER <n> (search key) ................................... 52
  3844. STARTTLS (command) ......................................... 27
  3845. STATUS (command) ........................................... 44
  3846. STATUS (response) .......................................... 70
  3847. STORE (command) ............................................ 58
  3848. SUBJECT <string> (search key) .............................. 53
  3849. SUBSCRIBE (command) ........................................ 38
  3850. Session Flag (class of flag) ............................... 12
  3851. System Flag (type of flag) ................................. 11
  3852. TEXT (part specifier) ...................................... 56
  3853. TEXT <string> (search key) ................................. 53
  3854. TO <string> (search key) ................................... 53
  3855. TRYCREATE (response code) .................................. 65
  3856. UID (command) .............................................. 60
  3857. UID (fetch item) ........................................... 58
  3858. UID (fetch result) ......................................... 79
  3859. UID <sequence set> (search key) ............................ 53
  3860. UIDNEXT (response code) .................................... 65
  3861. UIDNEXT (status item) ...................................... 45
  3862. UIDVALIDITY (response code) ................................ 65
  3863. UIDVALIDITY (status item) .................................. 45
  3864. UNANSWERED (search key) .................................... 53
  3865. UNDELETED (search key) ..................................... 53
  3866. UNDRAFT (search key) ....................................... 53
  3867. UNFLAGGED (search key) ..................................... 53
  3868. UNKEYWORD <flag> (search key) .............................. 53
  3869. UNSEEN (response code) ..................................... 65
  3870. UNSEEN (search key) ........................................ 53
  3871. UNSEEN (status item) ....................................... 45
  3872. UNSUBSCRIBE (command) ...................................... 39
  3873. Unique Identifier (UID) (message attribute) ................ 8
  3874. X<atom> (command) .......................................... 62
  3875. [RFC-2822] Size (message attribute) ........................ 12
  3876. \Answered (system flag) .................................... 11
  3877. \Deleted (system flag) ..................................... 11
  3878. \Draft (system flag) ....................................... 11
  3879. \Flagged (system flag) ..................................... 11
  3880. \Marked (mailbox name attribute) ........................... 69
  3881. \Noinferiors (mailbox name attribute) ...................... 69
  3882. \Noselect (mailbox name attribute) ......................... 69
  3883. \Recent (system flag) ...................................... 11
  3884. \Seen (system flag) ........................................ 11
  3885. \Unmarked (mailbox name attribute) ......................... 69
  3886. Crispin Standards Track [Page 106]
  3887. RFC 3501 IMAPv4 March 2003
  3888. Author's Address
  3889. Mark R. Crispin
  3890. Networks and Distributed Computing
  3891. University of Washington
  3892. 4545 15th Avenue NE
  3893. Seattle, WA 98105-4527
  3894. Phone: (206) 543-5762
  3895. EMail: MRC@CAC.Washington.EDU
  3896. Crispin Standards Track [Page 107]
  3897. RFC 3501 IMAPv4 March 2003
  3898. Full Copyright Statement
  3899. Copyright (C) The Internet Society (2003). All Rights Reserved.
  3900. This document and translations of it may be copied and furnished to
  3901. others, and derivative works that comment on or otherwise explain it
  3902. or assist in its implementation may be prepared, copied, published
  3903. and distributed, in whole or in part, without restriction of any
  3904. kind, provided that the above copyright notice and this paragraph are
  3905. included on all such copies and derivative works. However, this
  3906. document itself may not be modified in any way, such as by removing
  3907. the copyright notice or references to the Internet Society or other
  3908. Internet organizations, except as needed for the purpose of
  3909. developing Internet standards in which case the procedures for
  3910. copyrights defined in the Internet Standards process must be
  3911. followed, or as required to translate it into languages other than
  3912. English.
  3913. The limited permissions granted above are perpetual and will not be
  3914. revoked by the Internet Society or its successors or assigns. v This
  3915. document and the information contained herein is provided on an "AS
  3916. IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK
  3917. FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  3918. LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL
  3919. NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY
  3920. OR FITNESS FOR A PARTICULAR PURPOSE.
  3921. Acknowledgement
  3922. Funding for the RFC Editor function is currently provided by the
  3923. Internet Society.
  3924. Crispin Standards Track [Page 108]