0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
Network Working Group                                        A. Melnikov
Request for Comments: 4466                                    Isode Ltd.
Updates: 2088, 2342, 3501, 3502, 3516                           C. Daboo
Category: Standards Track                                     April 2006

                   Collected Extensions to IMAP4 ABNF

Status of This Memo

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

Copyright Notice

   Copyright (C) The Internet Society (2006).

Abstract

   Over the years, many documents from IMAPEXT and LEMONADE working
   groups, as well as many individual documents, have added syntactic
   extensions to many base IMAP commands described in RFC 3501.  For
   ease of reference, this document collects most of such ABNF changes
   in one place.

   This document also suggests a set of standard patterns for adding
   options and extensions to several existing IMAP commands defined in
   RFC 3501.  The patterns provide for compatibility between existing
   and future extensions.

   This document updates ABNF in RFCs 2088, 2342, 3501, 3502, and 3516.
   It also includes part of the errata to RFC 3501.  This document
   doesn't specify any semantic changes to the listed RFCs.

Melnikov & Daboo            Standards Track                     [Page 1]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

Table of Contents

   1. Introduction ....................................................2
      1.1. Purpose of This Document ...................................2
      1.2. Conventions Used in This Document ..........................3
   2. IMAP ABNF Extensions ............................................3
      2.1. Optional Parameters with the SELECT/EXAMINE Commands .......3
      2.2. Extended CREATE Command ....................................4
      2.3. Extended RENAME Command ....................................5
      2.4. Extensions to FETCH and UID FETCH Commands .................6
      2.5. Extensions to STORE and UID STORE Commands .................6
      2.6. Extensions to SEARCH Command ...............................7
           2.6.1. Extended SEARCH Command .............................7
           2.6.2. ESEARCH untagged response ...........................8
      2.7. Extensions to APPEND Command ...............................8
   3. Formal Syntax ...................................................9
   4. Security Considerations ........................................14
   5. Normative References ...........................................15
   6. Acknowledgements ...............................................15

1.  Introduction

1.1.  Purpose of This Document

   This document serves several purposes:

      1.  rationalize and generalize ABNF for some existing IMAP
          extensions;
      2.  collect the ABNF in one place in order to minimize cross
          references between documents;
      3.  define building blocks for future extensions so that they can
          be used together in a compatible way.

   It is expected that a future revision of this document will be
   incorporated into a revision of RFC 3501.

   This document updates ABNF in RFCs 2088, 2342, 3501, 3502, and 3516.
   It also includes part of the errata to RFC 3501.  This document
   doesn't specify any semantic changes to the listed RFCs.

   The ABNF in section 6 of RFC 2342 got rewritten to conform to the
   ABNF syntax as defined in RFC 4234 and to reference new non-terminals
   from RFC 3501.  It was also restructured to allow for better
   readability.  There were no changes "on the wire".

   Section 2 extends ABNF for SELECT, EXAMINE, CREATE, RENAME, FETCH/UID
   FETCH, STORE/UID STORE, SEARCH, and APPEND commands in a consistent
   manner.  Extensions to all the commands but APPEND have the same

Melnikov & Daboo            Standards Track                     [Page 2]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   structure.  Extensibility for the APPEND command was done slightly
   differently in order to preserve backward compatibility with existing
   extensions.

   Section 2 also defines a new ESEARCH response, whose purpose is to
   define a better version of the SEARCH response defined in RFC 3501.

   Section 3 defines the collected ABNF that replaces pieces of ABNF in
   the aforementioned RFCs.  The collected ABNF got generalized to allow
   for easier future extensibility.

1.2.  Conventions Used in This Document

   In examples, "C:" and "S:" indicate lines sent by the client and
   server, respectively.

   The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
   in this document are to be interpreted as defined in "Key words for
   use in RFCs to Indicate Requirement Levels" [KEYWORDS].

2.  IMAP ABNF Extensions

   This section is not normative.  It provides some background on the
   intended use of different extensions and it gives some guidance about
   how future extensions should extend the described commands.

2.1.  Optional Parameters with the SELECT/EXAMINE Commands

   This document adds the ability to include one or more parameters with
   the IMAP SELECT (section 6.3.1 of [IMAP4]) or EXAMINE (section 6.3.2
   of [IMAP4]) commands, to turn on or off certain standard behaviors,
   or to add new optional behaviors required for a particular extension.

   There are two possible modes of operation:

   o  A global state change where a single use of the optional parameter
      will affect the session state from that time on, irrespective of
      subsequent SELECT/EXAMINE commands.

   o  A per-mailbox state change that will affect the session only for
      the duration of the new selected state.  A subsequent
      SELECT/EXAMINE without the optional parameter will cancel its
      effect for the newly selected mailbox.

   Optional parameters to the SELECT or EXAMINE commands are added as a
   parenthesized list of attribute/value pairs, and appear after the
   mailbox name in the standard SELECT or EXAMINE command.  The order of
   individual parameters is arbitrary.  A parameter value is optional

Melnikov & Daboo            Standards Track                     [Page 3]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   and may consist of atoms, strings, or lists in a specific order.  If
   the parameter value is present, it always appears in parentheses (*).
   Any parameter not defined by extensions that the server supports must
   be rejected with a BAD response.

      Example:

              C: a SELECT INBOX (ANNOTATE)
              S: ...
              S: a OK SELECT complete

      In the above example, a single parameter is used with the SELECT
      command.

      Example:

              C: a EXAMINE INBOX (ANNOTATE RESPONSES ("UID Responses")
                 CONDSTORE)
              S: ...
              S: a OK EXAMINE complete

      In the above example, three parameters are used with the EXAMINE
      command.  The second parameter consists of two items: an atom
      "RESPONSES" followed by a quoted string.

      Example:

              C: a SELECT INBOX (BLURDYBLOOP)
              S: a BAD Unknown parameter in SELECT command

      In the above example, a parameter not supported by the server is
      used.  This results in the BAD response from the server.

   (*) - if a parameter has a mandatory value, which can always be
   represented as a number or a sequence-set, the parameter value does
   not need the enclosing ().  See ABNF for more details.

2.2.  Extended CREATE Command

   Arguments:  mailbox name
               OPTIONAL list of CREATE parameters

   Responses:  no specific responses for this command

   Result:     OK - create completed
               NO - create failure: cannot create mailbox with
                    that name
               BAD - argument(s) invalid

Melnikov & Daboo            Standards Track                     [Page 4]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   This document adds the ability to include one or more parameters with
   the IMAP CREATE command (see section 6.3.3 of [IMAP4]), to turn on or
   off certain standard behaviors, or to add new optional behaviors
   required for a particular extension.  No CREATE parameters are
   defined in this document.

   Optional parameters to the CREATE command are added as a
   parenthesized list of attribute/value pairs after the mailbox name.
   The order of individual parameters is arbitrary.  A parameter value
   is optional and may consist of atoms, strings, or lists in a specific
   order.  If the parameter value is present, it always appears in
   parentheses (*).  Any parameter not defined by extensions that the
   server supports must be rejected with a BAD response.

   (*) - if a parameter has a mandatory value, which can always be
   represented as a number or a sequence-set, the parameter value does
   not need the enclosing ().  See ABNF for more details.

2.3.  Extended RENAME Command

   Arguments:  existing mailbox name
               new mailbox name
               OPTIONAL list of RENAME parameters

   Responses:  no specific responses for this command

   Result:     OK - rename completed
               NO - rename failure: cannot rename mailbox with
                    that name, cannot rename to mailbox with
                    that name, etc.
               BAD - argument(s) invalid

   This document adds the ability to include one or more parameters with
   the IMAP RENAME command (see section 6.3.5 of [IMAP4]), to turn on or
   off certain standard behaviors, or to add new optional behaviors
   required for a particular extension.  No RENAME parameters are
   defined in this document.

   Optional parameters to the RENAME command are added as a
   parenthesized list of attribute/value pairs after the new mailbox
   name.  The order of individual parameters is arbitrary.  A parameter
   value is optional and may consist of atoms, strings, or lists in a
   specific order.  If the parameter value is present, it always appears
   in parentheses (*).  Any parameter not defined by extensions that the
   server supports must be rejected with a BAD response.

Melnikov & Daboo            Standards Track                     [Page 5]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   (*) - if a parameter has a mandatory value, which can always be
   represented as a number or a sequence-set, the parameter value does
   not need the enclosing ().  See ABNF for more details.

2.4.  Extensions to FETCH and UID FETCH Commands

   Arguments:  sequence set
               message data item names or macro
               OPTIONAL fetch modifiers

   Responses:  untagged responses: FETCH

   Result:     OK - fetch completed
               NO - fetch error: cannot fetch that data
               BAD - command unknown or arguments invalid

   This document extends the syntax of the FETCH and UID FETCH commands
   (see section 6.4.5 of [IMAP4]) to include optional FETCH modifiers.
   No fetch modifiers are defined in this document.

   The order of individual modifiers is arbitrary.  Each modifier is an
   attribute/value pair.  A modifier value is optional and may consist
   of atoms and/or strings and/or lists in a specific order.  If the
   modifier value is present, it always appears in parentheses (*).  Any
   modifiers not defined by extensions that the server supports must be
   rejected with a BAD response.

   (*) - if a modifier has a mandatory value, which can always be
   represented as a number or a sequence-set, the modifier value does
   not need the enclosing ().  See ABNF for more details.

2.5.  Extensions to STORE and UID STORE Commands

   Arguments:  message set
               OPTIONAL store modifiers
               message data item name
               value for message data item

   Responses:  untagged responses: FETCH

   Result:     OK - store completed
               NO - store error: cannot store that data
               BAD - command unknown or arguments invalid

   This document extends the syntax of the STORE and UID STORE commands
   (see section 6.4.6 of [IMAP4]) to include optional STORE modifiers.
   No store modifiers are defined in this document.

Melnikov & Daboo            Standards Track                     [Page 6]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   The order of individual modifiers is arbitrary.  Each modifier is an
   attribute/value pair.  A modifier value is optional and may consist
   of atoms and/or strings and/or lists in a specific order.  If the
   modifier value is present, it always appears in parentheses (*).  Any
   modifiers not defined by extensions that the server supports must be
   rejected with a BAD response.

   (*) - if a modifier has a mandatory value, which can always be
   represented as a number or a sequence-set, the modifier value does
   not need the enclosing ().  See ABNF for more details.

2.6.  Extensions to SEARCH Command

2.6.1.  Extended SEARCH Command

   Arguments:  OPTIONAL result specifier
               OPTIONAL [CHARSET] specification
               searching criteria (one or more)

   Responses:  REQUIRED untagged response: SEARCH (*)

   Result:     OK - search completed
               NO - search error: cannot search that [CHARSET] or
                    criteria
               BAD - command unknown or arguments invalid

   This section updates definition of the SEARCH command described in
   section 6.4.4 of [IMAP4].

   The SEARCH command is extended to allow for result options.  This
   document does not define any result options.

   The order of individual options is arbitrary.  Individual options may
   contain parameters enclosed in parentheses (**).  If an option has
   parameters, they consist of atoms and/or strings and/or lists in a
   specific order.  Any options not defined by extensions that the
   server supports must be rejected with a BAD response.

   (*) - An extension to the SEARCH command may require another untagged
   response, or no untagged response to be returned.  Section 2.6.2
   defines a new ESEARCH untagged response that replaces the SEARCH
   untagged response.  Note that for a given extended SEARCH command the
   SEARCH and ESEARCH responses SHOULD be mutually exclusive, i.e., only
   one of them should be returned.

   (**) - if an option has a mandatory parameter, which can always be
   represented as a number or a sequence-set, the option parameter does
   not need the enclosing ().  See ABNF for more details.

Melnikov & Daboo            Standards Track                     [Page 7]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

2.6.2.  ESEARCH untagged response

   Contents:   one or more search-return-data pairs

   The ESEARCH response SHOULD be sent as a result of an extended SEARCH
   or UID SEARCH command specified in section 2.6.1.

   The ESEARCH response starts with an optional search correlator.  If
   it is missing, then the response was not caused by a particular IMAP
   command, whereas if it is present, it contains the tag of the command
   that caused the response to be returned.

   The search correlator is followed by an optional UID indicator.  If
   this indicator is present, all data in the ESEARCH response refers to
   UIDs, otherwise all returned data refers to message numbers.

   The rest of the ESEARCH response contains one or more search data
   pairs.  Each pair starts with unique return item name, followed by a
   space and the corresponding data.  Search data pairs may be returned
   in any order.  Unless specified otherwise by an extension, any return
   item name SHOULD appear only once in an ESEARCH response.

   Example:    S: * ESEARCH UID COUNT 5 ALL 4:19,21,28

   Example:    S: * ESEARCH (TAG "a567") UID COUNT 5 ALL 4:19,21,28

   Example:    S: * ESEARCH COUNT 5 ALL 1:17,21

2.7.  Extensions to APPEND Command

   The IMAP BINARY extension [BINARY] extends the APPEND command to
   allow a client to append data containing NULs by using the <literal8>
   syntax.  The ABNF was rewritten to allow for easier extensibility by
   IMAP extensions.  This document hasn't specified any semantical
   changes to the [BINARY] extension.

   In addition, the non-terminal "literal8" defined in [BINARY] got
   extended to allow for non-synchronizing literals if both [BINARY] and
   [LITERAL+] extensions are supported by the server.

   The IMAP MULTIAPPEND extension [MULTIAPPEND] extends the APPEND
   command to allow a client to append multiple messages atomically.
   This document defines a common syntax for the APPEND command that
   takes into consideration syntactic extensions defined by both
   [BINARY] and [MULTIAPPEND] extensions.

Melnikov & Daboo            Standards Track                     [Page 8]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

3.  Formal Syntax

   The following syntax specification uses the Augmented Backus-Naur
   Form (ABNF) notation as specified in [ABNF].

   Non-terminals referenced but not defined below are as defined by
   [IMAP4].

   Except as noted otherwise, all alphabetic characters are case-
   insensitive.  The use of uppercase or lowercase characters to define
   token strings is for editorial clarity only.  Implementations MUST
   accept these strings in a case-insensitive fashion.

   append          = "APPEND" SP mailbox 1*append-message
                     ;; only a single append-message may appear
                     ;; if MULTIAPPEND [MULTIAPPEND] capability
                     ;; is not present

   append-message  = append-opts SP append-data

   append-ext      = append-ext-name SP append-ext-value
                     ;; This non-terminal define extensions to
                     ;; to message metadata.

   append-ext-name = tagged-ext-label

   append-ext-value= tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   append-data     = literal / literal8 / append-data-ext

   append-data-ext = tagged-ext
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions,
                     ;; i.e., a mandatory label followed
                     ;; by parameters.

   append-opts     = [SP flag-list] [SP date-time] *(SP append-ext)
                     ;; message metadata

   charset         = atom / quoted
                     ;; Exact syntax is defined in [CHARSET].

   create          = "CREATE" SP mailbox
                     [create-params]
                     ;; Use of INBOX gives a NO error.

Melnikov & Daboo            Standards Track                     [Page 9]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   create-params   = SP "(" create-param *( SP create-param) ")"

   create-param-name = tagged-ext-label

   create-param      = create-param-name [SP create-param-value]

   create-param-value= tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   esearch-response  = "ESEARCH" [search-correlator] [SP "UID"]
                        *(SP search-return-data)
                      ;; Note that SEARCH and ESEARCH responses
                      ;; SHOULD be mutually exclusive,
                      ;; i.e., only one of the response types
                      ;; should be
                      ;; returned as a result of a command.

   examine         = "EXAMINE" SP mailbox [select-params]
                     ;; modifies the original IMAP EXAMINE command
                     ;; to accept optional parameters

   fetch           = "FETCH" SP sequence-set SP ("ALL" / "FULL" /
                     "FAST" / fetch-att /
                     "(" fetch-att *(SP fetch-att) ")")
                     [fetch-modifiers]
                     ;; modifies the original IMAP4 FETCH command to
                     ;; accept optional modifiers

   fetch-modifiers = SP "(" fetch-modifier *(SP fetch-modifier) ")"

   fetch-modifier  = fetch-modifier-name [ SP fetch-modif-params ]

   fetch-modif-params  = tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   fetch-modifier-name = tagged-ext-label

   literal8        = "~{" number ["+"] "}" CRLF *OCTET
                      ;; A string that might contain NULs.
                      ;; <number> represents the number of OCTETs
                      ;; in the response string.
                      ;; The "+" is only allowed when both LITERAL+ and
                      ;; BINARY extensions are supported by the server.

Melnikov & Daboo            Standards Track                    [Page 10]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   mailbox-data      =/ Namespace-Response /
                        esearch-response

   Namespace         = nil / "(" 1*Namespace-Descr ")"

   Namespace-Command = "NAMESPACE"

   Namespace-Descr   = "(" string SP
                          (DQUOTE QUOTED-CHAR DQUOTE / nil)
                           *(Namespace-Response-Extension) ")"

   Namespace-Response-Extension = SP string SP
                     "(" string *(SP string) ")"

   Namespace-Response = "NAMESPACE" SP Namespace
                        SP Namespace SP Namespace
         ;; This response is currently only allowed
         ;; if the IMAP server supports [NAMESPACE].
         ;; The first Namespace is the Personal Namespace(s)
         ;; The second Namespace is the Other Users' Namespace(s)
         ;; The third Namespace is the Shared Namespace(s)

   rename          = "RENAME" SP mailbox SP mailbox
                     [rename-params]
                     ;; Use of INBOX as a destination gives
                     ;; a NO error, unless rename-params
                     ;; is not empty.

   rename-params     = SP "(" rename-param *( SP rename-param) ")"

   rename-param      = rename-param-name [SP rename-param-value]

   rename-param-name = tagged-ext-label

   rename-param-value= tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   response-data   = "*" SP response-payload CRLF

   response-payload= resp-cond-state / resp-cond-bye /
                     mailbox-data / message-data / capability-data

   search          = "SEARCH" [search-return-opts]
                     SP search-program

   search-correlator  = SP "(" "TAG" SP tag-string ")"

Melnikov & Daboo            Standards Track                    [Page 11]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   search-program     = ["CHARSET" SP charset SP]
                        search-key *(SP search-key)
                        ;; CHARSET argument to SEARCH MUST be
                        ;; registered with IANA.

   search-return-data = search-modifier-name SP search-return-value
                        ;; Note that not every SEARCH return option
                        ;; is required to have the corresponding
                        ;; ESEARCH return data.

   search-return-opts = SP "RETURN" SP "(" [search-return-opt
                        *(SP search-return-opt)] ")"

   search-return-opt = search-modifier-name [SP search-mod-params]

   search-return-value = tagged-ext-val
                        ;; Data for the returned search option.
                        ;; A single "nz-number"/"number" value
                        ;; can be returned as an atom (i.e., without
                        ;; quoting).  A sequence-set can be returned
                        ;; as an atom as well.

   search-modifier-name = tagged-ext-label

   search-mod-params = tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   select          = "SELECT" SP mailbox [select-params]
                     ;; modifies the original IMAP SELECT command to
                     ;; accept optional parameters

   select-params   = SP "(" select-param *(SP select-param) ")"

   select-param    = select-param-name [SP select-param-value]
                     ;; a parameter to SELECT may contain one or
                     ;; more atoms and/or strings and/or lists.

   select-param-name= tagged-ext-label

   select-param-value= tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   status-att-list = status-att-val *(SP status-att-val)
                     ;; Redefines status-att-list from RFC 3501.

Melnikov & Daboo            Standards Track                    [Page 12]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

                     ;; status-att-val is defined in RFC 3501 errata

   status-att-val  = ("MESSAGES" SP number) /
                     ("RECENT" SP number) /
                     ("UIDNEXT" SP nz-number) /
                     ("UIDVALIDITY" SP nz-number) /
                     ("UNSEEN" SP number)
                     ;; Extensions to the STATUS responses
                     ;; should extend this production.
                     ;; Extensions should use the generic
                     ;; syntax defined by tagged-ext.

   store           = "STORE" SP sequence-set [store-modifiers]
                     SP store-att-flags
                     ;; extend [IMAP4] STORE command syntax
                     ;; to allow for optional store-modifiers

   store-modifiers =  SP "(" store-modifier *(SP store-modifier)
                       ")"

   store-modifier  = store-modifier-name [SP store-modif-params]

   store-modif-params = tagged-ext-val
                     ;; This non-terminal shows recommended syntax
                     ;; for future extensions.

   store-modifier-name = tagged-ext-label

   tag-string         = string
                        ;; tag of the command that caused
                        ;; the ESEARCH response, sent as
                        ;; a string.

   tagged-ext          = tagged-ext-label SP tagged-ext-val
                          ;; recommended overarching syntax for
                          ;; extensions

   tagged-ext-label    = tagged-label-fchar *tagged-label-char
                         ;; Is a valid RFC 3501 "atom".

   tagged-label-fchar  = ALPHA / "-" / "_" / "."

   tagged-label-char   = tagged-label-fchar / DIGIT / ":"

Melnikov & Daboo            Standards Track                    [Page 13]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

   tagged-ext-comp     = astring /
                         tagged-ext-comp *(SP tagged-ext-comp) /
                         "(" tagged-ext-comp ")"
                          ;; Extensions that follow this general
                          ;; syntax should use nstring instead of
                          ;; astring when appropriate in the context
                          ;; of the extension.
                          ;; Note that a message set or a "number"
                          ;; can always be represented as an "atom".
                          ;; An URL should be represented as
                          ;; a "quoted" string.

   tagged-ext-simple   = sequence-set / number

   tagged-ext-val      = tagged-ext-simple /
                         "(" [tagged-ext-comp] ")"

4.  Security Considerations

   This document updates ABNF in RFCs 2088, 2342, 3501, 3502, and 3516.
   The updated documents must be consulted for security considerations
   for the extensions that they define.

   As a protocol gets more complex, parser bugs become more common
   including buffer overflow, denial of service, and other common
   security coding errors.  To the extent that this document makes the
   parser more complex, it makes this situation worse.  To the extent
   that this document makes the parser more consistent and thus simpler,
   the situation is improved.  The impact will depend on how many
   deployed IMAP extensions are consistent with this document.
   Implementers are encouraged to take care of these issues when
   extending existing implementations.  Future IMAP extensions should
   strive for consistency and simplicity to the greatest extent
   possible.

   Extensions to IMAP commands that are permitted in NOT AUTHENTICATED
   state are more sensitive to these security issues due to the larger
   possible attacker community prior to authentication, and the fact
   that some IMAP servers run with elevated privileges in that state.
   This document does not extend any commands permitted in NOT
   AUTHENTICATED state.  Future IMAP extensions to commands permitted in
   NOT AUTHENTICATED state should favor simplicity over consistency or
   extensibility.

Melnikov & Daboo            Standards Track                    [Page 14]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

5.  Normative References

   [KEYWORDS]    Bradner, S., "Key words for use in RFCs to Indicate
                 Requirement Levels", BCP 14, RFC 2119, March 1997.

   [IMAP4]       Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL -
                 VERSION 4rev1", RFC 3501, March 2003.

   [ABNF]        Crocker, D., Ed., and P. Overell, "Augmented BNF for
                 Syntax Specifications: ABNF", RFC 4234, October 2005.

   [CHARSET]     Freed, N. and J. Postel, "IANA Charset Registration
                 Procedures", BCP 19, RFC 2978, October 2000.

   [MULTIAPPEND] Crispin, M., "Internet Message Access Protocol (IMAP) -
                 MULTIAPPEND Extension", RFC 3502, March 2003.

   [NAMESPACE]   Gahrns, M. and C. Newman, "IMAP4 Namespace", RFC 2342,
                 May 1998.

   [LITERAL+]    Myers, J., "IMAP4 non-synchronizing literals", RFC
                 2088, January 1997.

   [BINARY]      Nerenberg, L., "IMAP4 Binary Content Extension", RFC
                 3516, April 2003.

6.  Acknowledgements

   This documents is based on ideas proposed by Pete Resnick, Mark
   Crispin, Ken Murchison, Philip Guenther, Randall Gellens, and Lyndon
   Nerenberg.

   However, all errors and omissions must be attributed to the authors
   of the document.

   Thanks to Philip Guenther, Dave Cridland, Mark Crispin, Chris Newman,
   Elwyn Davies, and Barry Leiba for comments and corrections.

   literal8 syntax was taken from RFC 3516.

Melnikov & Daboo            Standards Track                    [Page 15]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

Authors' Addresses

   Alexey Melnikov
   Isode Limited
   5 Castle Business Village
   36 Station Road
   Hampton, Middlesex, TW12 2BX
   UK

   EMail: Alexey.Melnikov@isode.com

   Cyrus Daboo

   EMail: cyrus@daboo.name

Melnikov & Daboo            Standards Track                    [Page 16]

RFC 4466           Collected Extensions to IMAP4 ABNF         April 2006

Full Copyright Statement

   Copyright (C) The Internet Society (2006).

   This document is subject to the rights, licenses and restrictions
   contained in BCP 78, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
   ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at
   ietf-ipr@ietf.org.

Acknowledgement

   Funding for the RFC Editor function is provided by the IETF
   Administrative Support Activity (IASA).

Melnikov & Daboo            Standards Track                    [Page 17]

Search by Algolia