1
2
3
4
5
6
7Network Working Group M. Crispin
8Request for Comments: 1730 University of Washington
9Category: Standards Track December 1994
10
11
12 INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4
13
14
15
16Status of this Memo
17
18 This document specifies an Internet standards track protocol for the
19 Internet community, and requests discussion and suggestions for
20 improvements. Please refer to the current edition of the "Internet
21 Official Protocol Standards" (STD 1) for the standardization state
22 and status of this protocol. Distribution of this memo is unlimited.
23
24
25Abstract
26
27 The Internet Message Access Protocol, Version 4 (IMAP4) allows a
28 client to access and manipulate electronic mail messages on a server.
29 IMAP4 permits manipulation of remote message folders, called
30 "mailboxes", in a way that is functionally equivalent to local
31 mailboxes. IMAP4 also provides the capability for an offline client
32 to resynchronize with the server (see also [IMAP-DISC]).
33
34 IMAP4 includes operations for creating, deleting, and renaming
35 mailboxes; checking for new messages; permanently removing messages;
36 setting and clearing flags; RFC 822 and MIME parsing; searching; and
37 selective fetching of message attributes, texts, and portions
38 thereof. Messages in IMAP4 are accessed by the use of numbers.
39 These numbers are either message sequence numbers (relative position
40 from 1 to the number of messages in the mailbox) or unique
41 identifiers (immutable, strictly ascending values assigned to each
42 message, but which are not necessarily contiguous).
43
44 IMAP4 supports a single server. A mechanism for supporting multiple
45 IMAP4 servers is discussed in [IMSP].
46
47 IMAP4 does not specify a means of posting mail; this function is
48 handled by a mail transfer protocol such as [SMTP].
49
50 IMAP4 is designed to be upwards compatible from the [IMAP2] protocol.
51 Compatibility issues are discussed in [IMAP-COMPAT].
52
53
54
55
56
57
58Crispin [Page i]
59
60RFC 1730 IMAP4 December 1994
61
62
63
64
65
66Table of Contents
67
68
69
70IMAP4 Protocol Specification ...................................... 1
711. Organization of this Document ............................. 1
721.1. How to Read This Document ................................. 1
731.2. Conventions Used in this Document ......................... 1
742. Protocol Overview ......................................... 1
752.1. Link Level ................................................ 1
762.2. Commands and Responses .................................... 1
772.2.1. Client Protocol Sender and Server Protocol Receiver ....... 2
782.2.2. Server Protocol Sender and Client Protocol Receiver ....... 2
793. State and Flow Diagram .................................... 4
803.1. Non-Authenticated State ................................... 4
813.2. Authenticated State ....................................... 4
823.3. Selected State ............................................ 4
833.4. Logout State .............................................. 4
844. Data Formats .............................................. 6
854.1. Atom ...................................................... 6
864.2. Number .................................................... 6
874.3. String .................................................... 6
884.3.1. 8-bit and Binary Strings .................................. 7
894.4. Parenthesized List ........................................ 7
904.5. NIL ....................................................... 7
915. Operational Considerations ................................ 8
925.1. Mailbox Naming ............................................ 8
935.2. Mailbox Size and Message Status Updates ................... 8
945.3. Response when no Command in Progress ...................... 8
955.4. Autologout Timer .......................................... 9
965.5. Multiple Commands in Progress ............................. 9
976. Client Commands ........................................... 10
986.1. Client Commands - Any State ............................... 10
996.1.1. CAPABILITY Command ........................................ 10
1006.1.2. NOOP Command .............................................. 11
1016.1.3. LOGOUT Command ............................................ 11
1026.2. Client Commands - Non-Authenticated State ................. 12
1036.2.1. AUTHENTICATE Command ...................................... 12
1046.2.2. LOGIN Command ............................................. 14
1056.3. Client Commands - Authenticated State ..................... 14
1066.3.1. SELECT Command ............................................ 15
1076.3.2. EXAMINE Command ........................................... 16
1086.3.3. CREATE Command ............................................ 17
1096.3.4. DELETE Command ............................................ 18
1106.3.5. RENAME Command ............................................ 18
111
112
113
114Crispin [Page ii]
115
116RFC 1730 IMAP4 December 1994
117
118
1196.3.6. SUBSCRIBE Command ......................................... 19
1206.3.7. UNSUBSCRIBE Command ....................................... 19
1216.3.8. LIST Command .............................................. 20
1226.3.9. LSUB Command .............................................. 22
1236.3.10. APPEND Command ............................................ 22
1246.4. Client Commands - Selected State .......................... 23
1256.4.1. CHECK Command ............................................. 23
1266.4.2. CLOSE Command ............................................. 24
1276.4.3. EXPUNGE Command ........................................... 25
1286.4.4. SEARCH Command ............................................ 25
1296.4.5. FETCH Command ............................................. 29
1306.4.6. PARTIAL Command ........................................... 32
1316.4.7. STORE Command ............................................. 33
1326.4.8. COPY Command .............................................. 34
1336.4.9. UID Command ............................................... 35
1346.5. Client Commands - Experimental/Expansion .................. 37
1356.5.1. X<atom> Command ........................................... 37
1367. Server Responses .......................................... 38
1377.1. Server Responses - Status Responses ....................... 39
1387.1.1. OK Response ............................................... 40
1397.1.2. NO Response ............................................... 40
1407.1.3. BAD Response .............................................. 41
1417.1.4. PREAUTH Response .......................................... 41
1427.1.5. BYE Response .............................................. 41
1437.2. Server Responses - Server and Mailbox Status .............. 42
1447.2.1. CAPABILITY Response ....................................... 42
1457.2.2. LIST Response ............................................. 43
1467.2.3. LSUB Response ............................................. 44
1477.2.4. SEARCH Response ........................................... 44
1487.2.5. FLAGS Response ............................................ 44
1497.3. Server Responses - Message Status ......................... 45
1507.3.1. EXISTS Response ........................................... 45
1517.3.2. RECENT Response ........................................... 45
1527.3.3. EXPUNGE Response .......................................... 45
1537.3.4. FETCH Response ............................................ 46
1547.3.5. Obsolete Responses ........................................ 51
1557.4. Server Responses - Command Continuation Request ........... 51
1568. Sample IMAP4 session ...................................... 52
1579. Formal Syntax ............................................. 53
15810. Author's Note ............................................. 64
15911. Security Considerations ................................... 64
16012. Author's Address .......................................... 64
161Appendices ........................................................ 65
162A. Obsolete Commands ......................................... 65
163A.6.3.OBS.1. FIND ALL.MAILBOXES Command ........................ 65
164A.6.3.OBS.2. FIND MAILBOXES Command ............................ 65
165A.6.3.OBS.3. SUBSCRIBE MAILBOX Command ......................... 66
166A.6.3.OBS.4. UNSUBSCRIBE MAILBOX Command ....................... 66
167
168
169
170Crispin [Page iii]
171
172RFC 1730 IMAP4 December 1994
173
174
175B. Obsolete Responses ........................................ 68
176B.7.2.OBS.1. MAILBOX Response .................................. 68
177B.7.3.OBS.1. COPY Response ..................................... 68
178B.7.3.OBS.2. STORE Response .................................... 69
179C. References ................................................ 70
180E. IMAP4 Keyword Index ....................................... 71
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226Crispin [Page iv]
227
228RFC 1730 IMAP4 December 1994
229
230
231IMAP4 Protocol Specification
232
2331. Organization of this Document
234
2351.1. How to Read This Document
236
237 This document is written from the point of view of the implementor of
238 an IMAP4 client or server. Beyond the protocol overview in section
239 2, it is not optimized for someone trying to understand the operation
240 of the protocol. The material in sections 3 through 5 provides the
241 general context and definitions with which IMAP4 operates.
242
243 Sections 6, 7, and 9 describe the IMAP commands, responses, and
244 syntax, respectively. The relationships among these are such that it
245 is almost impossible to understand any of them separately. In
246 particular, one should not attempt to deduce command syntax from the
247 command section alone; one should instead refer to the formal syntax
248 section.
249
250
2511.2. Conventions Used in this Document
252
253 In examples, "C:" and "S:" indicate lines sent by the client and
254 server respectively.
255
256
2572. Protocol Overview
258
2592.1. Link Level
260
261 The IMAP4 protocol assumes a reliable data stream such as provided by
262 TCP. When TCP is used, an IMAP4 server listens on port 143.
263
264
2652.2. Commands and Responses
266
267 An IMAP4 session consists of the establishment of a client/server
268 connection, an initial greeting from the server, and client/server
269 interactions. These client/server interactions consist of a client
270 command, server data, and a server completion result response.
271
272 All interactions transmitted by client and server are in the form of
273 lines; that is, strings that end with a CRLF. The protocol receiver
274 of an IMAP4 client or server is either reading a line, or is reading
275 a sequence of octets with a known count followed by a line.
276
277
278
279
280
281
282Crispin [Page 1]
283
284RFC 1730 IMAP4 December 1994
285
286
2872.2.1. Client Protocol Sender and Server Protocol Receiver
288
289 The client command begins an operation. Each client command is
290 prefixed with a identifier (typically a short alphanumeric string,
291 e.g. A0001, A0002, etc.) called a "tag". A different tag is
292 generated by the client for each command.
293
294 There are two cases in which a line from the client does not
295 represent a complete command. In one case, a command argument is
296 quoted with an octet count (see the description of literal in String
297 under Data Formats); in the other case, the command arguments require
298 server feedback (see the AUTHENTICATE command). In either case, the
299 server sends a command continuation request response if it is ready
300 for the octets (if appropriate) and the remainder of the command.
301 This response is prefixed with the token "+".
302
303 Note: If, instead, the server detected an error in the
304 command, it sends a BAD completion response with tag
305 matching the command (as described below) to reject the
306 command and prevent the client from sending any more of the
307 command.
308
309 It is also possible for the server to send a completion
310 response for some other command (if multiple commands are
311 in progress), or untagged data. In either case, the
312 command continuation request is still pending; the client
313 takes the appropriate action for the response, and reads
314 another response from the server.
315
316 The protocol receiver of an IMAP4 server reads a command line from
317 the client, parses the command and its arguments, and transmits
318 server data and a server command completion result response.
319
320
3212.2.2. Server Protocol Sender and Client Protocol Receiver
322
323 Data transmitted by the server to the client and status responses
324 that do not indicate command completion are prefixed with the token
325 "*", and are called untagged responses.
326
327 Server data may be sent as a result of a client command, or may be
328 sent unilaterally by the server. There is no syntactic difference
329 between server data that resulted from a specific command and server
330 data that were sent unilaterally.
331
332 The server completion result response indicates the success or
333 failure of the operation. It is tagged with the same tag as the
334 client command which began the operation. Thus, if more than one
335
336
337
338Crispin [Page 2]
339
340RFC 1730 IMAP4 December 1994
341
342
343 command is in progress, the tag in a server completion response
344 identifies the command to which the response applies. There are
345 three possible server completion responses: OK (indicating success),
346 NO (indicating failure), or BAD (indicating protocol error such as
347 unrecognized command or command syntax error).
348
349 The protocol receiver of an IMAP4 client reads a response line from
350 the server. It then takes action on the response based upon the
351 first token of the response, which may be a tag, a "*", or a "+". As
352 described above.
353
354 A client MUST be prepared to accept any server response at all times.
355 This includes server data that it may not have requested. Server
356 data SHOULD be recorded, so that the client can reference its
357 recorded copy rather than sending a command to the server to request
358 the data. In the case of certain server data, recording the data is
359 mandatory.
360
361 This topic is discussed in greater detail in the Server Responses
362 section.
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394Crispin [Page 3]
395
396RFC 1730 IMAP4 December 1994
397
398
3993. State and Flow Diagram
400
401 An IMAP4 server is in one of four states. Most commands are valid in
402 only certain states. It is a protocol error for the client to
403 attempt a command while the command is in an inappropriate state. In
404 this case, a server will respond with a BAD or NO (depending upon
405 server implementation) command completion result.
406
407
4083.1. Non-Authenticated State
409
410 In non-authenticated state, the user must supply authentication
411 credentials before most commands will be permitted. This state is
412 entered when a connection starts unless the connection has been
413 pre-authenticated.
414
415
4163.2. Authenticated State
417
418 In authenticated state, the user is authenticated and must select a
419 mailbox to access before commands that affect messages will be
420 permitted. This state is entered when a pre-authenticated connection
421 starts, when acceptable authentication credentials have been
422 provided, or after an error in selecting a mailbox.
423
424
4253.3. Selected State
426
427 In selected state, a mailbox has been selected to access. This state
428 is entered when a mailbox has been successfully selected.
429
430
4313.4. Logout State
432
433 In logout state, the session is being terminated, and the server will
434 close the connection. This state can be entered as a result of a
435 client request or by unilateral server decision.
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450Crispin [Page 4]
451
452RFC 1730 IMAP4 December 1994
453
454
455 +--------------------------------------+
456 |initial connection and server greeting|
457 +--------------------------------------+
458 || (1) || (2) || (3)
459 VV || ||
460 +-----------------+ || ||
461 |non-authenticated| || ||
462 +-----------------+ || ||
463 || (7) || (4) || ||
464 || VV VV ||
465 || +----------------+ ||
466 || | authenticated |<=++ ||
467 || +----------------+ || ||
468 || || (7) || (5) || (6) ||
469 || || VV || ||
470 || || +--------+ || ||
471 || || |selected|==++ ||
472 || || +--------+ ||
473 || || || (7) ||
474 VV VV VV VV
475 +--------------------------------------+
476 | logout and close connection |
477 +--------------------------------------+
478
479 (1) connection without pre-authentication (OK greeting)
480 (2) pre-authenticated connection (PREAUTH greeting)
481 (3) rejected connection (BYE greeting)
482 (4) successful LOGIN or AUTHENTICATE command
483 (5) successful SELECT or EXAMINE command
484 (6) CLOSE command, or failed SELECT or EXAMINE command
485 (7) LOGOUT command, server shutdown, or connection closed
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506Crispin [Page 5]
507
508RFC 1730 IMAP4 December 1994
509
510
5114. Data Formats
512
513 IMAP4 uses textual commands and responses. Data in IMAP4 can be in
514 one of several forms: atom, number, string, parenthesized list, or
515 NIL.
516
517
5184.1. Atom
519
520 An atom consists of one or more non-special characters.
521
522
5234.2. Number
524
525 A number consists of one or more digit characters, and represents a
526 numeric value.
527
528
5294.3. String
530
531 A string is in one of two forms: literal and quoted string. The
532 literal form is the general form of string. The quoted string form
533 is an alternative that avoids the overhead of processing a literal at
534 the cost of restrictions of what may be in a quoted string.
535
536 A literal is a sequence of zero or more octets (including CR and LF),
537 prefix-quoted with an octet count in the form of an open brace ("{"),
538 the number of octets, close brace ("}"), and CRLF. In the case of
539 literals transmitted from server to client, the CRLF is immediately
540 followed by the octet data. In the case of literals transmitted from
541 client to server, the client must wait to receive a command
542 continuation request (described later in this document) before
543 sending the octet data (and the remainder of the command).
544
545 A quoted string is a sequence of zero or more 7-bit characters,
546 excluding CR and LF, with double quote (<">) characters at each end.
547
548 The empty string is respresented as either "" (a quoted string with
549 zero characters between double quotes) or as {0} followed by CRLF (a
550 literal with an octet count of 0).
551
552 Note: Even if the octet count is 0, a client transmitting a
553 literal must wait to receive a command continuation
554 request.
555
556
557
558
559
560
561
562Crispin [Page 6]
563
564RFC 1730 IMAP4 December 1994
565
566
5674.3.1. 8-bit and Binary Strings
568
569 8-bit textual and binary mail is supported through the use of
570 [MIME-1] encoding. IMAP4 implementations MAY transmit 8-bit or
571 multi-octet characters in literals, but should do so only when the
572 character set is identified.
573
574 Although a BINARY body encoding is defined, unencoded binary strings
575 are not permitted. A "binary string" is any string with NUL
576 characters. Implementations MUST encode binary data into a textual
577 form such as BASE64 before transmitting the data. A string with an
578 excessive amount of CTL characters may also be considered to be
579 binary, although this is not required.
580
581
5824.4. Parenthesized List
583
584 Data structures are represented as a "parenthesized list"; a sequence
585 of data items, delimited by space, and bounded at each end by
586 parentheses. A parenthesized list may itself contain other
587 parenthesized lists, using multiple levels of parentheses to indicate
588 nesting.
589
590 The empty list is represented as () -- a parenthesized list with no
591 members.
592
593
5944.5. NIL
595
596 The special atom "NIL" represents the non-existence of a particular
597 data item that is represented as a string or parenthesized list, as
598 distinct from the empty string "" or the empty parenthesized list ().
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618Crispin [Page 7]
619
620RFC 1730 IMAP4 December 1994
621
622
6235. Operational Considerations
624
6255.1. Mailbox Naming
626
627 The interpretation of mailbox names is implementation-dependent.
628 However, the mailbox name INBOX is a special name reserved to mean
629 "the primary mailbox for this user on this server". If it is desired
630 to export hierarchical mailbox names, mailbox names must be
631 left-to-right hierarchical using a single character to separate
632 levels of hierarchy. The same hierarchy separator character is used
633 for all levels of hierarchy within a single name.
634
6355.2. Mailbox Size and Message Status Updates
636
637 At any time, a server can send data that the client did not request.
638 Sometimes, such behavior is required. For example, agents other than
639 the server may add messages to the mailbox (e.g. new mail delivery),
640 change the flags of message in the mailbox (e.g. simultaneous access
641 to the same mailbox by multiple agents), or even remove messages from
642 the mailbox. A server MUST send mailbox size updates automatically
643 if a mailbox size change is observed during the processing of a
644 command. A server SHOULD send message flag updates automatically,
645 without requiring the client to request such updates explicitly.
646 Special rules exist for server notification of a client about the
647 removal of messages to prevent synchronization errors; see the
648 description of the EXPUNGE response for more details.
649
650 Regardless of what implementation decisions a client may take on
651 remembering data from the server, a client implementation MUST record
652 mailbox size updates. It MUST NOT assume that any command after
653 initial mailbox selection will return the size of the mailbox.
654
655
6565.3. Response when no Command in Progress
657
658 Server implementations are permitted to send an untagged response
659 (except for EXPUNGE) while there is no command in progress. Server
660 implementations that send such responses MUST deal with flow control
661 considerations. Specifically, they must either (1) verify that the
662 size of the data does not exceed the underlying transport's available
663 window size, or (2) use non-blocking writes.
664
665
666
667
668
669
670
671
672
673
674Crispin [Page 8]
675
676RFC 1730 IMAP4 December 1994
677
678
6795.4. Autologout Timer
680
681 If a server has an inactivity autologout timer, that timer MUST be of
682 at least 30 minutes' duration. The receipt of ANY command from the
683 client during that interval should suffice to reset the autologout
684 timer.
685
686
6875.5. Multiple Commands in Progress
688
689 The client is not required to wait for the completion result response
690 of a command before sending another command, subject to flow control
691 constraints on the underlying data stream. Similarly, a server is
692 not required to process a command to completion before beginning
693 processing of the next command, unless an ambiguity would result
694 because of a command that would affect the results of other commands.
695 If there is such an ambiguity, the server executes commands to
696 completion in the order given by the client.
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730Crispin [Page 9]
731
732RFC 1730 IMAP4 December 1994
733
734
7356. Client Commands
736
737 IMAP4 commands are described in this section. Commands are organized
738 by the state in which the command is permitted. Commands which are
739 permitted in multiple states are listed in the minimum permitted
740 state (for example, commands valid in authenticated and selected
741 state are listed in the authenticated state commands).
742
743 Command arguments, identified by "Arguments:" in the command
744 descriptions below, are described by function, not by syntax. The
745 precise syntax of command arguments is described in the Formal Syntax
746 section.
747
748 Some commands cause specific server data to be returned; these are
749 identified by "Data:" in the command descriptions below. See the
750 response descriptions in the Responses section for information on
751 these responses, and the Formal Syntax section for the precise syntax
752 of these responses. It is possible for server data to be transmitted
753 as a result of any command; thus, commands that do not specifically
754 require server data specify "no specific data for this command"
755 instead of "none".
756
757 The "Result:" in the command description refers to the possible
758 tagged status responses to a command, and any special interpretation
759 of these status responses.
760
761
7626.1. Client Commands - Any State
763
764 The following commands are valid in any state: CAPABILITY, NOOP, and
765 LOGOUT.
766
7676.1.1. CAPABILITY Command
768
769 Arguments: none
770
771 Data: mandatory untagged response: CAPABILITY
772
773 Result: OK - capability completed
774 BAD - command unknown or arguments invalid
775
776 The CAPABILITY command requests a listing of capabilities that the
777 server supports. The server MUST send a single untagged
778 CAPABILITY response with "IMAP4" as the first listed capability
779 before the (tagged) OK response. This listing of capabilities is
780 not dependent upon connection state or user. It is therefore not
781 necessary to issue a CAPABILITY command more than once in a
782 session.
783
784
785
786Crispin [Page 10]
787
788RFC 1730 IMAP4 December 1994
789
790
791 Capability names other than "IMAP4" refer to extensions,
792 revisions, or amendments to this specification. See the
793 documentation of the CAPABILITY response for additional
794 information. No capabilities are enabled without explicit client
795 action to invoke the capability. See the section entitled "Client
796 Commands - Experimental/Expansion" for information about the form
797 of site or implementation-specific capabilities.
798
799 Example: C: abcd CAPABILITY
800 S: * CAPABILITY IMAP4
801 S: abcd OK CAPABILITY completed
802
803
8046.1.2. NOOP Command
805
806 Arguments: none
807
808 Data: no specific data for this command (but see below)
809
810 Result: OK - noop completed
811 BAD - command unknown or arguments invalid
812
813 The NOOP command always succeeds. It does nothing.
814
815 Since any command can return a status update as untagged data, the
816 NOOP command can be used as a periodic poll for new messages or
817 message status updates during a period of inactivity. The NOOP
818 command can also be used to reset any inactivity autologout timer
819 on the server.
820
821 Example: C: a002 NOOP
822 S: a002 OK NOOP completed
823 . . .
824 C: a047 NOOP
825 S: * 22 EXPUNGE
826 S: * 23 EXISTS
827 S: * 3 RECENT
828 S: * 14 FETCH (FLAGS (\Seen \Deleted))
829 S: a047 OK NOOP completed
830
831
832
833
834
835
836
837
838
839
840
841
842Crispin [Page 11]
843
844RFC 1730 IMAP4 December 1994
845
846
8476.1.3. LOGOUT Command
848
849 Arguments: none
850
851 Data: mandatory untagged response: BYE
852
853 Result: OK - logout completed
854 BAD - command unknown or arguments invalid
855
856 The LOGOUT command informs the server that the client is done with
857 the session. The server must send a BYE untagged response before
858 the (tagged) OK response, and then close the network connection.
859
860 Example: C: A023 LOGOUT
861 S: * BYE IMAP4 Server logging out
862 S: A023 OK LOGOUT completed
863 (Server and client then close the connection)
864
865
866
8676.2. Client Commands - Non-Authenticated State
868
869 In non-authenticated state, the AUTHENTICATE or LOGIN command
870 establishes authentication and enter authenticated state. The
871 AUTHENTICATE command provides a general mechanism for a variety of
872 authentication techniques, whereas the LOGIN command uses the
873 traditional user name and plaintext password pair.
874
875 Server implementations may allow non-authenticated access to certain
876 mailboxes. The convention is to use a LOGIN command with the userid
877 "anonymous". A password is required. It is implementation-dependent
878 what requirements, if any, are placed on the password and what access
879 restrictions are placed on anonymous users.
880
881 Once authenticated (including as anonymous), it is not possible to
882 re-enter non-authenticated state.
883
884 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
885 the following commands are valid in non-authenticated state:
886 AUTHENTICATE and LOGIN.
887
888
889
890
891
892
893
894
895
896
897
898Crispin [Page 12]
899
900RFC 1730 IMAP4 December 1994
901
902
9036.2.1. AUTHENTICATE Command
904
905 Arguments: authentication mechanism name
906
907 Data: continuation data may be requested
908
909 Result: OK - authenticate completed, now in authenticated state
910 NO - authenticate failure: unsupported authentication
911 mechanism, credentials rejected
912 BAD - command unknown or arguments invalid,
913 authentication exchange cancelled
914
915 The AUTHENTICATE command indicates an authentication mechanism,
916 such as described in [IMAP-AUTH], to the server. If the server
917 supports the requested authentication mechanism, it performs an
918 authentication protocol exchange to authenticate and identify the
919 user. Optionally, it also negotiates a protection mechanism for
920 subsequent protocol interactions. If the requested authentication
921 mechanism is not supported, the server should reject the
922 AUTHENTICATE command by sending a tagged NO response.
923
924 The authentication protocol exchange consists of a series of
925 server challenges and client answers that are specific to the
926 authentication mechanism. A server challenge consists of a
927 command continuation request response with the "+" token followed
928 by a BASE64 encoded string. The client answer consists of a line
929 consisting of a BASE64 encoded string. If the client wishes to
930 cancel an authentication exchange, it should issue a line with a
931 single "*". If the server receives such an answer, it must reject
932 the AUTHENTICATE command by sending a tagged BAD response.
933
934 A protection mechanism provides integrity and privacy protection
935 to the protocol session. If a protection mechanism is negotiated,
936 it is applied to all subsequent data sent over the connection.
937 The protection mechanism takes effect immediately following the
938 CRLF that concludes the authentication exchange for the client,
939 and the CRLF of the tagged OK response for the server. Once the
940 protection mechanism is in effect, the stream of command and
941 response octets is processed into buffers of ciphertext. Each
942 buffer is transferred over the connection as a stream of octets
943 prepended with a four octet field in network byte order that
944 represents the length of the following data. The maximum
945 ciphertext buffer length is defined by the protection mechanism.
946
947 The server is not required to support any particular
948 authentication mechanism, nor are authentication mechanisms
949 required to support any protection mechanisms. If an AUTHENTICATE
950 command fails with a NO response, the client may try another
951
952
953
954Crispin [Page 13]
955
956RFC 1730 IMAP4 December 1994
957
958
959 authentication mechanism by issuing another AUTHENTICATE command,
960 or may attempt to authenticate by using the LOGIN command. In
961 other words, the client may request authentication types in
962 decreasing order of preference, with the LOGIN command as a last
963 resort.
964
965 Example: S: * OK KerberosV4 IMAP4 Server
966 C: A001 AUTHENTICATE KERBEROS_V4
967 S: + AmFYig==
968 C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
969 +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
970 WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
971 S: + or//EoAADZI=
972 C: DiAF5A4gA+oOIALuBkAAmw==
973 S: A001 OK Kerberos V4 authentication successful
974
975 Note: the line breaks in the first client answer are for
976 editorial clarity and are not in real authenticators.
977
978
9796.2.2. LOGIN Command
980
981 Arguments: user name
982 password
983
984 Data: no specific data for this command
985
986 Result: OK - login completed, now in authenticated state
987 NO - login failure: user name or password rejected
988 BAD - command unknown or arguments invalid
989
990 The LOGIN command identifies the user to the server and carries
991 the plaintext password authenticating this user.
992
993 Example: C: a001 LOGIN SMITH SESAME
994 S: a001 OK LOGIN completed
995
996
997
9986.3. Client Commands - Authenticated State
999
1000 In authenticated state, commands that manipulate mailboxes as atomic
1001 entities are permitted. Of these commands, the SELECT and EXAMINE
1002 commands will select a mailbox for access and enter selected state.
1003
1004
1005
1006
1007
1008
1009
1010Crispin [Page 14]
1011
1012RFC 1730 IMAP4 December 1994
1013
1014
1015 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
1016 the following commands are valid in authenticated state: SELECT,
1017 EXAMINE, CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB,
1018 and APPEND.
1019
10206.3.1. SELECT Command
1021
1022 Arguments: mailbox name
1023
1024 Data: mandatory untagged responses: FLAGS, EXISTS, RECENT
1025 optional OK untagged responses: UNSEEN, PERMANENTFLAGS
1026
1027 Result: OK - select completed, now in selected state
1028 NO - select failure, now in authenticated state: no
1029 such mailbox, can't access mailbox
1030 BAD - command unknown or arguments invalid
1031
1032 The SELECT command selects a mailbox so that messages in the
1033 mailbox can be accessed. Before returning an OK to the client,
1034 the server MUST send the following untagged data to the client:
1035
1036 FLAGS Defined flags in the mailbox
1037
1038 <n> EXISTS The number of messages in the mailbox
1039
1040 <n> RECENT The number of messages added to the mailbox since
1041 the previous time this mailbox was read
1042
1043 OK [UIDVALIDITY <n>]
1044 The unique identifier validity value. See the
1045 description of the UID command for more detail.
1046
1047 to define the initial state of the mailbox at the client. If it
1048 is not possible to determine the messages that were added since
1049 the previous time a mailbox was read, then all messages SHOULD be
1050 considered recent.
1051
1052 The server SHOULD also send an UNSEEN response code in an OK
1053 untagged response, indicating the message sequence number of the
1054 first unseen message in the mailbox.
1055
1056 If the client can not change the permanent state of one or more of
1057 the flags listed in the FLAGS untagged response, the server SHOULD
1058 send a PERMANENTFLAGS response code in an OK untagged response,
1059 listing the flags that the client may change permanently.
1060
1061 Only one mailbox may be selected at a time in a session;
1062 simultaneous access to multiple mailboxes requires multiple
1063
1064
1065
1066Crispin [Page 15]
1067
1068RFC 1730 IMAP4 December 1994
1069
1070
1071 sessions. The SELECT command automatically deselects any
1072 currently selected mailbox before attempting the new selection.
1073 Consequently, if a mailbox is selected and a SELECT command that
1074 fails is attempted, no mailbox is selected.
1075
1076 If the user is permitted to modify the mailbox, the server SHOULD
1077 prefix the text of the tagged OK response with the "[READ-WRITE]"
1078 response code.
1079
1080 If the user is not permitted to modify the mailbox but is
1081 permitted read access, the mailbox is selected as read-only, and
1082 the server MUST prefix the text of the tagged OK response to
1083 SELECT with the "[READ-ONLY]" response code. Read-only access
1084 through SELECT differs from the EXAMINE command in that certain
1085 read-only mailboxes may permit the change of permanent state on a
1086 per-user (as opposed to global) basis. Netnews messages marked in
1087 a user's .newsrc file are an example of such per-user permanent
1088 state that can be modified with read-only mailboxes.
1089
1090 Example: C: A142 SELECT INBOX
1091 S: * 172 EXISTS
1092 S: * 1 RECENT
1093 S: * OK [UNSEEN 12] Message 12 is first unseen
1094 S: * OK [UIDVALIDITY 3857529045] UIDs valid
1095 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
1096 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited
1097 S: A142 OK [READ-WRITE] SELECT completed
1098
1099
11006.3.2. EXAMINE Command
1101
1102 Arguments: mailbox name
1103
1104 Data: mandatory untagged responses: FLAGS, EXISTS, RECENT
1105 optional OK untagged responses: UNSEEN, PERMANENTFLAGS
1106
1107 Result: OK - examine completed, now in selected state
1108 NO - examine failure, now in authenticated state: no
1109 such mailbox, can't access mailbox
1110 BAD - command unknown or arguments invalid
1111
1112 The EXAMINE command is identical to SELECT and returns the same
1113 output; however, the selected mailbox is identified as read-only.
1114 No changes to the permanent state of the mailbox, including
1115 per-user state, are permitted.
1116
1117
1118
1119
1120
1121
1122Crispin [Page 16]
1123
1124RFC 1730 IMAP4 December 1994
1125
1126
1127 The text of the tagged OK response to the EXAMINE command MUST
1128 begin with the "[READ-ONLY]" response code.
1129
1130 Example: C: A932 EXAMINE blurdybloop
1131 S: * 17 EXISTS
1132 S: * 2 RECENT
1133 S: * OK [UNSEEN 8] Message 8 is first unseen
1134 S: * OK [UIDVALIDITY 3857529045] UIDs valid
1135 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
1136 S: * OK [PERMANENTFLAGS ()] No permanent flags permitted
1137 S: A932 OK [READ-ONLY] EXAMINE completed
1138
1139
11406.3.3. CREATE Command
1141
1142 Arguments: mailbox name
1143
1144 Data: no specific data for this command
1145
1146 Result: OK - create completed
1147 NO - create failure: can't create mailbox with that name
1148 BAD - command unknown or arguments invalid
1149
1150 The CREATE command creates a mailbox with the given name. An OK
1151 response is returned only if a new mailbox with that name has been
1152 created. It is an error to attempt to create INBOX or a mailbox
1153 with a name that refers to an extant mailbox. Any error in
1154 creation will return a tagged NO response.
1155
1156 If the mailbox name is suffixed with the server's hierarchy
1157 separator character (as returned from the server by a LIST
1158 command), this is a declaration that the client may, in the
1159 future, create mailbox names under this name in the hierarchy.
1160 Server implementations that do not require this declaration MUST
1161 ignore it.
1162
1163 If a new mailbox is created with the same name as a mailbox which
1164 was deleted, its unique identifiers MUST be greater than any
1165 unique identifiers used in the previous incarnation of the mailbox
1166 UNLESS the new incarnation has a different unique identifier
1167 validity value. See the description of the UID command for more
1168 detail.
1169
1170 Example: C: A003 CREATE owatagusiam/
1171 S: A003 OK CREATE completed
1172 C: A004 CREATE owatagusiam/blurdybloop
1173 S: A004 OK CREATE completed
1174
1175
1176
1177
1178Crispin [Page 17]
1179
1180RFC 1730 IMAP4 December 1994
1181
1182
1183 Note: the interpretation of this example depends on whether
1184 "/" was returned as the hierarchy separator from LIST. If
1185 "/" is the hierarchy separator, a new level of hierarchy
1186 named "owatagusiam" with a member called "blurdybloop" is
1187 created. Otherwise, two mailboxes at the same hierarchy
1188 level are created.
1189
1190
11916.3.4. DELETE Command
1192
1193 Arguments: mailbox name
1194
1195 Data: no specific data for this command
1196
1197 Result: OK - delete completed
1198 NO - delete failure: can't delete mailbox with that name
1199 BAD - command unknown or arguments invalid
1200
1201 The DELETE command permanently removes the mailbox with the given
1202 name. A tagged OK response is returned only if the mailbox has
1203 been deleted. It is an error to attempt to delete INBOX or a
1204 mailbox name that does not exist. Any error in deletion will
1205 return a tagged NO response.
1206
1207 The value of the highest-used unique indentifier of the deleted
1208 mailbox MUST be preserved so that a new mailbox created with the
1209 same name will not reuse the identifiers of the former
1210 incarnation, UNLESS the new incarnation has a different unique
1211 identifier validity value. See the description of the UID command
1212 for more detail.
1213
1214 Example: C: A683 DELETE blurdybloop
1215 S: A683 OK DELETE completed
1216
1217
12186.3.5. RENAME Command
1219
1220 Arguments: existing mailbox name
1221 new mailbox name
1222
1223 Data: no specific data for this command
1224
1225 Result: OK - rename completed
1226 NO - rename failure: can't rename mailbox with that name,
1227 can't rename to mailbox with that name
1228 BAD - command unknown or arguments invalid
1229
1230
1231
1232
1233
1234Crispin [Page 18]
1235
1236RFC 1730 IMAP4 December 1994
1237
1238
1239 The RENAME command changes the name of a mailbox. A tagged OK
1240 response is returned only if the mailbox has been renamed. It is
1241 an error to attempt to rename from a mailbox name that does not
1242 exist or to a mailbox name that already exists. Any error in
1243 renaming will return a tagged NO response.
1244
1245 Renaming INBOX is permitted; a new, empty INBOX is created in its
1246 place.
1247
1248 Example: C: Z4S9 RENAME blurdybloop owatagusiam
1249 S: Z4S9 OK RENAME completed
1250
1251
12526.3.6. SUBSCRIBE Command
1253
1254 Arguments: mailbox
1255
1256 Data: no specific data for this command
1257
1258 Result: OK - subscribe completed
1259 NO - subscribe failure: can't subscribe to that name
1260 BAD - command unknown or arguments invalid
1261
1262 The SUBSCRIBE command adds the specified mailbox name to the
1263 server's set of "active" or "subscribed" mailboxes as returned by
1264 the LSUB command. This command returns a tagged OK response only
1265 if the subscription is successful.
1266
1267 Example: C: A002 SUBSCRIBE #news.comp.mail.mime
1268 S: A002 OK SUBSCRIBE completed
1269
1270
12716.3.7. UNSUBSCRIBE Command
1272
1273 Arguments: mailbox name
1274
1275 Data: no specific data for this command
1276
1277 Result: OK - unsubscribe completed
1278 NO - unsubscribe failure: can't unsubscribe that name
1279 BAD - command unknown or arguments invalid
1280
1281 The UNSUBSCRIBE command removes the specified mailbox name from
1282 the server's set of "active" or "subscribed" mailboxes as returned
1283 by the LSUB command. This command returns a tagged OK response
1284 only if the unsubscription is successful.
1285
1286
1287
1288
1289
1290Crispin [Page 19]
1291
1292RFC 1730 IMAP4 December 1994
1293
1294
1295 Example: C: A002 UNSUBSCRIBE #news.comp.mail.mime
1296 S: A002 OK UNSUBSCRIBE completed
1297
1298
12996.3.8. LIST Command
1300
1301 Arguments: reference name
1302 mailbox name with possible wildcards
1303
1304 Data: untagged responses: LIST
1305
1306 Result: OK - list completed
1307 NO - list failure: can't list that reference or name
1308 BAD - command unknown or arguments invalid
1309
1310 The LIST command returns a subset of names from the complete set
1311 of all names available to the user. Zero or more untagged LIST
1312 replies are returned, containing the name attributes, hierarchy
1313 delimiter, and name; see the description of the LIST reply for
1314 more detail.
1315
1316 An empty ("" string) reference name argument indicates that the
1317 mailbox name is interpreted as by SELECT. The returned mailbox
1318 names MUST match the supplied mailbox name pattern. A non-empty
1319 reference name argument is the name of a mailbox or a level of
1320 mailbox hierarchy, and indicates a context in which the mailbox
1321 name is interpreted in an implementation-defined manner.
1322
1323 The reference and mailbox name arguments are interpreted, in an
1324 implementation-dependent fashion, into a canonical form that
1325 represents an unambiguous left-to-right hierarchy. The returned
1326 mailbox names will be in the interpreted form.
1327
1328 Any part of the reference argument that is included in the
1329 interpreted form SHOULD prefix the interpreted form. It should
1330 also be in the same form as the reference name argument. This
1331 rule permits the client to determine if the returned mailbox name
1332 is in the context of the reference argument, or if something about
1333 the mailbox argument overrode the reference argument. Without
1334 this rule, the client would have to have knowledge of the server's
1335 naming semantics including what characters are "breakouts" that
1336 override a naming context.
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346Crispin [Page 20]
1347
1348RFC 1730 IMAP4 December 1994
1349
1350
1351 For example, here are some examples of how references
1352 and mailbox names might be interpreted on a UNIX-based
1353 server:
1354
1355 Reference Mailbox Name Interpretation
1356 ------------ ------------ --------------
1357 ~smith/Mail/ foo.* ~smith/Mail/foo.*
1358 archive/ % archive/%
1359 #news. comp.mail.* #news.comp.mail.*
1360 ~smith/Mail/ /usr/doc/foo /usr/doc/foo
1361 archive/ ~fred/Mail/* ~fred/Mail/*
1362
1363 The first three examples demonstrate interpretations in
1364 the context of the reference argument. Note that
1365 "~smith/Mail" should not be transformed into something
1366 like "/u2/users/smith/Mail", or it would be impossible
1367 for the client to determine that the interpretation was
1368 in the context of the reference.
1369
1370 The character "*" is a wildcard, and matches zero or more
1371 characters at this position. The character "%" is similar to "*",
1372 but it does not match a hierarchy delimiter. If the "%" wildcard
1373 is the last character of a mailbox name argument, matching levels
1374 of hierarchy are also returned. If these levels of hierarchy are
1375 not also selectable mailboxes, they are returned with the
1376 \Noselect mailbox name attribute (see the description of the LIST
1377 response for more detail).
1378
1379 Server implementations are permitted to "hide" otherwise
1380 accessible mailboxes from the wildcard characters, by preventing
1381 certain characters or names from matching a wildcard in certain
1382 situations. For example, a UNIX-based server might restrict the
1383 interpretation of "*" so that an initial "/" character does not
1384 match.
1385
1386 The special name INBOX is included in the output from LIST if it
1387 matches the input arguments and INBOX is supported by this server
1388 for this user. The criteria for omitting INBOX is whether SELECT
1389 INBOX will return failure; it is not relevant whether the user's
1390 real INBOX resides on this or some other server.
1391
1392 Example: C: A002 LIST "~/Mail/" "%"
1393 S: * LIST (\Noselect) "/" ~/Mail/foo
1394 S: * LIST () "/" ~/Mail/meetings
1395 S: A002 OK LIST completed
1396
1397
1398
1399
1400
1401
1402Crispin [Page 21]
1403
1404RFC 1730 IMAP4 December 1994
1405
1406
14076.3.9. LSUB Command
1408
1409 Arguments: reference name
1410 mailbox name with possible wildcards
1411
1412 Data: untagged responses: LSUB
1413
1414 Result: OK - lsub completed
1415 NO - lsub failure: can't list that reference or name
1416 BAD - command unknown or arguments invalid
1417
1418 The LSUB command returns a subset of names from the set of names
1419 that the user has declared as being "active" or "subscribed".
1420 Zero or more untagged LSUB replies are returned. The arguments to
1421 LSUB are in the same form as those for LIST.
1422
1423 Example: C: A002 LSUB "#news." "comp.mail.*"
1424 S: * LSUB () "." #news.comp.mail.mime
1425 S: * LSUB () "." #news.comp.mail.misc
1426 S: A002 OK LSUB completed
1427
1428
14296.3.10. APPEND Command
1430
1431 Arguments: mailbox name
1432 optional flag parenthesized list
1433 optional date/time string
1434 message literal
1435
1436 Data: no specific data for this command
1437
1438 Result: OK - append completed
1439 NO - append error: can't append to that mailbox, error
1440 in flags or date/time or message text
1441 BAD - command unknown or arguments invalid
1442
1443 The APPEND command appends the literal argument as a new message
1444 in the specified destination mailbox. This argument is in the
1445 format of an [RFC-822] message. 8-bit characters are permitted in
1446 the message. A server implementation that is unable to preserve
1447 8-bit data properly MUST be able to reversibly convert 8-bit
1448 APPEND data to 7-bit using [MIME-1] encoding.
1449
1450 If a flag parenthesized list or date_time are specified, that data
1451 SHOULD be set in the resulting message; otherwise, the defaults of
1452 empty flags and the current date/time are used.
1453
1454
1455
1456
1457
1458Crispin [Page 22]
1459
1460RFC 1730 IMAP4 December 1994
1461
1462
1463 If the append is unsuccessful for any reason, the mailbox MUST be
1464 restored to its state before the APPEND attempt; no partial
1465 appending is permitted. If the mailbox is currently selected, the
1466 normal new mail actions should occur.
1467
1468 If the destination mailbox does not exist, a server MUST return an
1469 error, and MUST NOT automatically create the mailbox. Unless it
1470 is certain that the destination mailbox can not be created, the
1471 server MUST send the response code "[TRYCREATE]" as the prefix of
1472 the text of the tagged NO response. This gives a hint to the
1473 client that it can attempt a CREATE command and retry the APPEND
1474 if the CREATE is successful.
1475
1476 Example: C: A003 APPEND saved-messages (\Seen) {310}
1477 C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
1478 C: From: Fred Foobar <foobar@Blurdybloop.COM>
1479 C: Subject: afternoon meeting
1480 C: To: mooch@owatagu.siam.edu
1481 C: Message-Id: <B27397-0100000@Blurdybloop.COM>
1482 C: MIME-Version: 1.0
1483 C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
1484 C:
1485 C: Hello Joe, do you think we can meet at 3:30 tomorrow?
1486 C:
1487 S: A003 OK APPEND completed
1488
1489 Note: the APPEND command is not used for message delivery,
1490 because it does not provide a mechanism to transfer [SMTP]
1491 envelope information.
1492
1493
1494
14956.4. Client Commands - Selected State
1496
1497 In selected state, commands that manipulate messages in a mailbox are
1498 permitted.
1499
1500 In addition to the universal commands (CAPABILITY, NOOP, and LOGOUT),
1501 and the authenticated state commands (SELECT, EXAMINE, CREATE,
1502 DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB, FIND
1503 ALL.MAILBOXES, FIND MAILBOXES, and APPEND), the following commands
1504 are valid in the selected state: CHECK, CLOSE, EXPUNGE, SEARCH,
1505 FETCH, PARTIAL, STORE, COPY, and UID.
1506
1507
1508
1509
1510
1511
1512
1513
1514Crispin [Page 23]
1515
1516RFC 1730 IMAP4 December 1994
1517
1518
15196.4.1. CHECK Command
1520
1521 Arguments: none
1522
1523 Data: no specific data for this command
1524
1525 Result: OK - check completed
1526 BAD - command unknown or arguments invalid
1527
1528 The CHECK command requests a checkpoint of the currently selected
1529 mailbox. A checkpoint refers to any implementation-dependent
1530 housekeeping associated with the mailbox (e.g. resolving the
1531 server's in-memory state of the mailbox with the state on its
1532 disk) that is not normally executed as part of each command. A
1533 checkpoint may take a non-instantaneous amount of real time to
1534 complete. If a server implementation has no such housekeeping
1535 considerations, CHECK is equivalent to NOOP.
1536
1537 There is no guarantee that an EXISTS untagged response will happen
1538 as a result of CHECK. NOOP, not CHECK, should be used for new
1539 mail polling.
1540
1541 Example: C: FXXZ CHECK
1542 S: FXXZ OK CHECK Completed
1543
1544
15456.4.2. CLOSE Command
1546
1547 Arguments: none
1548
1549 Data: no specific data for this command
1550
1551 Result: OK - close completed, now in authenticated state
1552 NO - close failure: no mailbox selected
1553 BAD - command unknown or arguments invalid
1554
1555 The CLOSE command permanently removes from the currently selected
1556 mailbox all messages that have the \Deleted flag set, and returns
1557 to authenticated state from selected state. No untagged EXPUNGE
1558 responses are sent.
1559
1560 No messages are removed, and no error is given, if the mailbox is
1561 selected by an EXAMINE command or is otherwise selected read-only.
1562
1563 Even when a mailbox is selected, it is not required to send a
1564 CLOSE command before a SELECT, EXAMINE, or LOGOUT command. The
1565 SELECT, EXAMINE, and LOGOUT commands implicitly close the
1566 currently selected mailbox without doing an expunge. However,
1567
1568
1569
1570Crispin [Page 24]
1571
1572RFC 1730 IMAP4 December 1994
1573
1574
1575 when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT
1576 sequence is considerably faster than an EXPUNGE-LOGOUT or
1577 EXPUNGE-SELECT because no untagged EXPUNGE responses (which the
1578 client would probably ignore) are sent.
1579
1580 Example: C: A341 CLOSE
1581 S: A341 OK CLOSE completed
1582
1583
15846.4.3. EXPUNGE Command
1585
1586 Arguments: none
1587
1588 Data: untagged responses: EXPUNGE
1589
1590 Result: OK - expunge completed
1591 NO - expunge failure: can't expunge (e.g. permission
1592 denied)
1593 BAD - command unknown or arguments invalid
1594
1595 The EXPUNGE command permanently removes from the currently
1596 selected mailbox all messages that have the \Deleted flag set.
1597 Before returning an OK to the client, an untagged EXPUNGE response
1598 is sent for each message that is removed.
1599
1600 Example: C: A202 EXPUNGE
1601 S: * 3 EXPUNGE
1602 S: * 3 EXPUNGE
1603 S: * 5 EXPUNGE
1604 S: * 8 EXPUNGE
1605 S: A202 OK EXPUNGE completed
1606
1607 Note: in this example, messages 3, 4, 7, and 11 had the
1608 \Deleted flag set. See the description of the EXPUNGE
1609 response for further explanation.
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626Crispin [Page 25]
1627
1628RFC 1730 IMAP4 December 1994
1629
1630
16316.4.4. SEARCH Command
1632
1633 Arguments: optional character set specification
1634 searching criteria (one or more)
1635
1636 Data: mandatory untagged response: SEARCH
1637
1638 Result: OK - search completed
1639 NO - search error: can't search that character set or
1640 criteria
1641 BAD - command unknown or arguments invalid
1642
1643 The SEARCH command searches the mailbox for messages that match
1644 the given searching criteria. Searching criteria consist of one
1645 or more search keys. The untagged SEARCH response from the server
1646 contains a listing of message sequence numbers corresponding to
1647 those messages that match the searching criteria.
1648
1649 When multiple keys are specified, the result is the intersection
1650 (AND function) of all the messages that match those keys. For
1651 example, the criteria DELETED FROM "SMITH" SINCE 1-Feb-1994 refers
1652 to all deleted messages from Smith that were placed in the mailbox
1653 since February 1, 1994. A search key may also be a parenthesized
1654 list of one or more search keys (e.g. for use with the OR and NOT
1655 keys).
1656
1657 Server implementations MAY exclude [MIME-1] body parts with
1658 terminal content types other than TEXT and MESSAGE from
1659 consideration in SEARCH matching.
1660
1661 The optional character set specification consists of the word
1662 "CHARSET" followed by a registered MIME character set. It
1663 indicates the character set of the strings that appear in the
1664 search criteria. [MIME-2] strings that appear in RFC 822/MIME
1665 message headers, and [MIME-1] content transfer encodings, MUST be
1666 decoded before matching. Except for US-ASCII, it is not required
1667 that any particular character set be supported. If the server
1668 does not support the specified character set, it MUST return a
1669 tagged NO response (not a BAD).
1670
1671 In all search keys that use strings, a message matches the key if
1672 the string is a substring of the field. The matching is
1673 case-insensitive.
1674
1675
1676
1677
1678
1679
1680
1681
1682Crispin [Page 26]
1683
1684RFC 1730 IMAP4 December 1994
1685
1686
1687 The defined search keys are as follows. Refer to the Formal
1688 Syntax section for the precise syntactic definitions of the
1689 arguments.
1690
1691 <message set> Messages with message sequence numbers
1692 corresponding to the specified message sequence
1693 number set
1694
1695 ALL All messages in the mailbox; the default initial
1696 key for ANDing.
1697
1698 ANSWERED Messages with the \Answered flag set.
1699
1700 BCC <string> Messages that contain the specified string in the
1701 envelope structure's BCC field.
1702
1703 BEFORE <date> Messages whose internal date is earlier than the
1704 specified date.
1705
1706 BODY <string> Messages that contain the specified string in the
1707 body of the message.
1708
1709 CC <string> Messages that contain the specified string in the
1710 envelope structure's CC field.
1711
1712 DELETED Messages with the \Deleted flag set.
1713
1714 DRAFT Messages with the \Draft flag set.
1715
1716 FLAGGED Messages with the \Flagged flag set.
1717
1718 FROM <string> Messages that contain the specified string in the
1719 envelope structure's FROM field.
1720
1721 HEADER <field-name> <string>
1722 Messages that have a header with the specified
1723 field-name (as defined in [RFC-822]) and that
1724 contains the specified string in the [RFC-822]
1725 field-body.
1726
1727 KEYWORD <flag> Messages with the specified keyword set.
1728
1729 LARGER <n> Messages with an RFC822.SIZE larger than the
1730 specified number of octets.
1731
1732 NEW Messages that have the \Recent flag set but not the
1733 \Seen flag. This is functionally equivalent to
1734 "(RECENT UNSEEN)".
1735
1736
1737
1738Crispin [Page 27]
1739
1740RFC 1730 IMAP4 December 1994
1741
1742
1743 NOT <search-key>
1744 Messages that do not match the specified search
1745 key.
1746
1747 OLD Messages that do not have the \Recent flag set.
1748 This is functionally equivalent to "NOT RECENT" (as
1749 opposed to "NOT NEW").
1750
1751 ON <date> Messages whose internal date is within the
1752 specified date.
1753
1754 OR <search-key1> <search-key2>
1755 Messages that match either search key.
1756
1757 RECENT Messages that have the \Recent flag set.
1758
1759 SEEN Messages that have the \Seen flag set.
1760
1761 SENTBEFORE <date>
1762 Messages whose [RFC-822] Date: header is earlier
1763 than the specified date.
1764
1765 SENTON <date> Messages whose [RFC-822] Date: header is within the
1766 specified date.
1767
1768 SENTSINCE <date>
1769 Messages whose [RFC-822] Date: header is within or
1770 later than the specified date.
1771
1772 SINCE <date> Messages whose internal date is within or later
1773 than the specified date.
1774
1775 SMALLER <n> Messages with an RFC822.SIZE smaller than the
1776 specified number of octets.
1777
1778 SUBJECT <string>
1779 Messages that contain the specified string in the
1780 envelope structure's SUBJECT field.
1781
1782 TEXT <string> Messages that contain the specified string in the
1783 header or body of the message.
1784
1785 TO <string> Messages that contain the specified string in the
1786 envelope structure's TO field.
1787
1788 UID <message set>
1789 Messages with unique identifiers corresponding to
1790 the specified unique identifier set.
1791
1792
1793
1794Crispin [Page 28]
1795
1796RFC 1730 IMAP4 December 1994
1797
1798
1799 UNANSWERED Messages that do not have the \Answered flag set.
1800
1801 UNDELETED Messages that do not have the \Deleted flag set.
1802
1803 UNDRAFT Messages that do not have the \Draft flag set.
1804
1805 UNFLAGGED Messages that do not have the \Flagged flag set.
1806
1807 UNKEYWORD <flag>
1808 Messages that do not have the specified keyword
1809 set.
1810
1811 UNSEEN Messages that do not have the \Seen flag set.
1812
1813
1814 Example: C: A282 SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith"
1815 S: * SEARCH 2 84 882
1816 S: A282 OK SEARCH completed
1817
1818
18196.4.5. FETCH Command
1820
1821 Arguments: message set
1822 message data item names
1823
1824 Data: untagged responses: FETCH
1825
1826 Result: OK - fetch completed
1827 NO - fetch error: can't fetch that data
1828 BAD - command unknown or arguments invalid
1829
1830 The FETCH command retrieves data associated with a message in the
1831 mailbox. The data items to be fetched may be either a single atom
1832 or a parenthesized list. The currently defined data items that
1833 can be fetched are:
1834
1835 ALL Macro equivalent to: (FLAGS INTERNALDATE
1836 RFC822.SIZE ENVELOPE)
1837
1838 BODY Non-extensible form of BODYSTRUCTURE.
1839
1840 BODY[<section>]
1841 The text of a particular body section. The section
1842 specification is a set of one or more part numbers
1843 delimited by periods.
1844
1845 Single-part messages only have a part 1.
1846
1847
1848
1849
1850Crispin [Page 29]
1851
1852RFC 1730 IMAP4 December 1994
1853
1854
1855 Multipart messages are assigned consecutive part
1856 numbers, as they occur in the message. If a
1857 particular part is of type message or multipart,
1858 its parts must be indicated by a period followed by
1859 the part number within that nested multipart part.
1860 It is not permitted to fetch a multipart part
1861 itself, only its individual members.
1862
1863 A part of type MESSAGE and subtype RFC822 also has
1864 nested parts. These are the parts of the MESSAGE
1865 part's body. Nested part 0 of a part of type
1866 MESSAGE and subtype RFC822 is the [RFC-822] header
1867 of the message.
1868
1869 Every message has at least one part.
1870
1871 Here is an example of a complex message
1872 with its associated section
1873 specifications:
1874
1875 0 ([RFC-822] header of the message)
1876 MULTIPART/MIXED
1877 1 TEXT/PLAIN
1878 2 APPLICATION/OCTET-STREAM
1879 3 MESSAGE/RFC822
1880 3.0 ([RFC-822] header of the message)
1881 3.1 TEXT/PLAIN
1882 3.2 APPLICATION/OCTET-STREAM
1883 MULTIPART/MIXED
1884 4.1 IMAGE/GIF
1885 4.2 MESSAGE/RFC822
1886 4.2.0 ([RFC-822] header of the message)
1887 4.2.1 TEXT/PLAIN
1888 MULTIPART/ALTERNATIVE
1889 4.2.2.1 TEXT/PLAIN
1890 4.2.2.2 TEXT/RICHTEXT
1891
1892 Note that there is no section
1893 specification for the Multi-part parts
1894 (no section 4 or 4.2.2).
1895
1896 The \Seen flag is implicitly set; if this causes
1897 the flags to change they should be included as part
1898 of the fetch responses.
1899
1900 BODY.PEEK[<section>]
1901 An alternate form of BODY[section] that does not
1902 implicitly set the \Seen flag.
1903
1904
1905
1906Crispin [Page 30]
1907
1908RFC 1730 IMAP4 December 1994
1909
1910
1911 BODYSTRUCTURE The [MIME-1] body structure of the message. This
1912 is computed by the server by parsing the [MIME-1]
1913 header lines.
1914
1915 ENVELOPE The envelope structure of the message. This is
1916 computed by the server by parsing the [RFC-822]
1917 header into the component parts, defaulting various
1918 fields as necessary.
1919
1920 FAST Macro equivalent to: (FLAGS INTERNALDATE
1921 RFC822.SIZE)
1922
1923 FLAGS The flags that are set for this message.
1924
1925 FULL Macro equivalent to: (FLAGS INTERNALDATE
1926 RFC822.SIZE ENVELOPE BODY)
1927
1928 INTERNALDATE The date and time of final delivery of the message
1929 as defined by RFC 821.
1930
1931 RFC822 The message in [RFC-822] format. The \Seen flag is
1932 implicitly set; if this causes the flags to change
1933 they should be included as part of the fetch
1934 responses. This is the concatenation of
1935 RFC822.HEADER and RFC822.TEXT.
1936
1937 RFC822.PEEK An alternate form of RFC822 that does not
1938 implicitly set the \Seen flag.
1939
1940 RFC822.HEADER The [RFC-822] format header of the message as
1941 stored on the server including the delimiting blank
1942 line between the header and the body.
1943
1944 RFC822.HEADER.LINES <header_list>
1945 All header lines (including continuation lines) of
1946 the [RFC-822] format header of the message with a
1947 field-name (as defined in [RFC-822]) that matches
1948 any of the strings in header_list. The matching is
1949 case-insensitive but otherwise exact. The
1950 delimiting blank line between the header and the
1951 body is always included.
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962Crispin [Page 31]
1963
1964RFC 1730 IMAP4 December 1994
1965
1966
1967 RFC822.HEADER.LINES.NOT <header_list>
1968 All header lines (including continuation lines) of
1969 the [RFC-822] format header of the message with a
1970 field-name (as defined in [RFC-822]) that does not
1971 match any of the strings in header_list. The
1972 matching is case-insensitive but otherwise exact.
1973 The delimiting blank line between the header and
1974 the body is always included.
1975
1976 RFC822.SIZE The number of octets in the message, as expressed
1977 in [RFC-822] format.
1978
1979 RFC822.TEXT The text body of the message, omitting the
1980 [RFC-822] header. The \Seen flag is implicitly
1981 set; if this causes the flags to change they should
1982 be included as part of the fetch responses.
1983
1984 RFC822.TEXT.PEEK
1985 An alternate form of RFC822.TEXT that does not
1986 implicitly set the \Seen flag.
1987
1988 UID The unique identifier for the message.
1989
1990
1991 Example: C: A654 FETCH 2:4 (FLAGS RFC822.HEADER.LINES (DATE FROM))
1992 S: * 2 FETCH ....
1993 S: * 3 FETCH ....
1994 S: * 4 FETCH ....
1995 S: A003 OK FETCH completed
1996
1997
19986.4.6. PARTIAL Command
1999
2000 Arguments: message sequence number
2001 message data item name
2002 position of first octet
2003 number of octets
2004
2005 Data: untagged responses: FETCH
2006
2007 Result: OK - partial completed
2008 NO - partial error: can't fetch that data
2009 BAD - command unknown or arguments invalid
2010
2011 The PARTIAL command is equivalent to the associated FETCH command,
2012 with the added functionality that only the specified number of
2013 octets, beginning at the specified starting octet, are returned.
2014 Only a single message can be fetched at a time. The first octet
2015
2016
2017
2018Crispin [Page 32]
2019
2020RFC 1730 IMAP4 December 1994
2021
2022
2023 of a message, and hence the minimum for the starting octet, is
2024 octet 1.
2025
2026 The following FETCH items are valid data for PARTIAL: RFC822,
2027 RFC822.HEADER, RFC822.TEXT, BODY[section], as well as any .PEEK
2028 forms of these.
2029
2030 Any partial fetch that attempts to read beyond the end of the text
2031 is truncated as appropriate. If the starting octet is beyond the
2032 end of the text, an empty string is returned.
2033
2034 The data are returned with the FETCH response. There is no
2035 indication of the range of the partial data in this response. It
2036 is not possible to stream multiple PARTIAL commands of the same
2037 data item without processing and synchronizing at each step, since
2038 streamed commands may be executed out of order.
2039
2040 There is no requirement that partial fetches follow any sequence.
2041 For example, if a partial fetch of octets 1 through 10000 breaks
2042 in an awkward place for BASE64 decoding, it is permitted to
2043 continue with a partial fetch of 9987 through 19987, etc.
2044
2045 The handling of the \Seen flag is the same as in the associated
2046 FETCH command.
2047
2048 Example: C: A005 PARTIAL 4 RFC822 1 1024
2049 S: * 1 FETCH (RFC822 {1024}
2050 S: Return-Path: <gray@cac.washington.edu>
2051 S: ...
2052 S: ......... FLAGS (\Seen))
2053 S: A005 OK PARTIAL completed
2054
2055
20566.4.7. STORE Command
2057
2058 Arguments: message set
2059 message data item name
2060 value for message data item
2061
2062 Data: untagged responses: FETCH
2063
2064 Result: OK - store completed
2065 NO - store error: can't store that data
2066 BAD - command unknown or arguments invalid
2067
2068 The STORE command alters data associated with a message in the
2069 mailbox. Normally, STORE will return the updated value of the
2070 data with an untagged FETCH response. A suffix of ".SILENT" in
2071
2072
2073
2074Crispin [Page 33]
2075
2076RFC 1730 IMAP4 December 1994
2077
2078
2079 the data item name prevents the untagged FETCH, and the server
2080 should assume that the client has determined the updated value
2081 itself or does not care about the updated value.
2082
2083 The currently defined data items that can be stored are:
2084
2085 FLAGS <flag list>
2086 Replace the flags for the message with the
2087 argument. The new value of the flags are returned
2088 as if a FETCH of those flags was done.
2089
2090 FLAGS.SILENT <flag list>
2091 Equivalent to FLAGS, but without returning a new
2092 value.
2093
2094 +FLAGS <flag list>
2095 Add the argument to the flags for the message. The
2096 new value of the flags are returned as if a FETCH
2097 of those flags was done.
2098
2099 +FLAGS.SILENT <flag list>
2100 Equivalent to +FLAGS, but without returning a new
2101 value.
2102
2103 -FLAGS <flag list>
2104 Remove the argument from the flags for the message.
2105 The new value of the flags are returned as if a
2106 FETCH of those flags was done.
2107
2108 -FLAGS.SILENT <flag list>
2109 Equivalent to -FLAGS, but without returning a new
2110 value.
2111
2112
2113 Example: C: A003 STORE 2:4 +FLAGS (\Deleted)
2114 S: * 2 FETCH FLAGS (\Deleted \Seen)
2115 S: * 3 FETCH FLAGS (\Deleted)
2116 S: * 4 FETCH FLAGS (\Deleted \Flagged \Seen)
2117 S: A003 OK STORE completed
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130Crispin [Page 34]
2131
2132RFC 1730 IMAP4 December 1994
2133
2134
21356.4.8. COPY Command
2136
2137 Arguments: message set
2138 mailbox name
2139
2140 Data: no specific data for this command
2141
2142 Result: OK - copy completed
2143 NO - copy error: can't copy those messages or to that
2144 name
2145 BAD - command unknown or arguments invalid
2146
2147 The COPY command copies the specified message(s) to the specified
2148 destination mailbox. The flags and internal date of the
2149 message(s) SHOULD be preserved in the copy.
2150
2151 If the destination mailbox does not exist, a server SHOULD return
2152 an error. It SHOULD NOT automatically create the mailbox. Unless
2153 it is certain that the destination mailbox can not be created, the
2154 server MUST send the response code "[TRYCREATE]" as the prefix of
2155 the text of the tagged NO response. This gives a hint to the
2156 client that it can attempt a CREATE command and retry the COPY if
2157 the CREATE is successful.
2158
2159 If the COPY command is unsuccessful for any reason, server
2160 implementations MUST restore the destination mailbox to its state
2161 before the COPY attempt.
2162
2163 Example: C: A003 COPY 2:4 MEETING
2164 S: A003 OK COPY completed
2165
2166
21676.4.9. UID Command
2168
2169 Arguments: command name
2170 command arguments
2171
2172 Data: untagged responses: FETCH, SEARCH
2173
2174 Result: OK - UID command completed
2175 NO - UID command error
2176 BAD - command unknown or arguments invalid
2177
2178 The UID command has two forms. In the first form, it takes as its
2179 arguments a COPY, FETCH, or STORE command with arguments
2180 appropriate for the associated command. However, the numbers in
2181 the message set argument are unique identifiers instead of message
2182 sequence numbers.
2183
2184
2185
2186Crispin [Page 35]
2187
2188RFC 1730 IMAP4 December 1994
2189
2190
2191 In the second form, the UID command takes a SEARCH command with
2192 SEARCH command arguments. The interpretation of the arguments is
2193 the same as with SEARCH; however, the numbers returned in a SEARCH
2194 response for a UID SEARCH command are unique identifiers instead
2195 of message sequence numbers. For example, the command UID SEARCH
2196 1:100 UID 443:557 returns the unique identifiers corresponding to
2197 the intersection of the message sequence number set 1:100 and the
2198 UID set 443:557.
2199
2200 A unique identifier of a message is a number, and is guaranteed
2201 not to refer to any other message in the mailbox. Unique
2202 identifiers are assigned in a strictly ascending fashion for each
2203 message added to the mailbox. Unlike message sequence numbers,
2204 unique identifiers persist across sessions. This permits a client
2205 to resynchronize its state from a previous session with the server
2206 (e.g. disconnected or offline access clients); this is discussed
2207 further in [IMAP-DISC].
2208
2209 Associated with every mailbox is a unique identifier validity
2210 value, which is sent in an UIDVALIDITY response code in an OK
2211 untagged response at message selection time. If unique
2212 identifiers from an earlier session fail to persist to this
2213 session, the unique identifier validity value MUST be greater than
2214 in the earlier session.
2215
2216 Note: An example of a good value to use for the unique
2217 identifier validity value would be a 32-bit
2218 representation of the creation date/time of the mailbox.
2219 It is alright to use a constant such as 1, but only if
2220 it guaranteed that unique identifers will never be
2221 reused, even in the case of a mailbox being deleted and
2222 a new mailbox by the same name created at some future
2223 time.
2224
2225
2226 Message set ranges are permitted; however, there is no guarantee
2227 that unique identifiers be contiguous. A non-existent unique
2228 identifier within a message set range is ignored without any error
2229 message generated.
2230
2231 The number after the "*" in an untagged FETCH response is always a
2232 message sequence number, not a unique identifier, even for a UID
2233 command response. However, server implementations MUST implicitly
2234 include the UID message data item as part of any FETCH response
2235 caused by a UID command, regardless of whether UID was specified
2236 as a message data item to the FETCH.
2237
2238
2239
2240
2241
2242Crispin [Page 36]
2243
2244RFC 1730 IMAP4 December 1994
2245
2246
2247 Example: C: A003 UID FETCH 4827313:4828442 FLAGS
2248 S: * 23 FETCH (FLAGS (\Seen) UID 4827313)
2249 S: * 24 FETCH (FLAGS (\Seen) UID 4827943)
2250 S: * 25 FETCH (FLAGS (\Seen) UID 4828442)
2251 S: A999 UID FETCH completed
2252
2253
2254
22556.5. Client Commands - Experimental/Expansion
2256
2257
22586.5.1. X<atom> Command
2259
2260 Arguments: implementation defined
2261
2262 Data: implementation defined
2263
2264 Result: OK - command completed
2265 NO - failure
2266 BAD - command unknown or arguments invalid
2267
2268 Any command prefixed with an X is an experimental command.
2269 Commands which are not part of this specification, or a standard
2270 or standards-track revision of this specification, MUST use the X
2271 prefix.
2272
2273 Any added untagged responses issued by an experimental command
2274 MUST also be prefixed with an X. Server implementations MUST NOT
2275 send any such untagged responses, unless the client requested it
2276 by issuing the associated experimental command.
2277
2278 Example: C: a441 CAPABILITY
2279 S: * CAPABILITY IMAP4 XPIG-LATIN
2280 S: a441 OK CAPABILITY completed
2281 C: A442 XPIG-LATIN
2282 S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay
2283 S: A442 OK XPIG-LATIN ompleted-cay
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298Crispin [Page 37]
2299
2300RFC 1730 IMAP4 December 1994
2301
2302
23037. Server Responses
2304
2305 Server responses are in three forms: status responses, server data,
2306 and command continuation request.
2307
2308 Server response data, identified by "Data:" in the response
2309 descriptions below, are described by function, not by syntax. The
2310 precise syntax of server response data is described in the Formal
2311 Syntax section.
2312
2313 The client MUST be prepared to accept any response at all times.
2314
2315 Status responses that are tagged indicate the completion result of a
2316 client command, and have a tag matching the command.
2317
2318 Some status responses, and all server data, are untagged. An
2319 untagged response is indicated by the token "*" instead of a tag.
2320 Untagged status responses indicate server greeting, or server status
2321 that does not indicate the completion of a command. For historical
2322 reasons, untagged server data responses are also called "unsolicited
2323 data", although strictly speaking only unilateral server data is
2324 truly "unsolicited".
2325
2326 Certain server data MUST be recorded by the client when it is
2327 received; this is noted in the description of that data. Such data
2328 conveys critical information which affects the interpretation of all
2329 subsequent commands and responses (e.g. updates reflecting the
2330 creation or destruction of messags).
2331
2332 Other server data SHOULD be recorded for later reference; if the
2333 client does not need to record the data, or if recording the data has
2334 no obvious purpose (e.g. a SEARCH response when no SEARCH command is
2335 in progress), the data SHOULD be ignored.
2336
2337 An example of unilateral untagged responses occurs when the IMAP
2338 connection is in selected state. In selected state, the server
2339 checks the mailbox for new messages as part of the execution of each
2340 command. If new messages are found, the server sends untagged EXISTS
2341 and RECENT responses reflecting the new size of the mailbox. Server
2342 implementations that offer multiple simultaneous access to the same
2343 mailbox should also send appropriate unilateral untagged FETCH and
2344 EXPUNGE responses if another agent changes the state of any message
2345 flags or expunges any messages.
2346
2347 Command continuation request responses use the token "+" instead of a
2348 tag. These responses are sent by the server to indicate acceptance
2349 of an incomplete client command and readiness for the remainder of
2350 the command.
2351
2352
2353
2354Crispin [Page 38]
2355
2356RFC 1730 IMAP4 December 1994
2357
2358
23597.1. Server Responses - Status Responses
2360
2361 Status responses may include an optional response code. A response
2362 code consists of data inside square brackets in the form of an atom,
2363 possibly followed by a space and arguments. The response code
2364 contains additional information or status codes for client software
2365 beyond the OK/NO/BAD condition, and are defined when there is a
2366 specific action that a client can take based upon the additional
2367 information.
2368
2369 The currently defined response codes are:
2370
2371 ALERT The human-readable text contains a special alert
2372 that MUST be presented to the user in a fashion
2373 that calls the user's attention to the message.
2374
2375 PARSE The human-readable text represents an error in
2376 parsing the [RFC-822] or [MIME-1] headers of a
2377 message in the mailbox.
2378
2379 PERMANENTFLAGS Followed by a parenthesized list of flags,
2380 indicates which of the known flags that the client
2381 may change permanently. Any flags that are in the
2382 FLAGS untagged response, but not the PERMANENTFLAGS
2383 list, can not be set permanently. If the client
2384 attempts to STORE a flag that is not in the
2385 PERMANENTFLAGS list, the server will either reject
2386 it with a NO reply or store the state for the
2387 remainder of the current session only. The
2388 PERMANENTFLAGS list may also include the special
2389 flag \*, which indicates that it is possible to
2390 create new keywords by attempting to store those
2391 flags in the mailbox.
2392
2393 READ-ONLY The mailbox is selected read-only, or its access
2394 while selected has changed from read-write to
2395 read-only.
2396
2397 READ-WRITE The mailbox is selected read-write, or its access
2398 while selected has changed from read-only to
2399 read-write.
2400
2401 TRYCREATE An APPEND or COPY attempt is failing because the
2402 target mailbox does not exist (as opposed to some
2403 other reason). This is a hint to the client that
2404 the operation may succeed if the mailbox is first
2405 created by the CREATE command.
2406
2407
2408
2409
2410Crispin [Page 39]
2411
2412RFC 1730 IMAP4 December 1994
2413
2414
2415 UIDVALIDITY Followed by a decimal number, indicates the unique
2416 identifier validity value. See the description of
2417 the UID command for more detail.
2418
2419 UNSEEN Followed by a decimal number, indicates the number
2420 of the first message without the \Seen flag set.
2421
2422 Additional response codes defined by particular client or server
2423 implementations should be prefixed with an "X" until they are
2424 added to a revision of this protocol. Client implementations
2425 should ignore response codes that they do not recognize.
2426
2427
24287.1.1. OK Response
2429
2430 Data: optional response code
2431 human-readable text
2432
2433 The OK response indicates an information message from the server.
2434 When tagged, it indicates successful completion of the associated
2435 command. The human-readable text may be presented to the user as
2436 an information message. The untagged form indicates an
2437 information-only message; the nature of the information may be
2438 indicated by a response code.
2439
2440 The untagged form is also used as one of three possible greetings
2441 at session startup. It indicates that the session is not yet
2442 authenticated and that a LOGIN command is needed.
2443
2444 Example: S: * OK IMAP4 server ready
2445 C: A001 LOGIN fred blurdybloop
2446 S: * OK [ALERT] System shutdown in 10 minutes
2447 S: A001 OK LOGIN Completed
2448
2449
24507.1.2. NO Response
2451
2452 Data: optional response code
2453 human-readable text
2454
2455 The NO response indicates an operational error message from the
2456 server. When tagged, it indicates unsuccessful completion of the
2457 associated command. The untagged form indicates a warning; the
2458 command may still complete successfully. The human-readable text
2459 describes the condition.
2460
2461
2462
2463
2464
2465
2466Crispin [Page 40]
2467
2468RFC 1730 IMAP4 December 1994
2469
2470
2471 Example: C: A222 COPY 1:2 owatagusiam
2472 S: * NO Disk is 98% full, please delete unnecessary data
2473 S: A222 OK COPY completed
2474 C: A222 COPY 3:200 blurdybloop
2475 S: * NO Disk is 98% full, please delete unnecessary data
2476 S: * NO Disk is 99% full, please delete unnecessary data
2477 S: A222 NO COPY failed: disk is full
2478
2479
24807.1.3. BAD Response
2481
2482 Data: optional response code
2483 human-readable text
2484
2485 The BAD response indicates an error message from the server. When
2486 tagged, it reports a protocol-level error in the client's command;
2487 the tag indicates the command that caused the error. The untagged
2488 form indicates a protocol-level error for which the associated
2489 command can not be determined; it may also indicate an internal
2490 server failure. The human-readable text describes the condition.
2491
2492 Example: C: ...very long command line...
2493 S: * BAD Command line too long
2494 C: ...empty line...
2495 S: * BAD Empty command line
2496 C: A443 EXPUNGE
2497 S: * BAD Disk crash, attempting salvage to a new disk!
2498 S: * OK Salvage successful, no data lost
2499 S: A443 OK Expunge completed
2500
2501
25027.1.4. PREAUTH Response
2503
2504 Data: optional response code
2505 human-readable text
2506
2507 The PREAUTH response is always untagged, and is one of three
2508 possible greetings at session startup. It indicates that the
2509 session has already been authenticated by external means and thus
2510 no LOGIN command is needed.
2511
2512 Example: S: * PREAUTH IMAP4 server ready and logged in as Smith
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522Crispin [Page 41]
2523
2524RFC 1730 IMAP4 December 1994
2525
2526
25277.1.5. BYE Response
2528
2529 Data: optional response code
2530 human-readable text
2531
2532 The BYE response is always untagged, and indicates that the server
2533 is about to close the connection. The human-readable text may be
2534 displayed to the user in a status report by the client. The BYE
2535 response may be sent as part of a normal logout sequence, or as a
2536 panic shutdown announcement by the server. It is also used by
2537 some server implementations as an announcement of an inactivity
2538 autologout.
2539
2540 This response is also used as one of three possible greetings at
2541 session startup. It indicates that the server is not willing to
2542 accept a session from this client.
2543
2544 Example: S: * BYE Autologout; idle for too long
2545
2546
2547
25487.2. Server Responses - Server and Mailbox Status
2549
2550 These responses are always untagged. This is how server data are
2551 transmitted from the server to the client, often as a result of a
2552 command with the same name.
2553
25547.2.1. CAPABILITY Response
2555
2556 Data: capability listing
2557
2558 The CAPABILITY response occurs as a result of a CAPABILITY
2559 command. The capability listing contains a space-separated
2560 listing of capability names that the server supports. The first
2561 name in the capability listing MUST be the atom "IMAP4".
2562
2563 A capability name other than IMAP4 indicates that the server
2564 supports an extension, revision, or amendment to the IMAP4
2565 protocol. Server responses MUST conform to this document until
2566 the client issues a command that uses the associated capability.
2567
2568 Capability names MUST either begin with "X" or be standard or
2569 standards-track IMAP4 extensions, revisions, or amendments
2570 registered with IANA. A server MUST NOT offer unregistered or
2571 non-standard capability names, unless such names are prefixed with
2572 an "X".
2573
2574
2575
2576
2577
2578Crispin [Page 42]
2579
2580RFC 1730 IMAP4 December 1994
2581
2582
2583 Client implementations SHOULD NOT require any capability name
2584 other than "IMAP4", and MUST ignore any unknown capability names.
2585
2586 Example: S: * CAPABILITY IMAP4 XPIG-LATIN
2587
2588
25897.2.2. LIST Response
2590
2591 Data: name attributes
2592 hierarchy delimiter
2593 name
2594
2595 The LIST response occurs as a result of a LIST command. It
2596 returns a single name that matches the LIST specification. There
2597 may be multiple LIST responses for a single LIST command.
2598
2599 Four name attributes are defined:
2600
2601 \Noinferiors It is not possible for any child levels of
2602 hierarchy to exist under this name; no child levels
2603 exist now and none can be created in the future.
2604
2605 \Noselect It is not possible to use this name as a selectable
2606 mailbox.
2607
2608 \Marked The mailbox has been marked "interesting" by the
2609 server; the mailbox probably contains messages that
2610 have been added since the last time the mailbox was
2611 selected.
2612
2613 \Unmarked The mailbox does not contain any additional
2614 messages since the last time the mailbox was
2615 selected.
2616
2617 If it is not feasible for the server to determine whether the
2618 mailbox is "interesting" or not, or if the name is a \Noselect
2619 name, the server should not send either \Marked or \Unmarked.
2620
2621 The hierarchy delimiter is a character used to delimit levels of
2622 hierarchy in a mailbox name. A client may use it to create child
2623 mailboxes, and to search higher or lower levels of naming
2624 hierarchy. All children of a top-level hierarchy node must use
2625 the same separator character. A NIL hierarchy delimiter means
2626 that no hierarchy exists; the name is a "flat" name.
2627
2628
2629
2630
2631
2632
2633
2634Crispin [Page 43]
2635
2636RFC 1730 IMAP4 December 1994
2637
2638
2639 The name represents an unambiguous left-to-right hierarchy, and
2640 MUST be valid for use as a reference in LIST and LSUB commands.
2641 Unless \Noselect is indicated, the name must also be valid as an
2642 argument for commands, such as SELECT, that accept mailbox names.
2643
2644 Example: S: * LIST (\Noselect) "/" ~/Mail/foo
2645
2646
26477.2.3. LSUB Response
2648
2649 Data: name attributes
2650 hierarchy delimiter
2651 name
2652
2653 The LSUB response occurs as a result of an LSUB command. It
2654 returns a single name that matches the LSUB specification. There
2655 may be multiple LSUB responses for a single LSUB command. The
2656 data is identical in format to the LIST response.
2657
2658 Example: S: * LSUB () "." #news.comp.mail.misc
2659
2660
26617.2.4. SEARCH Response
2662
2663 Data: zero or more numbers
2664
2665 The SEARCH response occurs as a result of a SEARCH or UID SEARCH
2666 command. The number(s) refer to those messages that match the
2667 search criteria. For SEARCH, these are message sequence numbers;
2668 for UID SEARCH, these are unique identifiers. Each number is
2669 delimited by a space.
2670
2671 Example: S: * SEARCH 2 3 6
2672
2673
26747.2.5. FLAGS Response
2675
2676 Data: flag parenthesized list
2677
2678 The FLAGS response occurs as a result of a SELECT or EXAMINE
2679 command. The flag parenthesized list identifies the flags (at a
2680 minimum, the system-defined flags) that are applicable for this
2681 mailbox. Flags other than the system flags may also exist,
2682 depending on server implementation.
2683
2684 The update from the FLAGS response MUST be recorded by the client.
2685
2686 Example: S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
2687
2688
2689
2690Crispin [Page 44]
2691
2692RFC 1730 IMAP4 December 1994
2693
2694
26957.3. Server Responses - Message Status
2696
2697 These responses are always untagged. This is how message data are
2698 transmitted from the server to the client, often as a result of a
2699 command with the same name. Immediately following the "*" token is a
2700 number that represents either a message sequence number or a message
2701 count.
2702
27037.3.1. EXISTS Response
2704
2705 Data: none
2706
2707 The EXISTS response reports the number of messages in the mailbox.
2708 This response occurs as a result of a SELECT or EXAMINE command,
2709 and if the size of the mailbox changes (e.g. new mail).
2710
2711 The update from the EXISTS response MUST be recorded by the
2712 client.
2713
2714 Example: S: * 23 EXISTS
2715
2716
27177.3.2. RECENT Response
2718
2719 Data: none
2720
2721 The RECENT response reports the number of messages that have
2722 arrived since the previous time a SELECT command was done on this
2723 mailbox. This response occurs as a result of a SELECT or EXAMINE
2724 command, and if the size of the mailbox changes (e.g. new mail).
2725
2726 The update from the RECENT response MUST be recorded by the
2727 client.
2728
2729 Example: S: * 5 RECENT
2730
2731
27327.3.3. EXPUNGE Response
2733
2734 Data: none
2735
2736 The EXPUNGE response reports that the specified message sequence
2737 number has been permanently removed from the mailbox. The message
2738 sequence number for each successive message in the mailbox is
2739 immediately decremented by 1, and this decrement is reflected in
2740 message sequence numbers in subsequent responses (including other
2741 untagged EXPUNGE responses).
2742
2743
2744
2745
2746Crispin [Page 45]
2747
2748RFC 1730 IMAP4 December 1994
2749
2750
2751 As a result of the immediate decrement rule, message sequence
2752 numbers that appear in a set of successive EXPUNGE responses
2753 depend upon whether the messages are removed starting from lower
2754 numbers to higher numbers, or from higher numbers to lower
2755 numbers. For example, if the last 5 messages in a 9-message
2756 mailbox are expunged; a "lower to higher" server will send five
2757 untagged EXPUNGE responses for message sequence number 5, whereas
2758 a "higher to lower server" will send successive untagged EXPUNGE
2759 responses for message sequence numbers 9, 8, 7, 6, and 5.
2760
2761 An EXPUNGE response MUST NOT be sent when no command is in
2762 progress; nor while responding to a FETCH, STORE, or SEARCH
2763 command. This rule is necessary to prevent a loss of
2764 synchronization of message sequence numbers between client and
2765 server.
2766
2767 The update from the EXPUNGE response MUST be recorded by the
2768 client.
2769
2770 Example: S: * 44 EXPUNGE
2771
2772
27737.3.4. FETCH Response
2774
2775 Data: message data
2776
2777 The FETCH response returns data about a message to the client.
2778 The data are pairs of data item names and their values in
2779 parentheses. This response occurs as the result of a FETCH or
2780 STORE command, as well as by unilateral server decision (e.g. flag
2781 updates).
2782
2783 The current data items are:
2784
2785 BODY A form of BODYSTRUCTURE without extension data.
2786
2787 BODY[section] A string expressing the body contents of the
2788 specified section. The string should be
2789 interpreted by the client according to the content
2790 transfer encoding, body type, and subtype.
2791
2792 8-bit textual data is permitted if a character set
2793 identifier is part of the body parameter
2794 parenthesized list for this section.
2795
2796 Non-textual data such as binary data must be
2797 transfer encoded into a textual form such as BASE64
2798 prior to being sent to the client. To derive the
2799
2800
2801
2802Crispin [Page 46]
2803
2804RFC 1730 IMAP4 December 1994
2805
2806
2807 original binary data, the client must decode the
2808 transfer encoded string.
2809
2810 BODYSTRUCTURE A parenthesized list that describes the body
2811 structure of a message. This is computed by the
2812 server by parsing the [RFC-822] header and body
2813 into the component parts, defaulting various fields
2814 as necessary.
2815
2816 Multiple parts are indicated by parenthesis
2817 nesting. Instead of a body type as the first
2818 element of the parenthesized list there is a nested
2819 body. The second element of the parenthesized list
2820 is the multipart subtype (mixed, digest, parallel,
2821 alternative, etc.).
2822
2823 Extension data follows the multipart subtype.
2824 Extension data is never returned with the BODY
2825 fetch, but may be returned with a BODYSTRUCTURE
2826 fetch. Extension data, if present, must be in the
2827 defined order.
2828
2829 The extension data of a multipart body part are in
2830 the following order:
2831
2832 body parameter parenthesized list
2833 A parenthesized list of attribute/value pairs
2834 [e.g. (foo bar baz rag) where "bar" is the value
2835 of "foo" and "rag" is the value of "baz"] as
2836 defined in [MIME-1].
2837
2838 Any following extension data are not yet defined in
2839 this version of the protocol. Such extension data
2840 may consist of zero or more NILs, strings, numbers,
2841 or potentially nested parenthesized lists of such
2842 data. Client implementations that do a
2843 BODYSTRUCTURE fetch MUST be prepared to accept such
2844 extension data. Server implementations MUST NOT
2845 send such extension data until it has been defined
2846 by a revision of this protocol.
2847
2848 The basic fields of a non-multipart body part are
2849 in the following order:
2850
2851 body type
2852 A string giving the content type name as defined
2853 in [MIME-1].
2854
2855
2856
2857
2858Crispin [Page 47]
2859
2860RFC 1730 IMAP4 December 1994
2861
2862
2863 body subtype
2864 A string giving the content subtype name as
2865 defined in [MIME-1].
2866
2867 body parameter parenthesized list
2868 A parenthesized list of attribute/value pairs
2869 [e.g. (foo bar baz rag) where "bar" is the value
2870 of "foo" and "rag" is the value of "baz"] as
2871 defined in [MIME-1].
2872
2873 body id
2874 A string giving the content id as defined in
2875 [MIME-1].
2876
2877 body description
2878 A string giving the content description as
2879 defined in [MIME-1].
2880
2881 body encoding
2882 A string giving the content transfer encoding as
2883 defined in [MIME-1].
2884
2885 body size
2886 A number giving the size of the body in octets.
2887 Note that this size is the size in its transfer
2888 encoding and not the resulting size after any
2889 decoding.
2890
2891 A body type of type MESSAGE and subtype RFC822
2892 contains, immediately after the basic fields, the
2893 envelope structure, body structure, and size in
2894 text lines of the encapsulated message.
2895
2896 A body type of type TEXT contains, immediately
2897 after the basic fields, the size of the body in
2898 text lines. Note that this size is the size in its
2899 transfer encoding and not the resulting size after
2900 any decoding.
2901
2902 Extension data follows the basic fields and the
2903 type-specific fields listed above. Extension data
2904 is never returned with the BODY fetch, but may be
2905 returned with a BODYSTRUCTURE fetch. Extension
2906 data, if present, must be in the defined order.
2907
2908 The extension data of a non-multipart body part are
2909 in the following order:
2910
2911
2912
2913
2914Crispin [Page 48]
2915
2916RFC 1730 IMAP4 December 1994
2917
2918
2919 body MD5
2920 A string giving the content MD5 value as defined
2921 in [MIME-1].
2922
2923 Any following extension data are not yet defined in
2924 this version of the protocol, and would be as
2925 described above under multipart extension data.
2926
2927 ENVELOPE A parenthesized list that describes the envelope
2928 structure of a message. This is computed by the
2929 server by parsing the [RFC-822] header into the
2930 component parts, defaulting various fields as
2931 necessary.
2932
2933 The fields of the envelope structure are in the
2934 following order: date, subject, from, sender,
2935 reply-to, to, cc, bcc, in-reply-to, and message-id.
2936 The date, subject, in-reply-to, and message-id
2937 fields are strings. The from, sender, reply-to,
2938 to, cc, and bcc fields are parenthesized lists of
2939 address structures.
2940
2941 An address structure is a parenthesized list that
2942 describes an electronic mail address. The fields
2943 of an address structure are in the following order:
2944 personal name, [SMTP] at-domain-list (source
2945 route), mailbox name, and host name.
2946
2947 [RFC-822] group syntax is indicated by a special
2948 form of address structure in which the host name
2949 field is NIL. If the mailbox name field is also
2950 NIL, this is an end of group marker (semi-colon in
2951 RFC 822 syntax). If the mailbox name field is
2952 non-NIL, this is a start of group marker, and the
2953 mailbox name field holds the group name phrase.
2954
2955 Any field of an envelope or address structure that
2956 is not applicable is presented as NIL. Note that
2957 the server must default the reply-to and sender
2958 fields from the from field; a client is not
2959 expected to know to do this.
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970Crispin [Page 49]
2971
2972RFC 1730 IMAP4 December 1994
2973
2974
2975 FLAGS A parenthesized list of flags that are set for this
2976 message. This may include keywords as well as the
2977 following system flags:
2978
2979 \Seen Message has been read
2980
2981 \Answered Message has been answered
2982
2983 \Flagged Message is "flagged" for urgent/special
2984 attention
2985
2986 \Deleted Message is "deleted" for removal by
2987 later EXPUNGE
2988
2989 \Draft Message has not completed composition
2990 (marked as a draft).
2991
2992 as well as the following special flag, which may be
2993 fetched but not stored:
2994
2995 \Recent Message has arrived since the previous
2996 time this mailbox was selected.
2997
2998 INTERNALDATE A string containing the date and time of final
2999 delivery of the message as defined by [SMTP].
3000
3001 RFC822 A string expressing the message in [RFC-822]
3002 format. The header portion of the message must be
3003 7-bit. 8-bit characters are permitted only in the
3004 non-header portion of the message only if there are
3005 [MIME-1] data in the message that identify the
3006 character set of the message.
3007
3008 RFC822.HEADER A string expressing the [RFC-822] format header of
3009 the message, including the delimiting blank line
3010 between the header and the body. The entire string
3011 must be 7-bit; 8-bit characters are not permitted
3012 in headers. RFC822.HEADER is used to return data
3013 for the RFC822.HEADER, RFC822.HEADER.LINES, and
3014 RFC822.HEADER.LINES.NOT FETCH data items. Note
3015 that a blank line is always included regardless of
3016 header line restrictions.
3017
3018 RFC822.SIZE A number expressing the number of octets in the
3019 message in [RFC-822] format.
3020
3021
3022
3023
3024
3025
3026Crispin [Page 50]
3027
3028RFC 1730 IMAP4 December 1994
3029
3030
3031 RFC822.TEXT A string expressing the text body of the message,
3032 omitting the [RFC-822] header. 8-bit characters
3033 are permitted only if there are [MIME-1] data in
3034 the message that identify the character set of the
3035 message.
3036
3037 UID A number expressing the unique identifier of the
3038 message.
3039
3040
3041 Example: S: * 23 FETCH (FLAGS (\Seen) RFC822.SIZE 44827)
3042
3043
30447.3.5. Obsolete Responses
3045
3046 In addition to the responses listed in here, client implementations
3047 MUST accept and implement the obsolete responses described in
3048 Appendix B.
3049
3050
3051
30527.4. Server Responses - Command Continuation Request
3053
3054 The command completion request response is indicated by a "+" token
3055 instead of a tag. This form of response indicates that the server is
3056 ready to accept the continuation of a command from the client. The
3057 remainder of this response is a line of text.
3058
3059 This response is used in the AUTHORIZATION command to transmit server
3060 data to the client, and request additional client data. This
3061 response is also used if an argument to any command is a literal.
3062
3063 The client is not permitted to send the octets of the literal unless
3064 the server indicates that it expects it. This permits the server to
3065 process commands and reject errors on a line-by-line basis. The
3066 remainder of the command, including the CRLF that terminates a
3067 command, follows the octets of the literal. If there are any
3068 additional command arguments the literal octets are followed by a
3069 space and those arguments.
3070
3071 Example: C: A001 LOGIN {11}
3072 S: + Ready for additional command text
3073 C: FRED FOOBAR {7}
3074 S: + Ready for additional command text
3075 C: fat man
3076 S: A001 OK LOGIN completed
3077 C: A044 BLURDYBLOOP {102856}
3078 S: A044 BAD No such command as "BLURDYBLOOP"
3079
3080
3081
3082Crispin [Page 51]
3083
3084RFC 1730 IMAP4 December 1994
3085
3086
30878. Sample IMAP4 session
3088
3089 The following is a transcript of an IMAP4 session. A long line in
3090 this sample is broken for editorial clarity.
3091
3092 S: * OK IMAP4 Service Ready
3093 C: a001 login mrc secret
3094 S: a001 OK LOGIN completed
3095 C: a002 select inbox
3096 S: * 18 EXISTS
3097 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
3098 S: * 2 RECENT
3099 S: * OK [UNSEEN 17] Message 17 is the first unseen message
3100 S: * OK [UIDVALIDITY 3857529045] UIDs valid
3101 S: a002 OK [READ-WRITE] SELECT completed
3102 C: a003 fetch 12 full
3103 S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "14-Jul-1993 02:44:25 -0700"
3104 RFC822.SIZE 4282 ENVELOPE ("Wed, 14 Jul 1993 02:23:25 -0700 (PDT)"
3105 "IMAP4 WG mtg summary and minutes"
3106 (("Terry Gray" NIL "gray" "cac.washington.edu"))
3107 (("Terry Gray" NIL "gray" "cac.washington.edu"))
3108 (("Terry Gray" NIL "gray" "cac.washington.edu"))
3109 ((NIL NIL "imap" "cac.washington.edu"))
3110 ((NIL NIL "minutes" "CNRI.Reston.VA.US")
3111 ("John Klensin" NIL "KLENSIN" "INFOODS.MIT.EDU")) NIL NIL
3112 "<B27397-0100000@cac.washington.edu>")
3113 BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 92))
3114 S: a003 OK FETCH completed
3115 C: a004 fetch 12 rfc822.header
3116 S: * 12 FETCH (RFC822.HEADER {346}
3117 S: Date: Wed, 14 Jul 1993 02:23:25 -0700 (PDT)
3118 S: From: Terry Gray <gray@cac.washington.edu>
3119 S: Subject: IMAP4 WG mtg summary and minutes
3120 S: To: imap@cac.washington.edu
3121 S: cc: minutes@CNRI.Reston.VA.US, John Klensin <KLENSIN@INFOODS.MIT.EDU>
3122 S: Message-Id: <B27397-0100000@cac.washington.edu>
3123 S: MIME-Version: 1.0
3124 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
3125 S:
3126 S: )
3127 S: a004 OK FETCH completed
3128 C: a005 store 12 +flags \deleted
3129 S: * 12 FETCH (FLAGS (\Seen \Deleted))
3130 S: a005 OK +FLAGS completed
3131 C: a006 logout
3132 S: * BYE IMAP4 server terminating connection
3133 S: a006 OK LOGOUT completed
3134
3135
3136
3137
3138Crispin [Page 52]
3139
3140RFC 1730 IMAP4 December 1994
3141
3142
31439. Formal Syntax
3144
3145 The following syntax specification uses the augmented Backus-Naur
3146 Form (BNF) notation as specified in [RFC-822] with one exception; the
3147 delimiter used with the "#" construct is a single space (SPACE) and
3148 not a comma.
3149
3150 Except as noted otherwise, all alphabetic characters are
3151 case-insensitive. The use of upper or lower case characters to
3152 define token strings is for editorial clarity only. Implementations
3153 MUST accept these strings in a case-insensitive fashion.
3154
3155 Syntax marked as obsolete may be encountered with implementations
3156 written for an earlier version of this protocol (e.g. IMAP2). New
3157 implementations SHOULD accept obsolete syntax as input, but MUST NOT
3158 otherwise use such syntax.
3159
3160 address ::= "(" addr_name SPACE addr_adl SPACE addr_mailbox
3161 SPACE addr_host ")"
3162
3163 addr_adl ::= nstring
3164
3165 addr_host ::= nstring
3166 ;; NIL indicates [RFC-822] group syntax
3167
3168 addr_mailbox ::= nstring
3169 ;; NIL indicates end of [RFC-822] group; if
3170 ;; non-NIL and addr_host is NIL, holds
3171 ;; [RFC-822] group name
3172
3173 addr_name ::= nstring
3174
3175 alpha ::= "A" / "B" / "C" / "D" / "E" / "F" / "G" / "H" /
3176 "I" / "J" / "K" / "L" / "M" / "N" / "O" / "P" /
3177 "Q" / "R" / "S" / "T" / "U" / "V" / "W" / "X" /
3178 "Y" / "Z" /
3179 "a" / "b" / "c" / "d" / "e" / "f" / "g" / "h" /
3180 "i" / "j" / "k" / "l" / "m" / "n" / "o" / "p" /
3181 "q" / "r" / "s" / "t" / "u" / "v" / "w" / "x" /
3182 "y" / "z" /
3183 ;; Case-sensitive
3184
3185 append ::= "APPEND" SPACE mailbox [SPACE flag_list]
3186 [SPACE date_time] SPACE literal
3187
3188 astring ::= atom / string
3189
3190
3191
3192
3193
3194Crispin [Page 53]
3195
3196RFC 1730 IMAP4 December 1994
3197
3198
3199 atom ::= 1*ATOM_CHAR
3200
3201 ATOM_CHAR ::= <any CHAR except atom_specials>
3202
3203 atom_specials ::= "(" / ")" / "{" / SPACE / CTLs / list_wildcards /
3204 quoted_specials
3205
3206 authenticate ::= "AUTHENTICATE" SPACE auth_type *(CRLF base64)
3207
3208 auth_type ::= atom
3209
3210 base64 ::= *(4base64_char) [base64_terminal]
3211
3212 base64_char ::= alpha / digit / "+" / "/"
3213
3214 base64_terminal ::= (2base64_char "==") / (3base64_char "=")
3215
3216 body ::= "(" body_type_1part / body_type_mpart ")"
3217
3218 body_extension ::= nstring / number / "(" 1#body_extension ")"
3219 ;; Future expansion. Client implementations
3220 ;; MUST accept body_extension fields. Server
3221 ;; implementations MUST NOT generate
3222 ;; body_extension fields except as defined by
3223 ;; future standard or standards-track
3224 ;; revisions of this specification.
3225
3226 body_ext_1part ::= body_fld_md5 [SPACE 1#body_extension]
3227 ;; MUST NOT be returned on non-extensible
3228 ;; "BODY" fetch
3229
3230 body_ext_mpart ::= body_fld_param [SPACE 1#body_extension]]
3231 ;; MUST NOT be returned on non-extensible
3232 ;; "BODY" fetch
3233
3234 body_fields ::= body_fld_param SPACE body_fld_id SPACE
3235 body_fld_desc SPACE body_fld_enc SPACE
3236 body_fld_octets
3237
3238 body_fld_desc ::= nstring
3239
3240 body_fld_enc ::= (<"> ("7BIT" / "8BIT" / "BINARY" / "BASE64"/
3241 "QUOTED-PRINTABLE") <">) / string
3242
3243 body_fld_id ::= nstring
3244
3245 body_fld_lines ::= number
3246
3247
3248
3249
3250Crispin [Page 54]
3251
3252RFC 1730 IMAP4 December 1994
3253
3254
3255 body_fld_md5 ::= nstring
3256
3257 body_fld_octets ::= number
3258
3259 body_fld_param ::= "(" 1#(string string) ")" / nil
3260
3261 body_fld_subtyp ::= string
3262
3263 body_type_1part ::= (body_type_basic / body_type_msg / body_type_text)
3264 [SPACE body_ext_1part]
3265
3266 body_type_basic ::= (<"> ("APPLICATION" / "AUDIO" / "IMAGE" /
3267 "MESSAGE" / "VIDEO") <">) / string) SPACE
3268 body_fld_subtyp SPACE body_fields
3269 ;; MESSAGE subtype MUST NOT be "RFC822"
3270
3271 body_type_mpart ::= 1*body SPACE body_fld_subtyp
3272 [SPACE body_ext_mpart]
3273
3274 body_type_msg ::= <"> "MESSAGE" <"> SPACE <"> "RFC822" <"> SPACE
3275 body_fields SPACE envelope SPACE body SPACE
3276 body_fld_lines
3277
3278 body_type_text ::= <"> "TEXT" <"> SPACE body_fld_subtyp SPACE
3279 body_fields SPACE body_fld_lines
3280
3281 capability ::= atom
3282 ;; Must begin with "X" or be registered with
3283 ;; IANA as standard or standards-track
3284
3285 capability_data ::= "CAPABILITY" SPACE "IMAP4" [SPACE 1#capability]
3286
3287 CHAR ::= <any 7-bit US-ASCII character except NUL,
3288 0x01 - 0x7f>
3289
3290 CHAR8 ::= <any 8-bit octet except NUL, 0x01 - 0xff>
3291
3292 command ::= tag SPACE (command_any / command_auth /
3293 command_nonauth / command_select) CRLF
3294 ;; Modal based on state
3295
3296 command_any ::= "CAPABILITY" / "LOGOUT" / "NOOP" / x_command
3297 ;; Valid in all states
3298
3299 command_auth ::= append / create / delete / examine / find / list /
3300 lsub / rename / select / subscribe / unsubscribe /
3301 ;; Valid only in Authenticated or Selected state
3302
3303
3304
3305
3306Crispin [Page 55]
3307
3308RFC 1730 IMAP4 December 1994
3309
3310
3311 command_nonauth ::= login / authenticate
3312 ;; Valid only when in Non-Authenticated state
3313
3314 command_select ::= "CHECK" / "CLOSE" / "EXPUNGE" /
3315 copy / fetch / partial / store / uid / search
3316 ;; Valid only when in Selected state
3317
3318 continue_req ::= "+" SPACE (resp_text / base64)
3319
3320 copy ::= "COPY" SPACE set SPACE mailbox
3321
3322 CR ::= <ASCII CR, carriage return, 0x0C>
3323
3324 create ::= "CREATE" SPACE mailbox
3325 ;; Use of INBOX gives a NO error
3326
3327 CRLF ::= CR LF
3328
3329 CTL ::= <any ASCII control character and DEL,
3330 0x00 - 0x1f, 0x7f>
3331
3332 date ::= date_text / <"> date_text <">
3333
3334 date_day ::= 1*2digit
3335 ;; Day of month
3336
3337 date_day_fixed ::= (SPACE digit) / 2digit
3338 ;; Fixed-format version of date_day
3339
3340 date_month ::= "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
3341 "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
3342
3343 date_text ::= date_day "-" date_month "-" (date_year /
3344 date_year_old)
3345
3346 date_year ::= 4digit
3347
3348 date_year_old ::= 2digit
3349 ;; OBSOLETE, (year - 1900)
3350
3351 date_time ::= <"> (date_time_new / date_time_old) <">
3352
3353 date_time_new ::= date_day_fixed "-" date_month "-" date_year
3354 SPACE time SPACE zone
3355
3356 date_time_old ::= date_day_fixed "-" date_month "-" date_year_old
3357 SPACE time "-" zone_old
3358 ;; OBSOLETE
3359
3360
3361
3362Crispin [Page 56]
3363
3364RFC 1730 IMAP4 December 1994
3365
3366
3367 delete ::= "DELETE" SPACE mailbox
3368 ;; Use of INBOX gives a NO error
3369
3370 digit ::= "0" / digit_nz
3371
3372 digit_nz ::= "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" /
3373 "9"
3374
3375 envelope ::= "(" env_date SPACE env_subject SPACE env_from
3376 SPACE env_sender SPACE env_reply-to SPACE env_to
3377 SPACE env_cc SPACE env_bcc SPACE env_in-reply-to
3378 SPACE env_message-id ")"
3379
3380 env_bcc ::= "(" 1*address ")" / nil
3381
3382 env_cc ::= "(" 1*address ")" / nil
3383
3384 env_date ::= nstring
3385
3386 env_from ::= "(" 1*address ")" / nil
3387
3388 env_in-reply-to ::= nstring
3389
3390 env_message-id ::= nstring
3391
3392 env_reply-to ::= "(" 1*address ")" / nil
3393
3394 env_sender ::= "(" 1*address ")" / nil
3395
3396 env_subject ::= nstring
3397
3398 env_to ::= "(" 1*address ")" / nil
3399
3400 examine ::= "EXAMINE" SPACE mailbox
3401
3402 fetch ::= "FETCH" SPACE set SPACE ("ALL" / "FULL" /
3403 "FAST" / fetch_att / "(" 1#fetch_att ")")
3404
3405 fetch_att ::= "BODY" / "BODYSTRUCTURE" /
3406 "BODY" [".PEEK"] "[" section "]" / "ENVELOPE" /
3407 "FLAGS" / "INTERNALDATE" / "UID" /
3408 "RFC822" (([".TEXT"] [".PEEK"]) / ".SIZE" /
3409 (".HEADER" [".LINES" [".NOT"] SPACE header_list])
3410
3411 find ::= "FIND" SPACE ["ALL."] "MAILBOXES" SPACE
3412 list_mailbox
3413 ;; OBSOLETE
3414
3415
3416
3417
3418Crispin [Page 57]
3419
3420RFC 1730 IMAP4 December 1994
3421
3422
3423 flag ::= "\Answered" / "\Flagged" / "\Deleted" /
3424 "\Seen" / "\Draft" / flag_keyword /
3425 flag_extension
3426
3427 flag_extension ::= "\" atom
3428 ;; Future expansion. Client implementations
3429 ;; MUST accept flag_extension flags. Server
3430 ;; implementations MUST NOT generate
3431 ;; flag_extension flags except as defined by
3432 ;; future standard or standards-track
3433 ;; revisions of this specification.
3434
3435 flag_keyword ::= atom
3436
3437 flag_list ::= "(" #flag ")"
3438
3439 greeting ::= "*" SPACE (resp_cond_auth / resp_cond_bye) CRLF
3440
3441 header_line ::= astring
3442
3443 header_list ::= "(" 1#header_line ")"
3444
3445 LF ::= <ASCII LF, line feed, 0x0A>
3446
3447 list ::= "LIST" SPACE mailbox SPACE list_mailbox
3448
3449 list_mailbox ::= 1*(ATOM_CHAR / list_wildcards) / string
3450
3451 list_wildcards ::= "%" / "*"
3452
3453 literal ::= "{" number "}" CRLF *CHAR8
3454 ;; Number represents the number of CHAR8 octets
3455
3456 login ::= "LOGIN" SPACE userid SPACE password
3457
3458 lsub ::= "LSUB" SPACE mailbox SPACE list_mailbox
3459
3460 mailbox ::= "INBOX" / astring
3461 ;; INBOX is case-insensitive; other names may be
3462 ;; case-sensitive depending on implementation.
3463
3464 mailbox_data ::= "FLAGS" SPACE flag_list /
3465 "LIST" SPACE mailbox_list /
3466 "LSUB" SPACE mailbox_list /
3467 "MAILBOX" SPACE text /
3468 "SEARCH" [SPACE 1#nz_number] /
3469 number SPACE "EXISTS" / number SPACE "RECENT"
3470
3471
3472
3473
3474Crispin [Page 58]
3475
3476RFC 1730 IMAP4 December 1994
3477
3478
3479 mailbox_list ::= "(" #("\Marked" / "\Noinferiors" /
3480 "\Noselect" / "\Unmarked" / flag_extension) ")"
3481 SPACE (<"> QUOTED_CHAR <"> / nil) SPACE mailbox
3482
3483 message_data ::= nz_number SPACE ("EXPUNGE" /
3484 ("FETCH" SPACE msg_fetch) / msg_obsolete)
3485
3486 msg_fetch ::= "(" 1#("BODY" SPACE body /
3487 "BODYSTRUCTURE" SPACE body /
3488 "BODY[" section "]" SPACE nstring /
3489 "ENVELOPE" SPACE envelope /
3490 "FLAGS" SPACE "(" #(flag / "\Recent") ")" /
3491 "INTERNALDATE" SPACE date_time /
3492 "RFC822" [".HEADER" / ".TEXT"] SPACE nstring /
3493 "RFC822.SIZE" SPACE number /
3494 "UID" SPACE uniqueid) ")"
3495
3496 msg_obsolete ::= "COPY" / ("STORE" SPACE msg_fetch)
3497 ;; OBSOLETE untagged data responses
3498
3499 nil ::= "NIL"
3500
3501 nstring ::= string / nil
3502
3503 number ::= 1*digit
3504 ;; Unsigned 32-bit integer
3505 ;; (0 <= n < 4,294,967,296)
3506
3507 nz_number ::= digit_nz *digit
3508 ;; Non-zero unsigned 32-bit integer
3509 ;; (0 < n < 4,294,967,296)
3510
3511 partial ::= "PARTIAL" SPACE nz_number SPACE
3512 ("BODY" [".PEEK"] "[" section "]" /
3513 "RFC822" (([".TEXT"] [".PEEK"]) / ".HEADER")
3514 SPACE number SPACE number
3515
3516 password ::= astring
3517
3518 quoted ::= <"> *QUOTED_CHAR <">
3519
3520 QUOTED_CHAR ::= <any TEXT_CHAR except quoted_specials> /
3521 "\" quoted_specials
3522
3523 quoted_specials ::= <"> / "\"
3524
3525 rename ::= "RENAME" SPACE mailbox SPACE mailbox
3526 ;; Use of INBOX as a destination gives a NO error
3527
3528
3529
3530Crispin [Page 59]
3531
3532RFC 1730 IMAP4 December 1994
3533
3534
3535 response ::= *response_data response_done
3536
3537 response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye /
3538 mailbox_data / message_data / capability_data)
3539 CRLF
3540
3541 response_done ::= response_tagged / response_fatal
3542
3543 response_fatal ::= "*" SPACE resp_cond_bye CRLF
3544
3545 response_tagged ::= tag SPACE resp_cond_state CRLF
3546
3547 resp_cond_auth ::= ("OK" / "PREAUTH") SPACE resp_text
3548 ;; Authentication condition
3549
3550 resp_cond_bye ::= "BYE" SPACE resp_text
3551 ;; Server will disconnect condition
3552
3553 resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text
3554 ;; Status condition
3555
3556 resp_text ::= ["[" resp_text_code "]" SPACE] (text_mime2 / text)
3557
3558 resp_text_code ::= "ALERT" / "PARSE" /
3559 "PERMANENTFLAGS" SPACE "(" #(flag / "\*") ")" /
3560 "READ-ONLY" / "READ-WRITE" / "TRYCREATE" /
3561 "UIDVALIDITY" SPACE nz_number /
3562 "UNSEEN" SPACE nz_number /
3563 atom [SPACE 1*<any TEXT_CHAR except "]">]
3564
3565 search ::= "SEARCH" SPACE ["CHARSET" SPACE astring SPACE]
3566 search_criteria
3567 ;; Character set must be registered with IANA
3568 ;; as a MIME character set
3569
3570 search_criteria ::= 1#search_key
3571
3572 search_key ::= search_new / search_old
3573
3574 search_new ::= "DRAFT" /
3575 "HEADER" SPACE header_line SPACE astring /
3576 "LARGER" SPACE number / "NOT" SPACE search_key /
3577 "OR" SPACE search_key SPACE search_key /
3578 "SENTBEFORE" SPACE date / "SENTON" SPACE date /
3579 "SENTSINCE" SPACE date / "SMALLER" SPACE number /
3580 "UID" SPACE set / "UNDRAFT" / set /
3581 "(" search_criteria ")"
3582 ;; New in IMAP4
3583
3584
3585
3586Crispin [Page 60]
3587
3588RFC 1730 IMAP4 December 1994
3589
3590
3591 search_old ::= "ALL" / "ANSWERED" / "BCC" SPACE astring /
3592 "BEFORE" SPACE date / "BODY" SPACE astring /
3593 "CC" SPACE astring / "DELETED" / "FLAGGED" /
3594 "FROM" SPACE astring /
3595 "KEYWORD" SPACE flag_keyword / "NEW" / "OLD" /
3596 "ON" SPACE date / "RECENT" / "SEEN" /
3597 "SINCE" SPACE date / "SUBJECT" SPACE astring /
3598 "TEXT" SPACE astring / "TO" SPACE astring /
3599 "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /
3600 "UNKEYWORD" SPACE flag_keyword / "UNSEEN"
3601 ;; Defined in [IMAP2]
3602
3603 section ::= "0" / nz_number ["." section]
3604
3605 select ::= "SELECT" SPACE mailbox
3606
3607 sequence_num ::= nz_number / "*"
3608 ;; * is the largest number in use. For message
3609 ;; sequence numbers, it is the number of messages
3610 ;; in the mailbox. For unique identifiers, it is
3611 ;; the unique identifier of the last message in
3612 ;; the mailbox.
3613
3614 set ::= sequence_num / (sequence_num ":" sequence_num) /
3615 (set "," set)
3616 ;; Identifies a set of messages. For message
3617 ;; sequence numbers, these are consecutive
3618 ;; numbers from 1 to the number of messages in
3619 ;; the mailbox
3620 ;; Comma delimits individual numbers, colon
3621 ;; delimits between two numbers inclusive.
3622 ;; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13,
3623 ;; 14,15 for a mailbox with 15 messages.
3624
3625 SPACE ::= <ASCII SP, space, 0x20>
3626
3627 store ::= "STORE" SPACE set SPACE store_att_flags
3628
3629 store_att_flags ::= (["+" / "-"] "FLAGS" [".SILENT"]) SPACE
3630 (flag_list / #flag)
3631
3632 string ::= quoted / literal
3633
3634 subscribe ::= ("SUBSCRIBE" SPACE mailbox) / subscribe_obs
3635
3636 subscribe_obs ::= "SUBSCRIBE" SPACE "MAILBOX" SPACE mailbox
3637 ;;OBSOLETE
3638
3639
3640
3641
3642Crispin [Page 61]
3643
3644RFC 1730 IMAP4 December 1994
3645
3646
3647 tag ::= 1*<any ATOM_CHAR except "+">
3648
3649 text ::= 1*TEXT_CHAR
3650
3651 text_mime2 ::= "=?" <charset> "?" <encoding> "?"
3652 <encoded-text> "?="
3653 ;; Syntax defined in [MIME-2]
3654
3655 TEXT_CHAR ::= <any CHAR except CR and LF>
3656
3657 time ::= 2digit ":" 2digit ":" 2digit
3658 ;; Hours minutes seconds
3659
3660 uid ::= "UID" SPACE (copy / fetch / search / store)
3661 ;; Unique identifiers used instead of message
3662 ;; sequence numbers
3663
3664 uniqueid ::= nz_number
3665 ;; Strictly ascending
3666
3667 unsubscribe ::= ("UNSUBSCRIBE" SPACE mailbox) / unsubscribe_obs
3668
3669 unsubscribe_obs ::= "UNSUBSCRIBE" SPACE "MAILBOX" SPACE mailbox
3670 ;;OBSOLETE
3671
3672 userid ::= astring
3673
3674 x_command ::= "X" atom <experimental command arguments>
3675
3676 zone ::= ("+" / "-") 4digit
3677 ;; Signed four-digit value of hhmm representing
3678 ;; hours and minutes west of Greenwich (that is,
3679 ;; (the amount that the given time differs from
3680 ;; Universal Time). Subtracting the timezone
3681 ;; from the given time will give the UT form.
3682 ;; The Universal Time zone is "+0000".
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698Crispin [Page 62]
3699
3700RFC 1730 IMAP4 December 1994
3701
3702
3703 zone_old ::= "UT" / "GMT" / "Z" / ;; +0000
3704 "AST" / "EDT" / ;; -0400
3705 "EST" / "CDT" / ;; -0500
3706 "CST" / "MDT" / ;; -0600
3707 "MST" / "PDT" / ;; -0700
3708 "PST" / "YDT" / ;; -0800
3709 "YST" / "HDT" / ;; -0900
3710 "HST" / "BDT" / ;; -1000
3711 "BST" / ;; -1100
3712 "A" / "B" / "C" / "D" / "E" / "F" / ;; +1 to +6
3713 "G" / "H" / "I" / "K" / "L" / "M" / ;; +7 to +12
3714 "N" / "O" / "P" / "Q" / "R" / "S" / ;; -1 to -6
3715 "T" / "U" / "V" / "W" / "X" / "Y" ;; -7 to -12
3716 ;; OBSOLETE
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754Crispin [Page 63]
3755
3756RFC 1730 IMAP4 December 1994
3757
3758
375910. Author's Note
3760
3761 This document is a revision or rewrite of earlier documents, and
3762 supercedes the protocol specification in those documents: IMAP4
3763 Internet drafts, the IMAP2bis Internet drafts, unpublished
3764 IMAP2bis.TXT document, RFC 1176, and RFC 1064.
3765
3766
376711. Security Considerations
3768
3769 IMAP4 protocol transactions, including electronic mail data, are sent
3770 in the clear over the network unless the optional privacy protection
3771 is negotiated in the AUTHENTICATE command.
3772
3773 A server error message for an AUTHENTICATE command which fails due to
3774 invalid credentials should not detail why the credentials are
3775 invalid.
3776
3777 Use of the LOGIN command sends passwords in the clear. This can be
3778 avoided by using the AUTHENTICATE command instead.
3779
3780 A server error message for a failing LOGIN command should not specify
3781 that the user name, as opposed to the password, is invalid.
3782
3783 Additional security considerations are discussed in the section
3784 discussing the AUTHENTICATE and LOGIN commands.
3785
3786
378712. Author's Address
3788
3789 Mark R. Crispin
3790 Networks and Distributed Computing, JE-30
3791 University of Washington
3792 Seattle, WA 98195
3793
3794 Phone: (206) 543-5762
3795
3796 EMail: MRC@CAC.Washington.EDU
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810Crispin [Page 64]
3811
3812RFC 1730 IMAP4 December 1994
3813
3814
3815Appendices
3816
3817A. Obsolete Commands
3818
3819 The following commands are OBSOLETE. It is NOT required to support
3820 any of these commands in new server implementations. These commands
3821 are documented here for the benefit of implementors who may wish to
3822 support them for compatibility with old client implementations.
3823
3824 The section headings of these commands are intended to correspond
3825 with where they would be located in the main document if they were
3826 not obsoleted.
3827
3828
3829A.6.3.OBS.1. FIND ALL.MAILBOXES Command
3830
3831 Arguments: mailbox name with possible wildcards
3832
3833 Data: untagged responses: MAILBOX
3834
3835 Result: OK - find completed
3836 NO - find failure: can't list that name
3837 BAD - command unknown or arguments invalid
3838
3839 The FIND ALL.MAILBOXES command returns a subset of names from the
3840 complete set of all names available to the user. It returns zero
3841 or more untagged MAILBOX replies. The mailbox argument to FIND
3842 ALL.MAILBOXES is similar to that for LIST with an empty reference,
3843 except that the characters "%" and "?" match a single character.
3844
3845 Example: C: A002 FIND ALL.MAILBOXES *
3846 S: * MAILBOX blurdybloop
3847 S: * MAILBOX INBOX
3848 S: A002 OK FIND ALL.MAILBOXES completed
3849
3850
3851A.6.3.OBS.2. FIND MAILBOXES Command
3852
3853 Arguments: mailbox name with possible wildcards
3854
3855 Data: untagged responses: MAILBOX
3856
3857 Result: OK - find completed
3858 NO - find failure: can't list that name
3859 BAD - command unknown or arguments invalid
3860
3861 The FIND MAILBOXES command returns a subset of names from the set
3862 of names that the user has declared as being "active" or
3863
3864
3865
3866Crispin [Page 65]
3867
3868RFC 1730 IMAP4 December 1994
3869
3870
3871 "subscribed". It returns zero or more untagged MAILBOX replies.
3872 The mailbox argument to FIND MAILBOXES is similar to that for LSUB
3873 with an empty reference, except that the characters "%" and "?"
3874 match a single character.
3875
3876 Example: C: A002 FIND MAILBOXES *
3877 S: * MAILBOX blurdybloop
3878 S: * MAILBOX INBOX
3879 S: A002 OK FIND MAILBOXES completed
3880
3881
3882A.6.3.OBS.3. SUBSCRIBE MAILBOX Command
3883
3884 Arguments: mailbox name
3885
3886 Data: no specific data for this command
3887
3888 Result: OK - subscribe completed
3889 NO - subscribe failure: can't subscribe to that name
3890 BAD - command unknown or arguments invalid
3891
3892 The SUBSCRIBE MAILBOX command is identical in effect to the
3893 SUBSCRIBE command. A server which implements this command must be
3894 able to distinguish between a SUBSCRIBE MAILBOX command and a
3895 SUBSCRIBE command with a mailbox name argument of "MAILBOX".
3896
3897 Example: C: A002 SUBSCRIBE MAILBOX #news.comp.mail.mime
3898 S: A002 OK SUBSCRIBE MAILBOX to #news.comp.mail.mime
3899 completed
3900 C: A003 SUBSCRIBE MAILBOX
3901 S: A003 OK SUBSCRIBE to MAILBOX completed
3902
3903
3904A.6.3.OBS.4. UNSUBSCRIBE MAILBOX Command
3905
3906 Arguments: mailbox name
3907
3908 Data: no specific data for this command
3909
3910 Result: OK - unsubscribe completed
3911 NO - unsubscribe failure: can't unsubscribe that name
3912 BAD - command unknown or arguments invalid
3913
3914 The UNSUBSCRIBE MAILBOX command is identical in effect to the
3915 UNSUBSCRIBE command. A server which implements this command must
3916 be able to distinguish between a UNSUBSCRIBE MAILBOX command and
3917 an UNSUBSCRIBE command with a mailbox name argument of "MAILBOX".
3918
3919
3920
3921
3922Crispin [Page 66]
3923
3924RFC 1730 IMAP4 December 1994
3925
3926
3927 Example: C: A002 UNSUBSCRIBE MAILBOX #news.comp.mail.mime
3928 S: A002 OK UNSUBSCRIBE MAILBOX from #news.comp.mail.mime
3929 completed
3930 C: A003 UNSUBSCRIBE MAILBOX
3931 S: A003 OK UNSUBSCRIBE from MAILBOX completed
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978Crispin [Page 67]
3979
3980RFC 1730 IMAP4 December 1994
3981
3982
3983B. Obsolete Responses
3984
3985 The following responses are OBSOLETE. Except as noted below, these
3986 responses MUST NOT be transmitted by new server implementations.
3987
3988 The section headings of these responses are intended to correspond
3989 with where they would be located in the main document if they were
3990 not obsoleted.
3991
3992
3993B.7.2.OBS.1. MAILBOX Response
3994
3995 Data: name
3996
3997 The MAILBOX response MUST NOT be transmitted by server
3998 implementations except in response to the obsolete FIND MAILBOXES
3999 and FIND ALL.MAILBOXES commands. Client implementations that do
4000 not use these commands MAY ignore this response. It is documented
4001 here for the benefit of implementors who may wish to support it
4002 for compatibility with old client implementations.
4003
4004 This response occurs as a result of the FIND MAILBOXES and FIND
4005 ALL.MAILBOXES commands. It returns a single name that matches the
4006 FIND specification. There are no attributes or hierarchy
4007 delimiter.
4008
4009 Example: S: * MAILBOX blurdybloop
4010
4011
4012B.7.3.OBS.1. COPY Response
4013
4014 Data: none
4015
4016 The COPY response MUST NOT be transmitted by new server
4017 implementations. Client implementations MUST ignore the COPY
4018 response. It is documented here for the benefit of client
4019 implementors who may encounter this response from old server
4020 implementations.
4021
4022 In some experimental versions of this protocol, this response was
4023 returned in response to a COPY command to indicate on a
4024 per-message basis that the message was copied successfully.
4025
4026 Example: S: * 44 COPY
4027
4028
4029
4030
4031
4032
4033
4034Crispin [Page 68]
4035
4036RFC 1730 IMAP4 December 1994
4037
4038
4039B.7.3.OBS.2. STORE Response
4040
4041 Data: message data
4042
4043 The STORE response MUST NOT be transmitted by new server
4044 implementations. Client implementations MUST treat the STORE
4045 response as equivalent to the FETCH response. It is documented
4046 here for the benefit of client implementors who may encounter this
4047 response from old server implementations.
4048
4049 In some experimental versions of this protocol, this response was
4050 returned instead of FETCH in response to a STORE command to report
4051 the new value of the flags.
4052
4053 Example: S: * 69 STORE (FLAGS (\Deleted))
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090Crispin [Page 69]
4091
4092RFC 1730 IMAP4 December 1994
4093
4094
4095C. References
4096
4097
4098 [IMAP-AUTH] Myers, J., "IMAP4 Authentication Mechanism", RFC 1731.
4099 Carnegie-Mellon University, December 1994.
4100
4101 [IMAP-COMPAT] Crispin, M. "IMAP4 Compatibility with IMAP2 and
4102 IMAP2bis", RFC 1732, University of Washington, December 1994.
4103
4104 [IMAP-DISC] Austein, R. "Synchronization Operations for Disconnected
4105 IMAP4 Clients", Work in Progress.
4106
4107 [IMAP-MODEL] Crispin, M. "Distributed Electronic Mail Models in
4108 IMAP4", RFC 1733, University of Washington, December 1994.
4109
4110 [IMAP-NAMING] Crispin, M. "Mailbox Naming Convention in IMAP4", Work
4111 in Progress.
4112
4113 [IMAP2] Crispin, M., "Interactive Mail Access Protocol - Version 2",
4114 RFC 1176, University of Washington, August 1990.
4115
4116 [IMSP] Myers, J. "IMSP -- Internet Message Support Protocol", Work in
4117 Progress.
4118
4119 [MIME-1] Borenstein, N., and Freed, N., "MIME (Multipurpose Internet
4120 Mail Extensions) Part One: Mechanisms for Specifying and Describing
4121 the Format of Internet Message Bodies", RFC 1521, Bellcore, Innosoft,
4122 September 1993.
4123
4124 [MIME-2] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
4125 Part Two: Message Header Extensions for Non-ASCII Text", RFC 1522,
4126 University of Tennessee, September 1993.
4127
4128 [RFC-822] Crocker, D., "Standard for the Format of ARPA Internet Text
4129 Messages", STD 11, RFC 822, University of Delaware, August 1982.
4130
4131 [SMTP] Postel, Jonathan B. "Simple Mail Transfer Protocol", STD 10,
4132 RFC 821, USC/Information Sciences Institute, August 1982.
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146Crispin [Page 70]
4147
4148RFC 1730 IMAP4 December 1994
4149
4150
4151E. IMAP4 Keyword Index
4152
4153
4154 +FLAGS <flag list> (store command data item) ............... 34
4155 +FLAGS.SILENT <flag list> (store command data item) ........ 34
4156 -FLAGS <flag list> (store command data item) ............... 34
4157 -FLAGS.SILENT <flag list> (store command data item) ........ 34
4158 ALERT (response code) ...................................... 39
4159 ALL (fetch item) ........................................... 29
4160 ALL (search key) ........................................... 27
4161 ANSWERED (search key) ...................................... 27
4162 APPEND (command) ........................................... 22
4163 AUTHENTICATE (command) ..................................... 12
4164 BAD (response) ............................................. 41
4165 BCC <string> (search key) .................................. 27
4166 BEFORE <date> (search key) ................................. 27
4167 BODY (fetch item) .......................................... 29
4168 BODY (fetch result) ........................................ 46
4169 BODY <string> (search key) ................................. 27
4170 BODY.PEEK[<section>] (fetch item) .......................... 30
4171 BODYSTRUCTURE (fetch item) ................................. 31
4172 BODYSTRUCTURE (fetch result) ............................... 47
4173 BODY[<section>] (fetch item) ............................... 29
4174 BODY[section] (fetch result) ............................... 46
4175 BYE (response) ............................................. 41
4176 CAPABILITY (command) ....................................... 10
4177 CAPABILITY (response) ...................................... 42
4178 CC <string> (search key) ................................... 27
4179 CHECK (command) ............................................ 23
4180 CLOSE (command) ............................................ 24
4181 COPY (command) ............................................. 34
4182 COPY (response) ............................................ 68
4183 CREATE (command) ........................................... 17
4184 DELETE (command) ........................................... 18
4185 DELETED (search key) ....................................... 27
4186 DRAFT (search key) ......................................... 27
4187 ENVELOPE (fetch item) ...................................... 31
4188 ENVELOPE (fetch result) .................................... 49
4189 EXAMINE (command) .......................................... 16
4190 EXISTS (response) .......................................... 45
4191 EXPUNGE (command) .......................................... 25
4192 EXPUNGE (response) ......................................... 45
4193 FAST (fetch item) .......................................... 31
4194 FETCH (command) ............................................ 29
4195 FETCH (response) ........................................... 46
4196 FIND ALL.MAILBOXES (command) ............................... 65
4197 FIND MAILBOXES (command) ................................... 65
4198 FLAGGED (search key) ....................................... 27
4199 FLAGS (fetch item) ......................................... 31
4200
4201
4202
4203Crispin [Page 71]
4204
4205RFC 1730 IMAP4 December 1994
4206
4207
4208
4209 FLAGS (fetch result) ....................................... 50
4210 FLAGS (response) ........................................... 44
4211 FLAGS <flag list> (store command data item) ................ 34
4212 FLAGS.SILENT <flag list> (store command data item) ......... 34
4213 FROM <string> (search key) ................................. 27
4214 FULL (fetch item) .......................................... 31
4215 HEADER <field-name> <string> (search key) .................. 27
4216 INTERNALDATE (fetch item) .................................. 31
4217 INTERNALDATE (fetch result) ................................ 50
4218 KEYWORD <flag> (search key) ................................ 27
4219 LARGER <n> (search key) .................................... 27
4220 LIST (command) ............................................. 20
4221 LIST (response) ............................................ 43
4222 LOGIN (command) ............................................ 14
4223 LOGOUT (command) ........................................... 11
4224 LSUB (command) ............................................. 22
4225 LSUB (response) ............................................ 44
4226 MAILBOX (response) ......................................... 68
4227 NEW (search key) ........................................... 27
4228 NO (response) .............................................. 40
4229 NOOP (command) ............................................. 11
4230 NOT <search-key> (search key) .............................. 28
4231 OK (response) .............................................. 40
4232 OLD (search key) ........................................... 28
4233 ON <date> (search key) ..................................... 28
4234 OR <search-key1> <search-key2> (search key) ................ 28
4235 PARSE (response code) ...................................... 39
4236 PARTIAL (command) .......................................... 32
4237 PERMANENTFLAGS (response code) ............................. 39
4238 PREAUTH (response) ......................................... 41
4239 READ-ONLY (response code) .................................. 39
4240 READ-WRITE (response code) ................................. 39
4241 RECENT (response) .......................................... 45
4242 RECENT (search key) ........................................ 28
4243 RENAME (command) ........................................... 18
4244 RFC822 (fetch item) ........................................ 31
4245 RFC822 (fetch result) ...................................... 50
4246 RFC822.HEADER (fetch item) ................................. 31
4247 RFC822.HEADER (fetch result) ............................... 50
4248 RFC822.HEADER.LINES <header_list> (fetch item) ............. 31
4249 RFC822.HEADER.LINES.NOT <header_list> (fetch item) ......... 32
4250 RFC822.PEEK (fetch item) ................................... 31
4251 RFC822.SIZE (fetch item) ................................... 32
4252 RFC822.SIZE (fetch result) ................................. 50
4253 RFC822.TEXT (fetch item) ................................... 32
4254 RFC822.TEXT (fetch result) ................................. 51
4255 RFC822.TEXT.PEEK (fetch item) .............................. 32
4256 SEARCH (command) ........................................... 25
4257
4258
4259
4260Crispin [Page 72]
4261
4262RFC 1730 IMAP4 December 1994
4263
4264
4265
4266 SEARCH (response) .......................................... 44
4267 SEEN (search key) .......................................... 28
4268 SELECT (command) ........................................... 15
4269 SENTBEFORE <date> (search key) ............................. 28
4270 SENTON <date> (search key) ................................. 28
4271 SENTSINCE <date> (search key) .............................. 28
4272 SINCE <date> (search key) .................................. 28
4273 SMALLER <n> (search key) ................................... 28
4274 STORE (command) ............................................ 33
4275 STORE (response) ........................................... 69
4276 SUBJECT <string> (search key) .............................. 28
4277 SUBSCRIBE (command) ........................................ 19
4278 SUBSCRIBE MAILBOX (command) ................................ 66
4279 TEXT <string> (search key) ................................. 28
4280 TO <string> (search key) ................................... 28
4281 TRYCREATE (response code) .................................. 39
4282 UID (command) .............................................. 35
4283 UID (fetch item) ........................................... 32
4284 UID (fetch result) ......................................... 51
4285 UID <message set> (search key) ............................. 28
4286 UIDVALIDITY (response code) ................................ 40
4287 UNANSWERED (search key) .................................... 29
4288 UNDELETED (search key) ..................................... 29
4289 UNDRAFT (search key) ....................................... 29
4290 UNFLAGGED (search key) ..................................... 29
4291 UNKEYWORD <flag> (search key) .............................. 29
4292 UNSEEN (response code) ..................................... 40
4293 UNSEEN (search key) ........................................ 29
4294 UNSUBSCRIBE (command) ...................................... 19
4295 UNSUBSCRIBE MAILBOX (command) .............................. 66
4296 X<atom> (command) .......................................... 37
4297 \Answered (system flag) .................................... 50
4298 \Deleted (system flag) ..................................... 50
4299 \Draft (system flag) ....................................... 50
4300 \Flagged (system flag) ..................................... 50
4301 \Marked (mailbox name attribute) ........................... 43
4302 \Noinferiors (mailbox name attribute) ...................... 43
4303 \Noselect (mailbox name attribute) ......................... 43
4304 \Recent (system flag) ...................................... 50
4305 \Seen (system flag) ........................................ 50
4306 \Unmarked (mailbox name attribute) ......................... 43
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317Crispin [Page 73]
4318
4319