<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" submissionType="IETF" category="std" consensus="true" docName="draft-ietf-extra-imap-partial-04" number="9394" ipr="pre5378Trust200902" updates="4731, 5267" obsoletes="" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" prepTime="2023-06-12T08:20:16" indexInclude="true" scripts="Common,Latin" tocDepth="3">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-extra-imap-partial-04" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc9394" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="IMAP PARTIAL Extension">IMAP PARTIAL Extension for Paged SEARCH and FETCH</title>
    <seriesInfo name="RFC" value="9394" stream="IETF"/>
    <author initials="A." surname="Melnikov" fullname="Alexey Melnikov">
      <organization abbrev="Isode" showOnFrontPage="true">Isode Limited</organization>
      <address>
        <email>alexey.melnikov@isode.com</email>
        <uri>https://www.isode.com</uri>
      </address>
    </author>
    <author initials="A. P." surname="Achuthan" fullname="Arun Prakash Achuthan">
      <organization abbrev="Yahoo!" showOnFrontPage="true">Yahoo!</organization>
      <address>
        <email>arunprakash@myyahoo.com</email>
      </address>
    </author>
    <author initials="V." surname="Nagulakonda" fullname="Vikram Nagulakonda">
      <organization abbrev="Yahoo!" showOnFrontPage="true">Yahoo!</organization>
      <address>
        <email>nvikram_imap@yahoo.com</email>
      </address>
    </author>
    <author initials="L." surname="Alves" fullname="Luis Alves">
      <address>
        <email>luis.alves@lafaspot.com</email>
      </address>
    </author>
    <date month="06" year="2023"/>
    <area>art</area>
    <workgroup>extra</workgroup>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">The PARTIAL extension of the Internet Message Access Protocol (see RFCs 3501 and 9051)
                        allows clients to limit the number of SEARCH results returned, as well as to perform incremental (paged) searches.
      This also helps servers to optimize resource usage when performing searches.
      </t>
      <t indent="0" pn="section-abstract-2">This document extends the PARTIAL SEARCH return option originally specified in RFC 5267.
      It also clarifies some interactions between RFC 5267 and RFCs 4731 and 9051.</t>
      <t indent="0" pn="section-abstract-3">This document updates RFCs 4731 and 5267.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            This document is a product of the Internet Engineering Task Force
            (IETF).  It represents the consensus of the IETF community.  It has
            received public review and has been approved for publication by
            the Internet Engineering Steering Group (IESG).  Further
            information on Internet Standards is available in Section 2 of 
            RFC 7841.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc9394" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2023 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) in effect on the date of
            publication of this document. Please review these documents
            carefully, as they describe your rights and restrictions with
            respect to this document. Code Components extracted from this
            document must include Revised BSD License text as described in
            Section 4.e of the Trust Legal Provisions and are provided without
            warranty as described in the Revised BSD License.
        </t>
        <t indent="0" pn="section-boilerplate.2-3">
            This document may contain material from IETF Documents or IETF
            Contributions published or made publicly available before November
            10, 2008. The person(s) controlling the copyright in some of this
            material may not have granted the IETF Trust the right to allow
            modifications of such material outside the IETF Standards Process.
            Without obtaining an adequate license from the person(s)
            controlling the copyright in such materials, this document may not
            be modified outside the IETF Standards Process, and derivative
            works of it may not be created outside the IETF Standards Process,
            except to format it for publication as an RFC or to translate it
            into languages other than English.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction-and-overview">Introduction and Overview</xref></t>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-document-conventions">Document Conventions</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-the-partial-extension">The PARTIAL Extension</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-incremental-search-and-part">Incremental SEARCH and Partial Results</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t indent="0" pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-interaction-between-partial">Interaction between PARTIAL, MIN, MAX, and SAVE SEARCH Return Options</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.3">
                <t indent="0" pn="section-toc.1-1.3.2.3.1"><xref derivedContent="3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-extension-to-uid-fetch">Extension to UID FETCH</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.4">
                <t indent="0" pn="section-toc.1-1.3.2.4.1"><xref derivedContent="3.4" format="counter" sectionFormat="of" target="section-3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-of-partial-and-condstor">Use of "PARTIAL" and "CONDSTORE" IMAP Extensions Together</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-formal-syntax">Formal Syntax</xref></t>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.6.2">
              <li pn="section-toc.1-1.6.2.1">
                <t indent="0" pn="section-toc.1-1.6.2.1.1"><xref derivedContent="6.1" format="counter" sectionFormat="of" target="section-6.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-changes-additions-to-the-im">Changes/Additions to the IMAP Capabilities Registry</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.7.2">
              <li pn="section-toc.1-1.7.2.1">
                <t indent="0" pn="section-toc.1-1.7.2.1.1"><xref derivedContent="7.1" format="counter" sectionFormat="of" target="section-7.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.7.2.2">
                <t indent="0" pn="section-toc.1-1.7.2.2.1"><xref derivedContent="7.2" format="counter" sectionFormat="of" target="section-7.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.a"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgments">Acknowledgments</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Addresses</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction-and-overview">Introduction and Overview</name>
      <t indent="0" pn="section-1-1">This document defines an extension to the Internet Message Access Protocol <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501"/> <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/>
      for performing incremental searches and fetches.
      This extension is compatible with both IMAP4rev1 <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501"/> and IMAP4rev2 <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/>.
      This extension uses IMAP extensibility rules defined in <xref target="RFC4466" format="default" sectionFormat="of" derivedContent="RFC4466"/>.</t>
      <t indent="0" pn="section-1-2">
      The PARTIAL extension of the Internet Message Access Protocol 
      allows clients to limit the number of SEARCH results returned, as well as to perform incremental (paged) searches.
      This also helps servers to optimize resource usage when performing searches.
      </t>
      <t indent="0" pn="section-1-3">This document extends the PARTIAL SEARCH return option originally specified in RFC 5267.
      It also clarifies some interactions between RFC 5267 and RFCs 4731 and 9051.</t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-document-conventions">Document Conventions</name>
      <t indent="0" pn="section-2-1">In protocol examples, this document uses a prefix of "C: " to denote lines sent by the client to the server and
                        "S: " for lines sent by the server to the client. Lines prefixed with "// " are comments explaining the previous protocol line.
                        These prefixes and comments are not part of the protocol. Lines without any of these prefixes are continuations of the previous line,
                        and no line breaks are present in the protocol unless specifically mentioned.</t>
      <t indent="0" pn="section-2-2">The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
       "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>",
       "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>",
       "<bcp14>SHOULD NOT</bcp14>",
       "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
       "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document
       are to be interpreted as described in BCP 14
       <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> when, and only
       when, they appear in all capitals, as shown here.</t>
      <t indent="0" pn="section-2-3">Other capitalized words are IMAP key words <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501"/> <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/>
            or key words from this document.</t>
    </section>
    <section anchor="imap-partial" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-the-partial-extension">The PARTIAL Extension</name>
      <t indent="0" pn="section-3-1">An IMAP server advertises support for the PARTIAL extension
        by including the "PARTIAL" capability in the CAPABILITY response / response code.</t>
      <section anchor="partial-def" numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-incremental-search-and-part">Incremental SEARCH and Partial Results</name>
        <t indent="0" pn="section-3.1-1">
      The PARTIAL SEARCH return option causes the server to provide in an
      ESEARCH response <xref target="RFC4731" format="default" sectionFormat="of" derivedContent="RFC4731"/> <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/> a subset of the results denoted by the sequence
      range given as the mandatory argument.
      The first result (message with the lowest matching Unique
   Identifier (UID)) is 1;
      thus, the first 500 results would be obtained by a return option of
      "PARTIAL 1:500" and the second 500 by "PARTIAL 501:1000".  This
      intentionally mirrors message sequence numbers.
        </t>
        <t indent="0" pn="section-3.1-2">
      It is also possible to direct the server to start the SEARCH from the latest
      matching (with the highest UID) message. This can be done by prepending "-"
      to the index. For example, -1 is the last message, -2 is next to the last, and so on.
      Using this syntax helps server implementations to optimize their SEARCHes.
        </t>
        <t indent="0" pn="section-3.1-3">
      A single command <bcp14>MUST NOT</bcp14> contain more than one PARTIAL or ALL search
      return option; that is, either one PARTIAL, one ALL, or neither
      PARTIAL nor ALL is allowed.
        </t>
        <t indent="0" pn="section-3.1-4">
      For SEARCH results, the entire list of results <bcp14>MUST</bcp14> be ordered in mailbox
      order -- that is, in UID or message sequence number order.
        </t>
        <t indent="0" pn="section-3.1-5">
      In cases where a PARTIAL SEARCH return option references results that do not
      exist by using a range that starts or ends higher (or lower) than the current
      number of results, the server returns the results that are in
      the set.  This yields a PARTIAL return data item that has, as
      payload, the original range and a potentially missing set of results
      that may be shorter than the extent of the range.
      If the whole range references results that do not exist,
      a special value "NIL" is returned by the server instead of the sequence set.
        </t>
        <t indent="0" pn="section-3.1-6">
      Clients need not request PARTIAL results in any particular order.
      Because mailboxes may change, clients might wish to use PARTIAL
      in combination with UPDATE (see <xref target="RFC5267" format="default" sectionFormat="of" derivedContent="RFC5267"/>) if the server
      also advertises the "CONTEXT=SEARCH" capability, especially if the intent is to walk a
      large set of results; however, these return options do not interact
      -- the UPDATE will provide notifications for all matching results.
        </t>
        <artwork name="" type="" align="left" alt="" pn="section-3.1-7">
  // Let's assume that the A01 SEARCH without PARTIAL would return
  // 23764 results.
  C: A01 UID SEARCH RETURN (PARTIAL -1:-100) UNDELETED
      UNKEYWORD $Junk
  S: * ESEARCH (TAG "A01") UID PARTIAL (-1:-100 ...)
  // 100 most recent results in set syntax elided.
  S: A01 OK Completed.
</artwork>
        <artwork name="" type="" align="left" alt="" pn="section-3.1-8">
  // Let's assume that the A02 SEARCH without PARTIAL would return
  // 23764 results.
  C: A02 UID SEARCH RETURN (PARTIAL 23500:24000) UNDELETED
      UNKEYWORD $Junk
  C: A03 UID SEARCH RETURN (PARTIAL 1:500) UNDELETED
      UNKEYWORD $Junk
  C: A04 UID SEARCH RETURN (PARTIAL 24000:24500) UNDELETED
      UNKEYWORD $Junk
  S: * ESEARCH (TAG "A02") UID PARTIAL (23500:24000 ...)
  // 264 results in set syntax elided;
  // this spans the end of the results.
  S: A02 OK Completed.
  S: * ESEARCH (TAG "A03") UID PARTIAL (1:500 ...)
  // 500 results in set syntax elided.
  S: A03 OK Completed.
  S: * ESEARCH (TAG "A04") UID PARTIAL (24000:24500 NIL)
  // No results are present; this is beyond the end of the results.
  S: A04 OK Completed.
</artwork>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-interaction-between-partial">Interaction between PARTIAL, MIN, MAX, and SAVE SEARCH Return Options</name>
        <t indent="0" pn="section-3.2-1">This section only applies if the server advertises the "PARTIAL" IMAP capability or "CONTEXT=SEARCH" <xref target="RFC5267" format="default" sectionFormat="of" derivedContent="RFC5267"/>,
      together with "ESEARCH" <xref target="RFC4731" format="default" sectionFormat="of" derivedContent="RFC4731"/> and/or IMAP4rev2 <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/>.</t>
        <t indent="0" pn="section-3.2-2">
      The SAVE result option doesn't change whether the server would return
      items corresponding to PARTIAL SEARCH result options.
        </t>
        <t indent="0" pn="section-3.2-3">
      As specified in <xref target="partial-def" format="default" sectionFormat="of" derivedContent="Section 3.1"/>, it is an error to specify both the
      PARTIAL and ALL result options in the same SEARCH command.
        </t>
        <t indent="0" pn="section-3.2-4">
      When the SAVE result option is combined with the PARTIAL
      result option and none of the MIN/MAX/COUNT result options are
      present, the corresponding PARTIAL is returned,
      and the "$" marker would contain references to all
      messages returned by the PARTIAL result option.
        </t>
        <t indent="0" pn="section-3.2-5">
      When the SAVE and PARTIAL result options are combined with the MIN or MAX
      result option and the COUNT result option is
      absent, the corresponding PARTIAL result and MIN/MAX are returned (if the SEARCH result
      is not empty), and the "$" marker would contain references to all
      messages returned by the PARTIAL result option together with the corresponding MIN/MAX message.
        </t>
        <t indent="0" pn="section-3.2-6">
      If the SAVE and PARTIAL result options are combined with both the MIN and MAX result
      options and the COUNT result option is absent,
      the PARTIAL, MIN, and MAX result options are returned (if the SEARCH result is not empty),
      and the "$" marker would contain references to all
      messages returned by the PARTIAL result option together with the MIN and MAX messages.
        </t>
        <t indent="0" pn="section-3.2-7">
      If the SAVE and PARTIAL result options are combined with the COUNT
      result option, the PARTIAL and COUNT result options are returned,
      and the "$" marker would always contain references to all messages
      found by the SEARCH or UID SEARCH command.
        </t>
        <t keepWithNext="true" indent="0" pn="section-3.2-8">
          <xref target="tab1" format="default" sectionFormat="of" derivedContent="Table 1"/> summarizes additional requirements for ESEARCH
          server implementations described in this section.
        </t>
        <t indent="0" pn="section-3.2-9">
          Note regarding <xref target="tab1" format="default" sectionFormat="of" derivedContent="Table 1"/>: "[m]" means optional "MIN" and/or "MAX".
        </t>
        <table anchor="tab1" align="center" pn="table-1">
          <thead>
            <tr>
              <th align="center" colspan="1" rowspan="1">Combination of Result Options</th>
              <th align="center" colspan="1" rowspan="1">"$" Marker Value</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="center" colspan="1" rowspan="1">SAVE PARTIAL</td>
              <td align="center" colspan="1" rowspan="1">PARTIAL</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">SAVE PARTIAL MIN</td>
              <td align="center" colspan="1" rowspan="1">PARTIAL &amp; MIN</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">SAVE PARTIAL MAX</td>
              <td align="center" colspan="1" rowspan="1">PARTIAL &amp; MAX</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">SAVE PARTIAL MIN MAX</td>
              <td align="center" colspan="1" rowspan="1">PARTIAL &amp; MIN &amp; MAX</td>
            </tr>
            <tr>
              <td align="center" colspan="1" rowspan="1">SAVE PARTIAL COUNT [m]</td>
              <td align="center" colspan="1" rowspan="1">all found messages</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-extension-to-uid-fetch">Extension to UID FETCH</name>
        <t indent="0" pn="section-3.3-1">The PARTIAL extension also extends the UID FETCH command with a PARTIAL FETCH modifier.
      The PARTIAL FETCH modifier has the same syntax as the PARTIAL SEARCH result option.
      The presence of the PARTIAL FETCH modifier instructs the server to only return FETCH results
      for messages in the specified range. It is useful when the sequence-set (first) parameter in
      the UID FETCH command includes an unknown number of messages.</t>
        <artwork name="" type="" align="left" alt="" pn="section-3.3-2">
  // Returning information for the last 3 messages in the UID range
  C: 10 UID FETCH 25900:26600 (UID FLAGS) (PARTIAL -1:-3)
  S: * 12888 FETCH (FLAGS (\Seen) UID 25996)
  S: * 12889 FETCH (FLAGS (\Flagged \Answered) UID 25997)
  S: * 12890 FETCH (FLAGS () UID 26600)
  S: 10 OK FETCH completed
</artwork>
        <artwork name="" type="" align="left" alt="" pn="section-3.3-3">
  // Returning information for the first 5 messages in the UID range
  C: 11 UID FETCH 25900:26600 (UID FLAGS) (PARTIAL 1:5)
  S: * 12591 FETCH (FLAGS (\Seen) UID 25900)
  S: * 12592 FETCH (FLAGS (\Flagged) UID 25902)
  S: * 12593 FETCH (FLAGS (\Answered) UID 26310)
  S: * 12594 FETCH (FLAGS () UID 26311)
  S: * 12595 FETCH (FLAGS (\Answered) UID 26498)
  S: 11 OK FETCH completed
</artwork>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.4">
        <name slugifiedName="name-use-of-partial-and-condstor">Use of "PARTIAL" and "CONDSTORE" IMAP Extensions Together</name>
        <t indent="0" pn="section-3.4-1">This section is informative.</t>
        <t indent="0" pn="section-3.4-2">The PARTIAL FETCH modifier can be combined with the CHANGEDSINCE FETCH modifier <xref target="RFC7162" format="default" sectionFormat="of" derivedContent="RFC7162"/>.</t>
        <artwork name="" type="" align="left" alt="" pn="section-3.4-3">
  // Returning information for the last 30 messages in the UID range
  // that have any flags/keywords modified since MODSEQ 98305
  C: 101 UID FETCH 25900:26600 (UID FLAGS
     ) (PARTIAL -1:-30 CHANGEDSINCE 98305)
  S: * 12888 FETCH (FLAGS (\Flagged \Answered
     ) MODSEQ (98306) UID 25997)
  S: * 12890 FETCH (FLAGS () MODSEQ (98312) UID 26600)
  S: 101 OK FETCH completed
</artwork>
        <t indent="0" pn="section-3.4-4">The above example causes the server to first select the last 30 messages
            and then only return flag changes for a subset of those messages that
            have MODSEQ higher than 98305.</t>
        <t indent="0" pn="section-3.4-5">Note that the order of PARTIAL and CHANGEDSINCE FETCH modifiers in the UID FETCH command
            is not important, i.e., the above example can also use the
            "UID FETCH 25900:26600 (UID FLAGS) (CHANGEDSINCE 98305 PARTIAL -1:-30)"
            command and it would result in the same responses.</t>
      </section>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-formal-syntax">Formal Syntax</name>
      <t indent="0" pn="section-4-1">The following syntax specification uses the Augmented Backus-Naur Form (ABNF) notation as specified in <xref target="RFC5234" format="default" sectionFormat="of" derivedContent="ABNF"/>.</t>
      <t indent="0" pn="section-4-2">Non-terminals referenced but not defined below are as defined by <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501">IMAP4rev1</xref> or <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051">IMAP4rev2</xref>.</t>
      <t indent="0" pn="section-4-3">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 <bcp14>MUST</bcp14> accept these strings in a case-insensitive fashion.</t>
      <sourcecode type="abnf" markers="false" pn="section-4-4">
SP                  = &lt;Defined in RFC 5234&gt;
MINUS               = "-"

capability          =/ "PARTIAL"
                       ;; &lt;capability&gt; from [RFC3501].

modifier-partial    = "PARTIAL" SP partial-range

partial-range-first = nz-number ":" nz-number
    ;; Request to search from oldest (lowest UIDs) to
    ;; more recent messages.
    ;; A range 500:400 is the same as 400:500.
    ;; This is similar to &lt;seq-range&gt; from [RFC3501]
    ;; but cannot contain "*".

partial-range-last  = MINUS nz-number ":" MINUS nz-number
    ;; Request to search from newest (highest UIDs) to
    ;; oldest messages.
    ;; A range -500:-400 is the same as -400:-500.

partial-range       = partial-range-first / partial-range-last

search-return-opt   =/ modifier-partial
    ;; All conform to &lt;search-return-opt&gt; from
    ;; [RFC4466] and [RFC9051].

search-return-data  =/ ret-data-partial

ret-data-partial    = "PARTIAL"
                      SP "(" partial-range SP partial-results ")"
    ;; &lt;partial-range&gt; is the requested range.

partial-results     = sequence-set / "NIL"
    ;; &lt;sequence-set&gt; from [RFC3501].
    ;; NIL indicates that no results correspond to
    ;; the requested range.

tagged-ext-simple   =/ partial-range-last

fetch-modifier      =/ modifier-partial
                       ;; &lt;fetch-modifier&gt; from [RFC4466].
</sourcecode>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-5-1">
      This document defines an additional IMAP4 capability.  As such, it
      does not change the underlying security considerations of IMAP4rev1
<xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501"/> and IMAP4rev2 <xref target="RFC9051" format="default" sectionFormat="of" derivedContent="RFC9051"/>.
      The authors and reviewers believe that no new security issues are
      introduced with these additional IMAP4 capabilities.
      </t>
      <t indent="0" pn="section-5-2">
      This document defines an optimization that can reduce both the amount of work
      performed by the server and the amount of data returned to the client.
      Use of this extension is likely to cause the server and the client to use less memory
      than when the extension is not used. However, as this is going
      to be new code in both the client and the server, rigorous testing of such code
      is required in order to avoid introducing new implementation bugs.
      </t>
    </section>
    <section numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-6.1">
        <name slugifiedName="name-changes-additions-to-the-im">Changes/Additions to the IMAP Capabilities Registry</name>
        <t indent="0" pn="section-6.1-1">
                                IMAP4 capabilities are registered by publishing a Standards Track or
                                IESG-approved Informational or Experimental RFC.
        The registry is currently located at
   <eref target="https://www.iana.org/assignments/imap-capabilities" brackets="angle"/>.
        </t>
        <t indent="0" pn="section-6.1-2">IANA has added the PARTIAL extension to the "IMAP Capabilities" registry
         with RFC 9394 as the reference.
        </t>
      </section>
    </section>
  </middle>
  <back>
    <displayreference target="RFC5234" to="ABNF"/>
    <references pn="section-7">
      <name slugifiedName="name-references">References</name>
      <references pn="section-7.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5234" quoteTitle="true" derivedAnchor="ABNF">
          <front>
            <title>Augmented BNF for Syntax Specifications: ABNF</title>
            <author fullname="D. Crocker" initials="D." role="editor" surname="Crocker"/>
            <author fullname="P. Overell" initials="P." surname="Overell"/>
            <date month="January" year="2008"/>
            <abstract>
              <t indent="0">Internet technical specifications often need to define a formal syntax.  Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications.  The current specification documents ABNF.  It balances compactness and simplicity with reasonable representational power.  The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges.  This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="68"/>
          <seriesInfo name="RFC" value="5234"/>
          <seriesInfo name="DOI" value="10.17487/RFC5234"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
            <abstract>
              <t indent="0">In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC3501" target="https://www.rfc-editor.org/info/rfc3501" quoteTitle="true" derivedAnchor="RFC3501">
          <front>
            <title>INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1</title>
            <author fullname="M. Crispin" initials="M." surname="Crispin"/>
            <date month="March" year="2003"/>
            <abstract>
              <t indent="0">The Internet Message Access Protocol, Version 4rev1 (IMAP4rev1) allows a client to access and manipulate electronic mail messages on a server.  IMAP4rev1 permits manipulation of mailboxes (remote message folders) in a way that is functionally equivalent to local folders.  IMAP4rev1 also provides the capability for an offline client to resynchronize with the server.  IMAP4rev1 includes operations for creating, deleting, and renaming mailboxes, checking for new messages, permanently removing messages, setting and clearing flags, RFC 2822 and RFC 2045 parsing, searching, and selective fetching of message attributes, texts, and portions thereof.  Messages in IMAP4rev1 are accessed by the use of numbers.  These numbers are either message sequence numbers or unique identifiers.  IMAP4rev1 supports a single server.  A mechanism for accessing configuration information to support multiple IMAP4rev1 servers is discussed in RFC 2244.  IMAP4rev1 does not specify a means of posting mail; this function is handled by a mail transfer protocol such as RFC 2821. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3501"/>
          <seriesInfo name="DOI" value="10.17487/RFC3501"/>
        </reference>
        <reference anchor="RFC4466" target="https://www.rfc-editor.org/info/rfc4466" quoteTitle="true" derivedAnchor="RFC4466">
          <front>
            <title>Collected Extensions to IMAP4 ABNF</title>
            <author fullname="A. Melnikov" initials="A." surname="Melnikov"/>
            <author fullname="C. Daboo" initials="C." surname="Daboo"/>
            <date month="April" year="2006"/>
            <abstract>
              <t indent="0">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.</t>
              <t indent="0">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.</t>
              <t indent="0">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. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4466"/>
          <seriesInfo name="DOI" value="10.17487/RFC4466"/>
        </reference>
        <reference anchor="RFC4731" target="https://www.rfc-editor.org/info/rfc4731" quoteTitle="true" derivedAnchor="RFC4731">
          <front>
            <title>IMAP4 Extension to SEARCH Command for Controlling What Kind of Information Is Returned</title>
            <author fullname="A. Melnikov" initials="A." surname="Melnikov"/>
            <author fullname="D. Cridland" initials="D." surname="Cridland"/>
            <date month="November" year="2006"/>
            <abstract>
              <t indent="0">This document extends IMAP (RFC 3501) SEARCH and UID SEARCH commands with several result options, which can control what kind of information is returned.  The following result options are defined: minimal value, maximal value, all found messages, and number of found messages. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="4731"/>
          <seriesInfo name="DOI" value="10.17487/RFC4731"/>
        </reference>
        <reference anchor="RFC5267" target="https://www.rfc-editor.org/info/rfc5267" quoteTitle="true" derivedAnchor="RFC5267">
          <front>
            <title>Contexts for IMAP4</title>
            <author fullname="D. Cridland" initials="D." surname="Cridland"/>
            <author fullname="C. King" initials="C." surname="King"/>
            <date month="July" year="2008"/>
            <abstract>
              <t indent="0">The IMAP4rev1 protocol has powerful search facilities as part of the core protocol, but lacks the ability to create live, updated results that can be easily handled.  This memo provides such an extension, and shows how it can be used to provide a facility similar to virtual mailboxes. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5267"/>
          <seriesInfo name="DOI" value="10.17487/RFC5267"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t indent="0">RFC 2119 specifies common key words that may be used in protocol specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="RFC9051" target="https://www.rfc-editor.org/info/rfc9051" quoteTitle="true" derivedAnchor="RFC9051">
          <front>
            <title>Internet Message Access Protocol (IMAP) - Version 4rev2</title>
            <author fullname="A. Melnikov" initials="A." role="editor" surname="Melnikov"/>
            <author fullname="B. Leiba" initials="B." role="editor" surname="Leiba"/>
            <date month="August" year="2021"/>
            <abstract>
              <t indent="0">The Internet Message Access Protocol Version 4rev2 (IMAP4rev2) allows a client to access and manipulate electronic mail messages on a server. IMAP4rev2 permits manipulation of mailboxes (remote message folders) in a way that is functionally equivalent to local folders. IMAP4rev2 also provides the capability for an offline client to resynchronize with the server.</t>
              <t indent="0">IMAP4rev2 includes operations for creating, deleting, and renaming mailboxes; checking for new messages; removing messages permanently; setting and clearing flags; parsing per RFCs 5322, 2045, and 2231; searching; and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4rev2 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers.</t>
              <t indent="0">IMAP4rev2 does not specify a means of posting mail; this function is handled by a mail submission protocol such as the one specified in RFC 6409.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9051"/>
          <seriesInfo name="DOI" value="10.17487/RFC9051"/>
        </reference>
      </references>
      <references pn="section-7.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="RFC7162" target="https://www.rfc-editor.org/info/rfc7162" quoteTitle="true" derivedAnchor="RFC7162">
          <front>
            <title>IMAP Extensions: Quick Flag Changes Resynchronization (CONDSTORE) and Quick Mailbox Resynchronization (QRESYNC)</title>
            <author fullname="A. Melnikov" initials="A." surname="Melnikov"/>
            <author fullname="D. Cridland" initials="D." surname="Cridland"/>
            <date month="May" year="2014"/>
            <abstract>
              <t indent="0">Often, multiple IMAP (RFC 3501) clients need to coordinate changes to a common IMAP mailbox. Examples include different clients working on behalf of the same user and multiple users accessing shared mailboxes. These clients need a mechanism to efficiently synchronize state changes for messages within the mailbox.</t>
              <t indent="0">Initially defined in RFC 4551, the Conditional Store facility provides a protected update mechanism for message state information and a mechanism for requesting only changes to the message state. This memo updates that mechanism and obsoletes RFC 4551, based on operational experience.</t>
              <t indent="0">This document additionally updates another IMAP extension, Quick Resynchronization, which builds on the Conditional STORE extension to provide an IMAP client the ability to fully resynchronize a mailbox as part of the SELECT/EXAMINE command, without the need for additional server-side state or client round trips. Hence, this memo obsoletes RFC 5162.</t>
              <t indent="0">Finally, this document also updates the line-length recommendation in Section 3.2.1.5 of RFC 2683.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7162"/>
          <seriesInfo name="DOI" value="10.17487/RFC7162"/>
        </reference>
      </references>
    </references>
    <section numbered="false" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgments">Acknowledgments</name>
      <t indent="0" pn="section-appendix.a-1">This document was motivated by the Yahoo! team and their questions
      about best client practices for dealing with large mailboxes.</t>
      <t indent="0" pn="section-appendix.a-2">
                        The authors of this document would like to thank the following people,
                        who provided useful comments or participated in discussions of
      this document: <contact fullname="Timo Sirainen"/> and <contact fullname="Barry Leiba"/>.
      </t>
      <t indent="0" pn="section-appendix.a-3">This document uses a lot of text from RFC 5267. Thus, the work of
      the RFC 5267 authors -- <contact fullname="Dave Cridland"/> and <contact fullname="Curtis King"/> -- is appreciated.
      </t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-addresses">Authors' Addresses</name>
      <author initials="A." surname="Melnikov" fullname="Alexey Melnikov">
        <organization abbrev="Isode" showOnFrontPage="true">Isode Limited</organization>
        <address>
          <email>alexey.melnikov@isode.com</email>
          <uri>https://www.isode.com</uri>
        </address>
      </author>
      <author initials="A. P." surname="Achuthan" fullname="Arun Prakash Achuthan">
        <organization abbrev="Yahoo!" showOnFrontPage="true">Yahoo!</organization>
        <address>
          <email>arunprakash@myyahoo.com</email>
        </address>
      </author>
      <author initials="V." surname="Nagulakonda" fullname="Vikram Nagulakonda">
        <organization abbrev="Yahoo!" showOnFrontPage="true">Yahoo!</organization>
        <address>
          <email>nvikram_imap@yahoo.com</email>
        </address>
      </author>
      <author initials="L." surname="Alves" fullname="Luis Alves">
        <address>
          <email>luis.alves@lafaspot.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
