<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" consensus="true" docName="draft-ietf-extra-imap-fetch-preview-10" indexInclude="true" ipr="trust200902" number="8970" prepTime="2020-12-18T15:51:38" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-extra-imap-fetch-preview-10" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8970" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="IMAP: PREVIEW Extension">IMAP4 Extension: Message Preview Generation</title>
    <seriesInfo name="RFC" value="8970" stream="IETF"/>
    <author fullname="Michael M. Slusarz" initials="M." surname="Slusarz">
      <organization showOnFrontPage="true">Open-Xchange Inc.</organization>
      <address>
        <postal>
          <street>530 Lytton Avenue</street>
          <city>Palo Alto</city>
          <region>California</region>
          <code>94301</code>
          <country>US</country>
        </postal>
        <phone/>
        <email>michael.slusarz@open-xchange.com</email>
      </address>
    </author>
    <date month="12" year="2020"/>
    <area>ART</area>
    <workgroup>EXTRA</workgroup>
    <keyword>IMAP4</keyword>
    <keyword>FETCH</keyword>
    <keyword>PREVIEW</keyword>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">This document specifies an Internet Message Access Protocol (IMAP)
      protocol extension that allows a client to request a server-generated
      abbreviated text representation of message data that is useful as a contextual
      preview of the entire message.</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/rfc8970" 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) 2020 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 Simplified BSD License text as described in
            Section 4.e of the Trust Legal Provisions and are provided without
            warranty as described in the Simplified BSD License.
        </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">Introduction</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-conventions-used-in-this-do">Conventions Used in This Document</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-fetch-data-item">FETCH Data Item</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-command">Command</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-response">Response</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-preview-text-format">Preview Text Format</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-lazy-priority-modifier">LAZY Priority Modifier</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2">
              <li pn="section-toc.1-1.4.2.1">
                <t indent="0" pn="section-toc.1-1.4.2.1.1"><xref derivedContent="4.1" format="counter" sectionFormat="of" target="section-4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-lazy">LAZY</xref></t>
              </li>
              <li pn="section-toc.1-1.4.2.2">
                <t indent="0" pn="section-toc.1-1.4.2.2.1"><xref derivedContent="4.2" format="counter" sectionFormat="of" target="section-4.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-client-implementation-advic">Client Implementation Advice</xref></t>
              </li>
            </ul>
          </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-examples">Examples</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-formal-syntax">Formal Syntax</xref></t>
          </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-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="8" format="counter" sectionFormat="of" target="section-8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="9" format="counter" sectionFormat="of" target="section-9"/>.  <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.9.2">
              <li pn="section-toc.1-1.9.2.1">
                <t indent="0" pn="section-toc.1-1.9.2.1.1"><xref derivedContent="9.1" format="counter" sectionFormat="of" target="section-9.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.9.2.2">
                <t indent="0" pn="section-toc.1-1.9.2.2.1"><xref derivedContent="9.2" format="counter" sectionFormat="of" target="section-9.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.10">
            <t indent="0" pn="section-toc.1-1.10.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.11">
            <t indent="0" pn="section-toc.1-1.11.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-address">Author's Address</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="Introduction" numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t indent="0" pn="section-1-1">Many modern mail clients display small extracts of the body text as
      an aid to allow a user to quickly decide whether they are interested
      in viewing the full message contents. Mail clients implementing the
      <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501">Internet Message Access Protocol</xref>
      would benefit from a standardized, consistent way to
      generate these brief textual previews of messages.</t>
      <t indent="0" pn="section-1-2">
  Generation of a preview on the server has several benefits.  First,
  it allows consistent representation of previews across all clients.
  While different clients might generate quite different preview text,
  having common preview text generated by the server can give a more
  consistent user experience to those who use multiple clients.
      </t>
      <t indent="0" pn="section-1-3">Second, server-side preview generation is more efficient. A
      client-based algorithm needs to issue, at a minimum, a FETCH
      BODYSTRUCTURE command in order to determine which <xref target="RFC2045" format="default" sectionFormat="of" derivedContent="RFC2045">MIME</xref> body part(s) should be represented in
      the preview. Subsequently, at least one FETCH BODY command may be
      needed to retrieve body data used in preview generation. These FETCH
      commands cannot be pipelined since the BODYSTRUCTURE query must be
      parsed on the client before the list of parts to be retrieved via the
      BODY command(s) can be determined.</t>
      <t indent="0" pn="section-1-4">Additionally, it may be difficult to predict the amount of body
      data that must be retrieved to adequately represent the part via a
      preview, therefore requiring inefficient fetching of excessive data
      in order to account for this uncertainty. For example, a preview
      algorithm to display data contained in a <xref target="RFC2854" format="default" sectionFormat="of" derivedContent="RFC2854">text/html</xref> part will likely
      strip the markup tags to obtain textual content. However, without
      fetching the entire content of the part, there is no way to guarantee
      that sufficient non-tag content will exist unless either 1) the entire
      part is retrieved or 2) an additional partial FETCH is executed when
      the client determines that it does not possess sufficient data from a
      previous partial FETCH to display an adequate representation of the
      preview.</t>
      <t indent="0" pn="section-1-5">Finally, server generation allows caching in a centralized
      location. Using server-generated previews allows global generation
      once per message, and that preview can be cached for the retention
      period of the source message. Retrieval of message data may be
      expensive within a server, for example, so a server can be configured
      to reduce its storage retrieval load by pre-generating preview
      data.</t>
      <t indent="0" pn="section-1-6">A server indicates support for this extension via the "PREVIEW"
      capability name.</t>
    </section>
    <section anchor="Conventions" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-conventions-used-in-this-do">Conventions Used in This Document</name>
      <t indent="0" pn="section-2-1">
    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-2">"User" is used to refer to a human user, whereas "client" refers to
      the software being run by the user.</t>
      <t indent="0" pn="section-2-3">In examples, "C:" and "S:" indicate lines sent by the client and
      server, respectively. If a single "C:" or "S:" label applies to
      multiple lines, then the line breaks between those lines are for
      editorial clarity only and are not part of the actual protocol
      exchange.</t>
      <t indent="0" pn="section-2-4">As with all IMAP extension documents, the case used in writing
      IMAP protocol elements herein is chosen for editorial clarity, and
      implementations must pay attention to the numbered rules at the
      beginning of <xref target="RFC3501" sectionFormat="of" section="9" format="default" derivedLink="https://rfc-editor.org/rfc/rfc3501#section-9" derivedContent="RFC3501"/>.</t>
    </section>
    <section anchor="Fetch" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-fetch-data-item">FETCH Data Item</name>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-command">Command</name>
        <t indent="0" pn="section-3.1-1">To retrieve a preview for a message, the PREVIEW FETCH attribute
        is used when issuing a FETCH command.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-response">Response</name>
        <t indent="0" pn="section-3.2-1">The server returns a variable-length string that is the generated
        preview for that message. This string is intended to be viewed by the
        user as a contextual preview of the entire message and is not
        intended to be interpreted in any way by the client software.</t>
        <t keepWithNext="true" indent="0" pn="section-3.2-2">Example: Retrieving preview information in a SELECTed
          mailbox.</t>
        <sourcecode name="" type="" markers="false" pn="section-3.2-3">
  C: A1 FETCH 1 (PREVIEW)
  S: * 1 FETCH (PREVIEW "Preview text!")
  S: A1 OK FETCH complete.
</sourcecode>
        <t indent="0" pn="section-3.2-4">A server <bcp14>SHOULD</bcp14> strive to generate the same string for a given
        message for each request. However, since previews are understood to be
        an approximation of the message data and not a canonical view of its
        contents, a client <bcp14>MUST NOT</bcp14> assume that a message preview is
        immutable for a given message. This relaxed requirement permits a
        server to offer previews as an option without requiring potentially
        burdensome storage and/or processing requirements to guarantee
        immutability for a use case that does not require this strictness.
        For example, the underlying IMAP server may change due to a system
        software upgrade; an account's state information may be retained in
        the migration, but the new server may generate different preview
        text than the old server.</t>
        <t indent="0" pn="section-3.2-5">It is possible that the server has determined that no meaningful
        preview text can be generated for a particular message. Examples of
        this involve encrypted messages, content types the server does not
        support previews of, and other situations where the server is not
        able to extract information for a preview. In such cases, the
        server <bcp14>MUST</bcp14> return a zero-length string. Clients <bcp14>SHOULD NOT</bcp14> send
        another FETCH for a preview for such messages. (As discussed
        previously, preview data is not immutable, so there is chance that
        at some point in the future the server would be able to generate
        meaningful text. However, this scenario is expected to be rare, so a
        client should not continually send out requests to try to detect
        this infrequent occurrence.)</t>
        <t indent="0" pn="section-3.2-6">If the <xref format="default" target="LAZY" sectionFormat="of" derivedContent="Section 4.1">LAZY modifier</xref> is
        used, the server <bcp14>MAY</bcp14> return NIL for the preview response, indicating
        that preview generation could not be completed without causing
        undue delay. A server <bcp14>MUST NOT</bcp14> return NIL to a FETCH PREVIEW request
        made without the LAZY modifier.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-preview-text-format">Preview Text Format</name>
        <t indent="0" pn="section-3.3-1">The generated preview text <bcp14>MUST</bcp14> be treated as
        <xref target="RFC2046" format="default" sectionFormat="of" derivedContent="RFC2046">text/plain</xref> media type data by the
        client.</t>
        <t indent="0" pn="section-3.3-2">The generated string <bcp14>MUST NOT</bcp14> be content transfer encoded and <bcp14>MUST</bcp14>
        be encoded in <xref target="RFC3629" format="default" sectionFormat="of" derivedContent="RFC3629">UTF-8</xref>. The server <bcp14>SHOULD</bcp14>
        remove any formatting markup and do whatever processing might be
        useful in rendering the preview as plain text.</t>
        <t indent="0" pn="section-3.3-3">For purposes of this section, a "preview character" is defined as a
        single Universal Character Set (UCS) character encoded in UTF-8. Note: a single preview
        character may comprise multiple octets, so any buffers implemented
        to conform to the string limitations identified in this document
        should be sized to prevent possible overflow errors.</t>
        <t indent="0" pn="section-3.3-4">The server <bcp14>SHOULD</bcp14> limit the length of the preview text to 200
        preview characters. This length should provide sufficient data to
        generally support both various languages (and their different average
        word lengths) and diverse client display size requirements.</t>
        <t indent="0" pn="section-3.3-5">The server <bcp14>MUST NOT</bcp14> output preview text longer than 256 preview
        characters.</t>
        <t indent="0" pn="section-3.3-6">If the preview is not generated based on the body content of the
        message, and the <xref target="RFC5255" format="default" sectionFormat="of" derivedContent="RFC5255">LANGUAGE extension</xref> is
        supported by the server, the preview text <bcp14>SHOULD</bcp14> be generated
        according to the language rules that apply to human-readable text.
        For example, a message that consists of a single image MIME part has
        no human-readable text from which to generate preview information.
        Instead, the server may wish to output a description that the message
        contains an image and describe some attributes of the image, such as
        image format, size, and filename. This descriptive text is not a
        product of the message body itself but is rather auto-generated data
        by the server; it should thus use the rules defined for
        human-readable text described in the LANGUAGE extension (if
        supported on the server).</t>
      </section>
    </section>
    <section anchor="Lazy_Modifier" numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-lazy-priority-modifier">LAZY Priority Modifier</name>
      <section anchor="LAZY" numbered="true" toc="include" removeInRFC="false" pn="section-4.1">
        <name slugifiedName="name-lazy">LAZY</name>
        <t indent="0" pn="section-4.1-1">The LAZY modifier directs the server to return the preview
        representation only if that data can be returned without undue
        delay to the client.</t>
        <t indent="0" pn="section-4.1-2">If this modifier is used, and the server is unable to return
        preview data without undue delay, the server <bcp14>MUST</bcp14> return NIL as the
        preview response.</t>
        <t indent="0" pn="section-4.1-3">The LAZY modifier <bcp14>MUST</bcp14> be implemented by any server that supports
        the PREVIEW extension.</t>
      </section>
      <section numbered="true" toc="include" removeInRFC="false" pn="section-4.2">
        <name slugifiedName="name-client-implementation-advic">Client Implementation Advice</name>
        <t indent="0" pn="section-4.2-1">Upon opening a mailbox, a client generally performs a FETCH of
        message details in order to create a listing to present to the user
        (e.g., ENVELOPE data). Using this extension, a client may want to
        additionally display preview information as part of this listing.
        Quickly providing the base mailbox listing with basic message
        details is the primary goal of this command as this is required
        to allow the user to begin interacting with the mailbox. Preview data
        is likely to be of secondary importance; it provides useful context,
        but it is not necessary to perform message actions. A client can
        load unavailable previews in the background and display them
        asynchronously to the user as the preview data is provided by the
        server.</t>
        <t indent="0" pn="section-4.2-2">In this scenario, the client would add the PREVIEW data item, with
        the LAZY modifier, to the list of FETCH items needed to generate the
        mailbox listing. This allows the server to advantageously return
        preview data without blocking the primary goal of quickly returning
        the basic message details used to generate the mailbox listing.</t>
        <t indent="0" pn="section-4.2-3">Once this initial FETCH is complete, the client can then issue
        FETCH requests, without the LAZY modifier, to load the PREVIEW data
        item for the messages in which preview data was not returned. It is
        <bcp14>RECOMMENDED</bcp14> that these FETCH requests be issued in small batches,
        e.g., 50 messages per FETCH command, since preview generation may be
        expensive and a single large request may exceed server resource
        limits.</t>
        <t indent="0" pn="section-4.2-4">See Example 2 in <xref target="Examples" format="default" sectionFormat="of" derivedContent="Section 5"/> for an implementation of this strategy.</t>
        <t indent="0" pn="section-4.2-5">A client <bcp14>SHOULD NOT</bcp14> continually issue FETCH PREVIEW
        requests with the LAZY modifier in a selected mailbox as the server is
        under no requirement to return preview information for this command,
        which could lead to an unnecessary waste of system and network
        resources.</t>
      </section>
    </section>
    <section anchor="Examples" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-examples">Examples</name>
      <t keepWithNext="true" indent="0" pn="section-5-1">Example 1: Requesting preview without LAZY
        modifier.</t>
      <sourcecode name="" type="" markers="false" pn="section-5-2">
  C: A1 CAPABILITY
  S: * CAPABILITY IMAP4rev1 PREVIEW
  S: A1 OK Capability command completed.
  [...a mailbox is SELECTed...]
  C: A2 FETCH 1 (RFC822.SIZE PREVIEW)
  S: * 1 FETCH (RFC822.SIZE 5647 PREVIEW {200}
  S: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  S: Curabitur aliquam turpis et ante dictum, et pulvinar dui congue.
  S: Maecenas hendrerit, lorem non imperdiet pellentesque, nulla
  S: ligula nullam
  S: )
  S: A2 OK FETCH complete.
</sourcecode>
      <t keepWithNext="true" indent="0" pn="section-5-3">Example 2: Requesting preview with LAZY modifier, to
        obtain previews during initial mailbox listing if readily
        available; otherwise, load previews in background.</t>
      <sourcecode name="" type="" markers="false" pn="section-5-4">
  C: B1 FETCH 1:4 (ENVELOPE PREVIEW (LAZY))
  S: * 1 FETCH (ENVELOPE ("Wed, 23 Sep 2020 15:03:11 +0000" [...])
     PREVIEW "Preview text for message 1.")
  S: * 2 FETCH (PREVIEW "" ENVELOPE
     ("Thu, 24 Sep 2020 12:17:23 +0000" [...]))
  S: * 3 FETCH (ENVELOPE ("Fri, 25 Sep 2020 09:13:45 +0000" [...])
     PREVIEW NIL)
  S: * 4 FETCH (ENVELOPE ("Sat, 26 Sep 2020 07:11:18 +0000" [...])
     PREVIEW NIL)
  S: B1 OK FETCH completed.
  [...Client has preview for message 1 and knows that message 2 has
      a preview that is empty; only need to request preview of
      messages 3 &amp; 4 (e.g., in background)...]
  C: B2 FETCH 3:4 (PREVIEW)
  S: * 3 FETCH (PREVIEW {30}
  S: Message data from message 3.
  S: )
  S: * 4 FETCH (PREVIEW "Message 4 preview")
  S: B2 OK Fetch completed.
</sourcecode>
      <t keepWithNext="true" indent="0" pn="section-5-5">Example 3: Requesting preview for
      search results within a single mailbox. Use the <xref target="RFC5182" format="default" sectionFormat="of" derivedContent="RFC5182">SEARCHRES extension</xref> to save a round-trip.</t>
      <sourcecode name="" type="" markers="false" pn="section-5-6">
  C: C1 CAPABILITY
  S: * CAPABILITY IMAP4rev1 PREVIEW SEARCHRES
  S: C1 OK Capability command completed.
  [...a mailbox is SELECTed...]
  C: C2 SEARCH RETURN (SAVE) FROM "FOO"
  C: C3 FETCH $ (UID PREVIEW (LAZY))
  S: C2 OK SEARCH completed.
  S: * 5 FETCH (UID 13 PREVIEW "Preview!")
  S: * 9 FETCH (UID 23 PREVIEW NIL)
  S: C3 OK FETCH completed.
  [...Retrieve message 9 preview in background...]
  C: C4 UID FETCH 23 (PREVIEW)
  S: * 9 FETCH (UID 23 PREVIEW "Another preview!")
  S: C4 OK FETCH completed.
</sourcecode>
    </section>
    <section anchor="Syntax" numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-formal-syntax">Formal Syntax</name>
      <t indent="0" pn="section-6-1">The following syntax specification uses the Augmented Backus-Naur
      Form (ABNF) as described in <xref target="RFC5234" format="default" sectionFormat="of" derivedContent="RFC5234"/>. It
      includes definitions from <xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501">IMAP</xref>.</t>
      <sourcecode type="abnf" name="" markers="false" pn="section-6-2">
  capability        =/ "PREVIEW"

  fetch-att         =/ "PREVIEW" [SP "(" preview-mod *(SP
                       preview-mod) ")"]

  msg-att-dynamic   =/ "PREVIEW" SP nstring

  preview-mod       =  "LAZY"
</sourcecode>
    </section>
    <section anchor="IANA" numbered="true" toc="include" removeInRFC="false" pn="section-7">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t indent="0" pn="section-7-1"><xref target="RFC3501" format="default" sectionFormat="of" derivedContent="RFC3501">IMAP</xref> capabilities are
      registered by publishing a Standards Track or IESG-approved Experimental
      RFC in the "IMAP Capabilities" registry located at <eref target="http://www.iana.org/assignments/imap-capabilities" brackets="angle"/>.
      </t>
      <t indent="0" pn="section-7-2">IANA has added the "PREVIEW" capability to this registry.</t>
    </section>
    <section anchor="Security" numbered="true" toc="include" removeInRFC="false" pn="section-8">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-8-1">Implementation of this extension might enable denial-of-service
      attacks against server resources, due to excessive memory or CPU usage
      during preview generation or increased storage usage if preview results
      are stored on the server after generation. In order to mitigate such
      attacks, servers <bcp14>SHOULD</bcp14> log the client authentication identity on FETCH
      PREVIEW operations in order to facilitate tracking of abusive
      clients.</t>
      <t indent="0" pn="section-8-2">Servers <bcp14>MAY</bcp14> limit the resources that preview generation uses. Such
      resource limitations might, in an extreme example, cause a server to
      return a preview that is the empty string for a message that otherwise
      would have had a non-empty preview. However, it is recommended that at
      least some preview text be provided in this situation, even if the
      quality of the preview is degraded.</t>
      <t indent="0" pn="section-8-3">Just as the messages they summarize, preview data may contain
      sensitive information. If generated preview data is stored on the
      server, e.g., for caching purposes, these previews <bcp14>MUST</bcp14> be protected with
      equivalent authorization and confidentiality controls as the source
      message.</t>
    </section>
  </middle>
  <back>
    <references pn="section-9">
      <name slugifiedName="name-references">References</name>
      <references pn="section-9.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="RFC2046" target="https://www.rfc-editor.org/info/rfc2046" quoteTitle="true" derivedAnchor="RFC2046">
          <front>
            <title>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
            <author initials="N." surname="Freed" fullname="N. Freed">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Borenstein" fullname="N. Borenstein">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1996" month="November"/>
            <abstract>
              <t indent="0">This second document defines the general structure of the MIME media typing system and defines an initial set of media types.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2046"/>
          <seriesInfo name="DOI" value="10.17487/RFC2046"/>
        </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 initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <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 initials="M." surname="Crispin" fullname="M. Crispin">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2003" month="March"/>
            <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="RFC3629" target="https://www.rfc-editor.org/info/rfc3629" quoteTitle="true" derivedAnchor="RFC3629">
          <front>
            <title>UTF-8, a transformation format of ISO 10646</title>
            <author initials="F." surname="Yergeau" fullname="F. Yergeau">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2003" month="November"/>
            <abstract>
              <t indent="0">ISO/IEC 10646-1 defines a large character set called the Universal Character Set (UCS) which encompasses most of the world's writing systems.  The originally proposed encodings of the UCS, however, were not compatible with many current applications and protocols, and this has led to the development of UTF-8, the object of this memo.  UTF-8 has the characteristic of preserving the full US-ASCII range, providing compatibility with file systems, parsers and other software that rely on US-ASCII values but are transparent to other values.  This memo obsoletes and replaces RFC 2279.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="63"/>
          <seriesInfo name="RFC" value="3629"/>
          <seriesInfo name="DOI" value="10.17487/RFC3629"/>
        </reference>
        <reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5234" quoteTitle="true" derivedAnchor="RFC5234">
          <front>
            <title>Augmented BNF for Syntax Specifications: ABNF</title>
            <author initials="D." surname="Crocker" fullname="D. Crocker" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="P." surname="Overell" fullname="P. Overell">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2008" month="January"/>
            <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="RFC5255" target="https://www.rfc-editor.org/info/rfc5255" quoteTitle="true" derivedAnchor="RFC5255">
          <front>
            <title>Internet Message Access Protocol Internationalization</title>
            <author initials="C." surname="Newman" fullname="C. Newman">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Gulbrandsen" fullname="A. Gulbrandsen">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Melnikov" fullname="A. Melnikov">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2008" month="June"/>
            <abstract>
              <t indent="0">Internet Message Access Protocol (IMAP) version 4rev1 has basic support for non-ASCII characters in mailbox names and search substrings.  It also supports non-ASCII message headers and content encoded as specified by Multipurpose Internet Mail Extensions (MIME).  This specification defines a collection of IMAP extensions that improve international support including language negotiation for  international error text, translations for namespace prefixes, and  comparator negotiation for search, sort, and thread.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5255"/>
          <seriesInfo name="DOI" value="10.17487/RFC5255"/>
        </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 initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <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>
      </references>
      <references pn="section-9.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="RFC2045" target="https://www.rfc-editor.org/info/rfc2045" quoteTitle="true" derivedAnchor="RFC2045">
          <front>
            <title>Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</title>
            <author initials="N." surname="Freed" fullname="N. Freed">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Borenstein" fullname="N. Borenstein">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1996" month="November"/>
            <abstract>
              <t indent="0">This initial document specifies the various headers used to describe the structure of MIME messages.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2045"/>
          <seriesInfo name="DOI" value="10.17487/RFC2045"/>
        </reference>
        <reference anchor="RFC2854" target="https://www.rfc-editor.org/info/rfc2854" quoteTitle="true" derivedAnchor="RFC2854">
          <front>
            <title>The 'text/html' Media Type</title>
            <author initials="D." surname="Connolly" fullname="D. Connolly">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="L." surname="Masinter" fullname="L. Masinter">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2000" month="June"/>
            <abstract>
              <t indent="0">This document summarizes the history of HTML development, and defines the "text/html" MIME type by pointing to the relevant W3C recommendations.  This memo provides information for the Internet community.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="2854"/>
          <seriesInfo name="DOI" value="10.17487/RFC2854"/>
        </reference>
        <reference anchor="RFC5182" target="https://www.rfc-editor.org/info/rfc5182" quoteTitle="true" derivedAnchor="RFC5182">
          <front>
            <title>IMAP Extension for Referencing the Last SEARCH Result</title>
            <author initials="A." surname="Melnikov" fullname="A. Melnikov">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2008" month="March"/>
            <abstract>
              <t indent="0">Many IMAP clients use the result of a SEARCH command as the input to perform another operation, for example, fetching the found messages, deleting them, or copying them to another mailbox.</t>
              <t indent="0">This can be achieved using standard IMAP operations described in RFC 3501; however, this would be suboptimal.  The server will send the list of found messages to the client; after that, the client will have to parse the list, reformat it, and send it back to the server.  The client can't pipeline the SEARCH command with the subsequent command, and, as a result, the server might not be able to perform some optimizations.</t>
              <t indent="0">This document proposes an IMAP extension that allows a client to tell a server to use the result of a SEARCH (or Unique Identifier (UID) SEARCH) command as an input to any subsequent command.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5182"/>
          <seriesInfo name="DOI" value="10.17487/RFC5182"/>
        </reference>
      </references>
    </references>
    <section numbered="false" anchor="Acknowledgments" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgments">Acknowledgments</name>
      <t indent="0" pn="section-appendix.a-1">The author would like to thank the following people for their
      comments and contributions to this document: <contact fullname="Stephan       Bosch"/>, <contact fullname="Bron Gondwana"/>, <contact fullname="Teemu       Huovila"/>, <contact fullname="Neil Jenkins"/>, <contact fullname="Steffen Lehmann"/>, <contact fullname="Barry Leiba"/>,
      <contact fullname="Alexey Melnikov"/>, <contact fullname="Chris       Newman"/>, <contact fullname="Pete Resnick"/>, <contact fullname="Jeff       Sipek"/>, <contact fullname="Timo Sirainen"/>, <contact fullname="Steffen Templin"/>, and <contact fullname="Aki Tuomi"/>.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-address">Author's Address</name>
      <author fullname="Michael M. Slusarz" initials="M." surname="Slusarz">
        <organization showOnFrontPage="true">Open-Xchange Inc.</organization>
        <address>
          <postal>
            <street>530 Lytton Avenue</street>
            <city>Palo Alto</city>
            <region>California</region>
            <code>94301</code>
            <country>US</country>
          </postal>
          <phone/>
          <email>michael.slusarz@open-xchange.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
