<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc strict="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std"
     ipr="trust200902"
     docName="draft-murchison-email-snooze-00" obsoletes=""
     submissionType="IETF" consensus="true" xml:lang="en"
     tocInclude="true" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.16.0 -->

  <front>
    <title abbrev="Email Snooze">Snoozing Email with IMAP, JMAP, and
    Sieve</title>
    <seriesInfo name="Internet-Draft" value="draft-murchison-email-snooze-00"/>
    <author initials="K." surname="Murchison" fullname="Kenneth Murchison">
      <organization abbrev="Fastmail">Fastmail US LLC</organization>
      <address>
        <postal>
          <street>1429 Walnut Street - Suite 1201</street>
          <city>Philadelphia</city>
          <region>PA</region>
          <code>19102</code>
          <country>USA</country>
        </postal>
        <email>murch@fastmailteam.com</email>
      </address>
    </author>
    <author initials="R." surname="Signes" fullname="Ricardo Signes">
      <organization abbrev="Fastmail">Fastmail US LLC</organization>
      <address>
        <postal>
          <street>1429 Walnut Street - Suite 1201</street>
          <city>Philadelphia</city>
          <region>PA</region>
          <code>19102</code>
          <country>USA</country>
        </postal>
        <email>rjbs@fastmailteam.com</email>
      </address>
    </author>
    <author initials="N." surname="Jenkins" fullname="Neil Jenkins">
      <organization abbrev="Fastmail">Fastmail Pty Ltd</organization>
      <address>
        <postal>
          <street>Level 2, 114 William Street</street>
          <city>Melbourne</city>
          <region>VIC</region>
          <code>3000</code>
          <country>Australia</country>
        </postal>
        <email>neilj@fastmailteam.com</email>
      </address>
    </author>
    <date/>
    <area>ART</area>
    <workgroup>EXTRA</workgroup>
    <keyword>Sieve</keyword>
    <abstract>
      <t>This document describes the "snooze" extensions to IMAP,
      JMAP for Mail, and the Sieve Email Filtering Language.
      The "snooze" extensions give these protocols the ability to
      postpone the appearance of an email message in a target
      mailbox until a later point in time.</t>
    </abstract>
<!--
    <note title="Open Issues">
      <t>
        <list style="symbols">
        </list>
      </t>
    </note>
-->
  </front>

  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>Users are not always ready, willing, or able to read and
      respond to email messages at the time of their arrival.
      Sometimes it is desirable to have messages appear in a mailbox
      at a more convenient time for the user to act upon them.</t>

      <t>This document defines extensions to the
      <xref target="RFC9051">Internet Message Access Protocol (IMAP)</xref>,
      <xref target="RFC8621">The JSON Meta Application Protocol (JMAP) for Mail</xref>,
      and the <xref target="RFC5228">Sieve Email Filtering Language</xref>
      that enable postponing the appearance of a message in a target
      mailbox until a later point in time, also known as "snoozing" a
      message.</t>

      <t>The IMAP and JMAP extensions allow for snoozing messages that
      are already present in the mailstore.  The Sieve extension
      allows for snoozing a message at the time of final delivery.</t>

      <t>A "snoozed" message is one that the user wants put into a less
      obtrusive location for a fixed time.  When that time is reached,
      the messaged is "awakened" back into higher visibility.</t>

      <section numbered="true" toc="default">
        <name>Conventions Used in This Document</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
        NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
        "MAY", and "OPTIONAL" in this document are to be interpreted as
        described in BCP 14
        <xref target="RFC2119"/> <xref target="RFC8174"/> 
        when, and only when, they appear in all capitals, as shown
        here.</t>
      </section>
    </section> <!-- Intro -->

    <section anchor="snoozing" numbered="true" toc="default">
      <name>Mechanics of Snoozing and Awakening a Message</name>
      <t>The extensions defined in this specification use the
      following procedure for snoozing and awakening messages:</t>

      <ol>
        <li>The message is delivered to, or moved into, a "snoozed" mailbox
        in the mailstore.</li>
        <li>
          <t>The message is assigned three meta-data items:</t>
          <ul>
            <li>An awaken time - the time at which to move the message
            out of the "snoozed" mailbox.</li>
            <li>An optional target mailbox into which
            the message will be moved at the awaken time.</li>
            <li>An optional set of flag/keyword updates to be made
            when the message is awakened.</li>
          </ul>
        </li>
        <li>Messages MUST be accessible while in the "snoozed" mailbox.</li>
        <li>At the awaken time, the message is moved from the "snoozed"
        mailbox into the target mailbox, and any updates are made to
        the message flags/keywords.
        If the target mailbox is not specified, or is not a valid or
        available target for the user, then the message is moved into
        the user's main mailbox.</li>
      </ol>
    </section> <!-- snoozing -->

    <section anchor="imap" numbered="true" toc="default">
      <name>IMAP SNOOZE Extension</name>
      <t>The SNOOZE extension is present in any IMAP implementation
      that returns "SNOOZE" as one of the supported capabilities to
      the CAPABILITY command.
      </t>

      <section numbered="true" toc="default">
        <name>The \Snoozed Mailbox Attribute</name>
        <t>Users may create a mailbox with an attribute of
        <xref target="snoozed-attrib">\Snoozed</xref>, having the sole
        purpose of holding snoozed emails.
        This mailbox is exposed over JMAP as having the "snoozed"
        role.</t>

        <t>Implementations are REQUIRED to enforce the following
        restrictions on the \Snoozed mailbox:</t>
        <ul>
          <li>Messages MUST NOT be added to the \Snoozed mailbox with
          the APPEND, COPY, or MOVE commands.  The server MUST reject
          commands that attempt to use the \Snoozed mailbox as a
          target with a tagged NO response having the CANNOT response
          code.</li>
          <li>When executing COPY or MOVE commands on the \Snoozed
          mailbox, the server MUST NOT copy "snoozed" meta-data to the
          new message.
          The new message is effectively awakened.</li>
        </ul>
      </section>

      <section numbered="true" toc="default">
        <name>SNOOZE Command</name>
        <dl newline="false" spacing="normal" indent="14">
          <dt>Arguments:</dt>
          <dd>
            <t>sequence-set</t>
            <t>date/time string</t>
            <t>OPTIONAL add flag list</t>
            <t>OPTIONAL remove flag list</t>
            <t>OPTIONAL mailbox name</t>
          </dd>
          <dt>Responses:</dt>
          <dd>no specific responses for this command</dd>
          <dt>Result:</dt>
          <dd>
            <t>OK - snooze completed</t>
            <t>NO - snooze error: can't snooze those messages</t>
            <t>BAD - command unknown or arguments invalid</t>
          </dd>
        </dl>
      </section>

      <section numbered="true" toc="default">
        <name>UID SNOOZE Command</name>
        <t>This extends the first form of the UID command
        (see <xref target="RFC9051" section="6.4.9" sectionFormat="comma"/>)
        to add the SNOOZE command defined above as a valid argument.</t>
      </section>

      <section numbered="true" toc="default">
        <name>Semantics of SNOOZE and UID SNOOZE</name>
        <t>The SNOOZE command takes two mandatory arguments: a message
        set (sequence numbers for SNOOZE, UIDs for UID SNOOZE) and a
        date/time string (awaken time); and three optional arguments: a
        named target mailbox, a list of flags to be added to the
        awakened messages, and a list of flags to be removed from the
        awakened messages.
        Each message included in the set is moved (as per
        <xref target="RFC9051" section="6.4.9" sectionFormat="comma"/>)
        from the selected mailbox to the mailbox having the
        \Snoozed attribute.  Additionally, the awaken time, any
        target mailbox name, and any flag lists are stored as "snoozed"
        meta-data on the messages.
        This process appears to the client as a single action
        and has the same effect for each message as this sequence
        (using syntax from
        <xref target="RFC5257" section="4.5" sectionFormat="comma"/>):</t>

        <ol>
          <li>[UID] STORE ANNOTATION (/snoozed (value.shared ...))</li>
          <li>[UID] MOVE</li>
        </ol>

        <t>At the awaken time, each message is moved from the \Snoozed
        mailbox into the target mailbox, and any updates are made to
        the message flags.
        If no target mailbox was specified or it is inaccessible, then
        the message is moved into the user's INBOX.
        and has the same effect for each message as this sequence:</t>

        <ol>
          <li>[UID] STORE +FLAGS.SILENT</li>
          <li>[UID] STORE -FLAGS.SILENT</li>
          <li>[UID] MOVE</li>
        </ol>
      </section>

      <section numbered="true" toc="default">
        <name>Interaction with Other Extensions</name>
        <t>Because of the similarity of SNOOZE to MOVE, extensions
        that affect MOVE affect SNOOZE in the same way.
        Response codes listed in
        <xref target="RFC9051" section="7.1" sectionFormat="comma"/>,
        as well as those defined by extensions, are sent as indicated
        for MOVE.</t>

        <section anchor="annotate" numbered="true" toc="default">
          <name>ANNOTATE</name>
          <t>Servers supporting <xref target="RFC5257">ANNOTATE</xref>
          MAY expose the "snoozed" meta-data on messages as a read-only
          shared <xref target="snoozed-attrib">/snoozed</xref> entry.
          The value of the /snoozed entry MUST be a JSON string in the
          form of a
          <xref target="snoozeDetails">snoozeDetails object</xref>.</t>
        </section>
      </section> <!-- Interaction -->

      <section numbered="true" toc="default">
        <name>Formal Syntax</name>
        <t>The following syntax specification uses the Augmented
        Backus-Naur Form (ABNF) notation as specified in
        <xref target="RFC5234"/>.  <xref target="RFC9051"/> defines
        the non-terminals "capability", "command-select",
        "sequence-set", "mailbox", "date-time", and "flag-list".
        </t>

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

        <artwork name="" type="" align="left" alt=""><![CDATA[
capability     =/ "SNOOZE"

command-select =/ snooze

snooze         = "SNOOZE" SP sequence-set SP date-time
                 [ SP "+FLAGS" SP flag-list ]
                 [ SP "-FLAGS" SP flag-list ]
                 [ SP mailbox ]

uid            = "UID" SP
                 (copy / move / fetch / search / store /
                  uid-expunge / snooze)
]]></artwork>
      </section> <!-- Syntax -->

    </section> <!-- IMAP -->

    <section anchor="jmap" numbered="true" toc="default">
      <name>JMAP Mail Snooze Extension</name>
      <t>The capabilities object is returned as part of the JMAP Session
      object; see <xref target="RFC8620" section="2" sectionFormat="comma"/>.
      Servers supporting this specification MUST add a property
      named "urn:ietf:params:jmap:mail:snooze" to the capabilities
      object. The value of this property is an empty object in both
      the JMAP session "capabilities" property and an account's
      "accountCapabilities" property. 
      </t>

      <section numbered="true" toc="default">
        <name>The "snoozed" Mailbox Role</name>
        <t>Users may create a mailbox with a role of "snoozed", having
        the sole purpose of holding snoozed emails.
        This mailbox is exposed over IMAP as having the
        <xref target="snoozed-attrib">\Snoozed</xref> attribute.</t>
      </section>

      <section anchor="snoozeDetails" numbered="true" toc="default">
        <name>Extension to the Email Object</name>
        <t>The
        <xref target="RFC8621" section="4.1"
              sectionFormat="comma">Email</xref>
        object gains a new property:</t>

        <ul spacing="normal">
          <li>
            <t><strong>snoozed</strong>:
            <tt>SnoozeDetails|null</tt>
            (immutable)
            </t>
            <t>
               If in the mailbox with role snoozed, this Email will be
               moved from there according to the details in this
               object.
               Otherwise, this is a record of when it was snoozed in
               the past.
            </t>
            <t/>
          </li>
        </ul>

        <t>A <strong>SnoozeDetails</strong> object has the
        following properties:</t>

        <ul spacing="normal">
          <li>
            <t><strong>until</strong>:
            <tt>UTCDate</tt>
            </t>
            <t>
              The time at which to move the message out of the
              "snoozed" mailbox.
            </t>
            <t/>
          </li>
          <li>
            <t><strong>moveToMailboxId</strong>:
            <tt>String</tt>
            (optional)
            </t>
            <t>
              If set and a valid mailbox id for the user, this is
              where the Email will be moved at the awaken
              time. Otherwise, the Email will be moved to the user's
              inbox.
            </t>
            <t/>
          </li>
          <li>
            <t><strong>setKeywords</strong>:
            <tt>String[Boolean]</tt>
            (optional)
            </t>
            <t>
              If set, when the message is awakened it will also have
              keywords modified. The keys of the object are the
              keyword names.
              Names that map to <tt>true</tt> are keywords to be
              added.
              Names that map to <tt>false</tt> are keywords to remove.
            </t>
          </li>
        </ul>

        <t>The <strong>snoozed</strong> property has the
        following rules and restrictions:</t>

        <ul>
          <li>It is treated as an immutable property,
          i.e. it cannot be updated on an existing copy in a mailbox,
          it must cause a new copy (with a new UID).</li>

          <li>If an Email is in more than one mailbox (i.e. the same
          GUID is in multiple mailboxes), <strong>snoozed</strong>
          MUST only be set on one of the copies.</li>

          <li>
            <t>When setting <strong>snoozed</strong> to a non-null value in
            an Email/set method:</t>

            <ul>
              <li>If the email is already in the Snoozed mailbox and not
              being removed from this mailbox, replace the copy in the
              Snoozed mailbox and set the SnoozeDetails on the new email.</li>

              <li>Otherwise, if adding the Email to a single new mailbox,
              set the SnoozeDetails on this copy.</li>

              <li>
                <t>Otherwise, if adding the Email to multiple mailboxes,
                set the SnoozeDetails on the copy in:</t>

                <ul>
                  <li>The Snoozed mailbox if this is being added.</li>
                  <li>Otherwise, the mailbox with the id in the
                  moveToMailboxId property of the SnoozeDetails object
                  (or inbox if this property is omitted), if this is being
                  added.</li>
                </ul>

                <t>If neither apply, reject the create/update with an
                invalidProperties error.</t>
              </li>

              <li>If not adding the Email to a new mailbox, replace the
              copy that currently has SnoozeDetails.
              If none, reject the update with an invalidProperties
              error.</li>
            
              <li>Clear any existing SnoozeDetails from Emails in any
              other mailbox (this will involve replacing the copy with a
              new UID of course, as it's immutable).</li>
            </ul>
          </li>

          <li>When removing the mailbox with which <strong>snoozed</strong>
          is associated from an Email, the snooze is implicitly
          cleared (i.e. it is not implicitly copied to another copy of
          the message; it must be explicitly set if the client wants
          to preserve it).</li>
        </ul>
      </section>
    </section> <!-- JMAP -->

    <section anchor="sieve-snooze" numbered="true" toc="default">
      <name>Sieve Snooze Extension</name>
      <t>Sieve implementations that support this extension have
      an identifier of "snooze" for use with the capability mechanism.</t>

      <t>Conventions for notations are as in
      <xref target="RFC5228" section="1.1"/>,
      including use of the "Usage:" label for the
      definition of action and tagged arguments syntax.</t>

      <section anchor="snooze-action" numbered="true" toc="default">
        <name>Snooze Action</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
Usage: snooze *AWAKEN-OPTIONS <times: string-list>
]]></artwork>
        <t keepWithNext="true">The AWAKEN-OPTIONS argument is defined here
        in <xref target="RFC5234" format="default">ABNF</xref> syntax
        so that it can be modified by other extensions.</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
AWAKEN-OPTIONS = MAILBOX / WEEKDAYS / TZID
                  ; each option MUST NOT appear more than once
                  ; however, per Section 2.6.2 of RFC 5228,
                  ; the tagged arguments in AWAKEN-OPTIONS
                  ; may appear in any order

MAILBOX  = ":mailbox" string
WEEKDAYS = ":weekdays" string-list
TZID     = ":tzid" string
]]></artwork>
        <t>The "snooze" action cancels the implicit keep and postpones
        delivery of the message into the specified mailbox at a later
        point in time.</t>
        <t>The snooze action is semantically equivalent to a delayed
        fileinto action (see <xref target="RFC5228" section="4.1"/>).
        The arguments of the snooze action specify when, where, and
        how the awakened message will be filed.</t>

        <t>Implementations MUST snooze and awaken messages per
        <xref target="snoozing"/>.  Specifically, a Sieve interpreter
        whose mailstore is accessible via IMAP and/or JMAP MUST utilize
        a "snoozed" mailbox per Sections <xref target="imap"/> and
        <xref target="jmap"/> respectively.</t>

        <section anchor="mailboxarg" numbered="true" toc="default">
          <name>Mailbox Argument</name>
          <t>The optional :mailbox argument is used to specify the target
          mailbox that the message will be filed into when it is awakened.
          It is equivalent to the mailbox argument of the fileinto
          action (see <xref target="RFC5228" section="4.1"/>).</t>
          <t>If :mailbox is omitted, or if the specified mailbox doesn't
          exist at the time of awakening, the message will be filed
          into the user's main mailbox.
          For instance, in an implementation where an IMAP server is
          running scripts on behalf of the user at time of delivery,
          the user's "INBOX" would be the implicit target for
          awakening messages.</t>
        </section>

        <section anchor="times" numbered="true" toc="default">
          <name>Times, TZID, and Weekdays Arguments</name>
          <t>The required times argument, along with the optional :tzid
          and :weekdays arguments, are used to specify when a snoozed
          message will be awakened.
          Each time is specified in "hh:mm:ss" format and is interpreted
          as the local time in the time zone specified by the :tzid
          argument.</t>

          <t>The value of the :tzid argument MUST be a time zone
          identifier from the
          <xref target="tzdb">IANA Time Zone Database</xref>.
          If :tzid is omitted, the time zone of the Sieve
          interpreter is used.
          </t>

          <t>The :weekdays argument specifies the set of days
          on which the specified set of times apply.
          Each day of the week is expressed as an integer between
          "0" and "6". "0" is Sunday, "1" is Monday, etc.
          This syntax matches that of the "weekday" date-part argument
          to the date test extension (see
          <xref target="RFC5260" section="4.2"/>).
          If :weekdays is omitted, the set of times applies
          to every day of the week.</t>

          <t>The combination of the weekdays and times form a
          chronological list of awaken times.  When a message is
          snoozed, it is assigned the next future awaken time in the
          list.  If a message is snoozed on a day with no awaken times,
          or after the last awaken time on a given day,
          the first awaken time on the next available day is used.
          </t>

          <t>If the local time in the specified time zone occurs more
          than once (daylight saving to standard time transition), the
          first occurrence of the specified time value is used.
          If the local time in the specified time zone does not occur
          (standard to daylight saving time transition), the specified
          time value is interpreted using the UTC offset prior to the
          transition.</t>

          <section numbered="true" toc="default">
            <name>Awaken Times Examples</name>
            <t>The following examples show, given the specified snooze
            action and a set of message arrival times, the corresponding
            times at which the message would be awakened and filed.</t>
            <t keepWithNext="true">The following example shows awaken
            times rolling into the next day or week.
            Note that 2020-07-30 falls on a Thursday.</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
require "snooze";
snooze :weekdays ["1", "3", "5", "2", "4"]
       :tzid "Australia/Melbourne" ["12:00:00",
                                    "08:00:00", "16:00:00"];
]]></artwork>
            <table align="center">
              <thead>
                <tr>
                  <th align="center">Arrival (UTC)</th>
                  <th align="center">Arrival (Melbourne)</th>
                  <th align="center">Awaken (Melbourne)</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td align="center">2020-07-30T00:00:00Z</td>
                  <td align="center">--07-30T10:00:00+10</td>
                  <td align="center">--07-30T12:00:00+10</td>
                </tr>
                <tr>
                  <td align="center">2020-07-30T04:00:00Z</td>
                  <td align="center">--07-30T14:00:00+10</td>
                  <td align="center">--07-30T16:00:00+10</td>
                </tr>
                <tr>
                  <td align="center">2020-07-30T08:00:00Z</td>
                  <td align="center">--07-30T18:00:00+10</td>
                  <td align="center">--07-31T08:00:00+10</td>
                </tr>
                <tr>
                  <td align="center">2020-07-31T12:00:00Z</td>
                  <td align="center">--07-31T22:00:00+10</td>
                  <td align="center">--08-03T08:00:00+10</td>
                </tr>
                <tr>
                  <td align="center">2020-08-01T16:00:00Z</td>
                  <td align="center">--08-02T02:00:00+10</td>
                  <td align="center">--08-03T08:00:00+10</td>
                </tr>
              </tbody>
            </table>
            <t keepWithNext="true">The following example shows awaken
            times falling before, during, and after a daylight saving
            to standard time transition.
            Note that the transition occurs at 2020-11-01T02:00:00-04.
            </t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
require "snooze";
snooze :tzid "America/New_York" "01:30:00";
]]></artwork>
            <table align="center">
              <thead>
                <tr>
                  <th align="center">Arrival (UTC)</th>
                  <th align="center">Arrival (New York)</th>
                  <th align="center">Awaken (New York)</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td align="center">2020-11-01T05:00:00Z</td>
                  <td align="center">--11-01T01:00:00-04</td>
                  <td align="center">--11-01T01:30:00-04</td>
                </tr>
                <tr>
                  <td align="center">2020-11-01T06:00:00Z</td>
                  <td align="center">--11-01T01:00:00-05</td>
                  <td align="center">--11-02T01:30:00-05</td>
                </tr>
                <tr>
                  <td align="center">2020-11-01T07:00:00Z</td>
                  <td align="center">--11-01T02:00:00-05</td>
                  <td align="center">--11-02T01:30:00-05</td>
                </tr>
              </tbody>
            </table>
            <t keepWithNext="true">The following example shows awaken
            times falling before, during, and after a standard to
            daylight saving time transition.
            Note that the transition occurs at 2021-03-14T02:00:00-05.
            </t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
require "snooze";
snooze :tzid "America/New_York" "02:30:00";
]]></artwork>
            <table align="center">
              <thead>
                <tr>
                  <th align="center">Arrival (UTC)</th>
                  <th align="center">Arrival (New York)</th>
                  <th align="center">Awaken (New York)</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td align="center">2021-03-13T06:30:00Z</td>
                  <td align="center">--03-13T01:30:00-05</td>
                  <td align="center">--03-13T02:30:00-05</td>
                </tr>
                <tr>
                  <td align="center">2021-03-14T06:30:00Z</td>
                  <td align="center">--03-14T01:30:00-05</td>
                  <td align="center">--03-14T03:30:00-04</td>
                </tr>
                <tr>
                  <td align="center">2021-03-14T07:30:00Z</td>
                  <td align="center">--03-14T03:30:00-04</td>
                  <td align="center">--03-15T02:30:00-04</td>
                </tr>
              </tbody>
            </table>
          </section>
        </section>

        <section anchor="extensions" numbered="true" toc="default">
          <name>Interaction with Extensions to the Fileinto Action</name>
          <t>Some tagged arguments defined in extensions to the fileinto
          action can be used together with the snooze action.
          The sections below describe these interactions.
          Tagged arguments in future extensions to the fileinto action
          need to describe their interaction with the snooze extension,
          if any.</t>

          <t>When any fileinto extension arguments are used with the
          snooze extension, the corresponding extension MUST be enabled,
          and the arguments are defined to have the same syntax,
          semantics, and treatment as they do with the fileinto action.</t>

          <section anchor="imap4flags" numbered="true" toc="default">
            <name>Imap4flags Extension</name>
            <t>When the <xref target="RFC5232">"imap4flags"</xref>
            extension is enabled in a script, two additional tagged
            arguments are added to "snooze" that allow manipulating the
            set of flags on a snoozed message.</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
AWAKEN-OPTIONS /= ADDFLAGS / REMOVEFLAGS

ADDFLAGS    = ":addflags" string-list
REMOVEFLAGS = ":removeflags" string-list
]]></artwork>
            <t>The optional :addflags and :removeflags arguments are used
            to specify which <xref target="RFC9051">IMAP</xref> flags
            should be added to and/or removed from the set of IMAP flags
            present on the snoozed message at the time of awakening.
            Note the set of IMAP flags present at the time of awakening may
            be the empty set.</t>

            <t>If the "setflag" and/or "addflag" actions have been used to
            store IMAP flags in the imap4flags internal variable,
            the Sieve interpreter MUST use the current value of the
            internal variable as the set of flags to associate with the
            message when storing it into the "snoozed" mailbox.</t>

            <t>This document doesn't dictate how the Sieve interpreter
            will set the IMAP flags.
            In particular, the Sieve interpreter may work as an IMAP
            client or may have direct access to the mailstore.</t>

            <t>The general requirements for flag handling specified in
            <xref target="RFC5232" section="2"/> MUST be followed.</t>
            <section numbered="true" toc="default">
              <name>Example</name>
              <t>The following example leverages the
              <xref target="RFC5260">Date</xref>,
              <xref target="RFC5231">Relational</xref>, and
              <xref target="RFC5232">Imap4flags</xref> extensions
              to snooze messages received after business hours until the
              following work day.  Note that the message is marked as
              important when it is snoozed, and will be marked as unread
              when it is awakened.</t>
              <artwork name="" type="" align="left" alt=""><![CDATA[
require ["snooze", "imap4flags", "date", "relational"];

if anyof(header :is "from" "boss@example.com",
         currentdate :is "weekday" "0",
         currentdate :is "weekday" "6",
         currentdate :value "ge" "hour" "17") {
    setflag "\\Important";
    snooze :removeflags "\\Seen"
           :weekdays ["1". "2", "3", "4", "5"]
           :tzid "American/New_York", "09:00";
}
]]></artwork>
            </section>
          </section>

          <section anchor="mailboxext" numbered="true" toc="default">
            <name>Mailbox Extension</name>
            <t>This document extends the definition of the
            <xref target="RFC5490">":create"</xref> tagged argument so
            that it can be used with the snooze action.</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
AWAKEN-OPTIONS /= CREATE

CREATE = ":create"
           ; MUST NOT be appear unless MAILBOX also appears
]]></artwork>
            <t>If the optional ":create" argument is specified with
            snooze, it instructs the Sieve interpreter to create the
            target mailbox, if needed, before attempting to file the
            awakened message into the target mailbox.</t>
          </section>

          <section anchor="specialuse" numbered="true" toc="default">
            <name>Special-Use Extension</name>
            <t>This document extends the definition of the
            <xref target="RFC8579">":specialuse"</xref> tagged argument
            so that it can be used with the snooze action.</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
AWAKEN-OPTIONS /= SPECIAL-USE

SPECIAL-USE = ":specialuse" string
]]></artwork>
            <t>If the optional ":specialuse" argument is specified with
            snooze, it instructs the Sieve interpreter to check whether
            a mailbox exists with the specific special-use flag assigned
            to it.  If such a mailbox exists, the awakened message is filed
            into the special-use mailbox.  Otherwise, the awakened message
            is filed into the target mailbox.</t>
            <t>If both the optional ":specialuse" and ":create"
            arguments are specified with snooze, the Sieve interpreter
            is instructed to create the target mailbox per
            <xref target="RFC8579" section="4.1"/>, if needed.</t>
          </section>

          <section anchor="mailboxid" numbered="true" toc="default">
            <name>MailboxID Extension</name>
            <t>This document extends the definition of the
            <xref target="RFC9042">":mailboxid"</xref>
            tagged argument so that it can be used with the snooze action.</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
AWAKEN-OPTIONS /= MAILBOXID

MAILBOXID = ":mailboxid" string
]]></artwork>
            <t>If the optional ":mailboxid" argument is specified with
            snooze, it instructs the Sieve interpreter to check whether
            a mailbox exists in the user's
            <xref target="RFC2342">personal namespace </xref> with the
            specified <xref target="RFC8474">MAILBOXID</xref>.
            If such a mailbox exists, the awakened message is filed
            into that mailbox.  Otherwise, the awakened message
            is filed into the target mailbox.</t>
            <t>It is an error to specify both ":mailboxid" and
            ":specialuse" in the same snooze action.</t>
          </section>
        </section> <!-- extensions -->

      </section> <!-- snooze-action -->
    </section> <!-- sieve-snooze -->

    <section anchor="impl" numbered="true" toc="default">
      <name>Implementation Status</name>
      <t>&lt; RFC Editor: before publication please remove this section
	and the reference to <xref target="RFC7942"/> &gt;</t>
      <t>This section records the status of known implementations of
	the protocol defined by this specification at the time of
	posting of this Internet-Draft, and is based on a proposal
	described in <xref target="RFC7942"/>.  The
	description of implementations in this section is intended to
	assist the IETF in its decision processes in progressing
	drafts to RFCs.  Please note that the listing of any
	individual implementation here does not imply endorsement by
	the IETF.  Furthermore, no effort has been spent to verify the
	information presented here that was supplied by IETF
	contributors.  This is not intended as, and must not be
	construed to be, a catalog of available implementations or
	their features.  Readers are advised to note that other
	implementations may exist.</t>
      <t>According to <xref target="RFC7942"/>,
	"this will allow reviewers and working groups to assign due
	consideration to documents that have the benefit of running
	code, which may serve as evidence of valuable
	experimentation and feedback that have made the implemented
	protocols more mature.  It is up to the individual working
	groups to use this information as they see fit".</t>

      <section anchor="cyrus" toc="exclude" numbered="true">
        <name>Cyrus Server</name>
        <t>The open source
        <eref target="http://www.cyrusimap.org/">Cyrus Server</eref> project
        is a highly scalable enterprise mail system which supports
        IMAP, JMAP, and
	Sieve email filtering at the point of final delivery.  This
        production level implementation supports all of the
        requirements described in this document.  This implementation
        is freely distributable under a BSD style license from
	<eref target="http://www.cmu.edu/computing/">
          Computing Services at Carnegie Mellon University</eref>.</t>
      </section>
    </section> <!-- Implementations -->
 
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>Security considerations are discussed in
      <xref target="RFC5228"/>, <xref target="RFC5232"/>,
      <xref target="RFC8579"/>, and <xref target="RFC9042"/>.
      </t>
      <t>It is believed that this extension doesn't introduce any
      additional security concerns.</t>
    </section>
    <section anchor="privacy" numbered="true" toc="default">
      <name>Privacy Considerations</name>
      <t>It is believed that this extension doesn't introduce any
      privacy considerations beyond those in <xref target="RFC5228"/>.</t>
    </section>

    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section numbered="true" toc="default">
        <name>Registration of JMAP Capability</name>
        <t>This document defines the following new JMAP capability
        to be added to the registry defined in
        <xref target="RFC8620" section="9.4"/> and located here:
        <eref target="https://www.iana.org/assignments/jmap/jmap.xhtml#jmap-capabilities"/>
        </t>
        <t>IANA are requested to add a capability to the JMAP Capabilities
        registry:
        </t>
        <ul empty="true" spacing="normal">
          <li>Capability Name: <tt>urn:ietf:params:jmap:mail:snooze</tt></li>
          <li>Specification document: RFC XXXX</li>
          <li>Intended use: common</li>
          <li>Change Controller: IETF</li>
          <li>Security and privacy considerations: RFC XXXX,
          <xref target="security" format="default"/></li>
        </ul>
      </section>

      <section numbered="true" toc="default">
        <name>Registration of IMAP Capability</name>
        <t>IANA are requested to add "SNOOZE" to the IMAP Capabilities
        registry,
        <eref target="https://www.iana.org/assignments/imap4-capabilities"/>
        </t>
      </section>

      <section numbered="true" toc="default">
        <name>Registration of Sieve Extension</name>
        <t>This document defines the following new Sieve extension
        to be added to the registry defined in
        <xref target="RFC5228" section="6.2"/> and located here:
        <eref target="https://www.iana.org/assignments/sieve-extensions/sieve-extensions.xhtml#sieve-extensions"/>
        </t>
        <t>IANA are requested to add a capability to the Sieve
        Extensions registry:
        </t>
        <ul empty="true" spacing="normal">
          <li>To: iana@iana.org</li>
          <li>Subject: Registration of new Sieve extension</li>
          <li>Capability name: snooze</li>
          <li>Description: Adds the "snooze" action command to
            postpone delivery of a message into a target mailbox until
            a later point in time.</li>
          <li>RFC number: RFC XXXX</li>
          <li>Contact address: The Sieve discussion list
            &lt;sieve@ietf.org&gt;</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>Registration of Sieve Action</name>
        <t>This document defines the following new Sieve action
        to be added to the registry defined in
        <xref target="I-D.ietf-extra-sieve-action-registry" section="3.1"/>.
        </t>
        <t>IANA are requested to add an action to the Sieve Action
        registry:
        </t>
        <ul empty="true" spacing="normal">
          <li>Name: snooze</li>
          <li>Description: Postpone delivery of a message into a
            target mailbox until a later point in time.</li>
          <li>References: RFC XXXX, <xref target="RFC5232"/>,
            <xref target="RFC5490"/>, <xref target="RFC8579"/>,
            <xref target="RFC9042"/></li>
          <li>Capabilities: "snooze", "imap4flags", "mailbox",
            "special-use", "mailboxid".</li>
          <li>Interactions: Is not compatible with the reject or
            ereject actions.</li>
          <li>Cancels Implicit Keep?: Y</li>
          <li>Use with IMAP Events?: Y</li>
          <li>Comments: Requires a special "snoozed" mailbox in the
            mailstore.</li>
        </ul>
      </section>
      <section anchor="snoozed-attrib" numbered="true" toc="default">
        <name>Registration of IMAP Mailbox Name Attribute</name>
        <t>This document defines the following new IMAP mailbox name
        attribute to be added to the registry defined in
        <xref target="RFC8457" section="6.2"/> and located here:
        <eref target="https://www.iana.org/assignments/imap-mailbox-name-attributes/imap-mailbox-name-attributes.xhtml#imap-mailbox-name-attributes"/>
        </t>
        <t>IANA are requested to add an attribute to the IMAP Mailbox
        Name Attribute registry:
        </t>
        <ul empty="true" spacing="normal">
          <li>To: iana@iana.org</li>
          <li>Subject: Registration of new IMAP Mailbox Name Attribute</li>
          <li>Attribute name: Snoozed</li>
          <li>Description: Messages that have been snoozed.</li>
          <li>Reference: RFC XXXX</li>
        </ul>
      </section>
      <section anchor="snoozed-annot" numbered="true" toc="default">
        <name>Registration of IMAP Annotation Entry</name>
        <t>This document defines the following new IMAP annotation
        entry to be added to the registry defined in
        <xref target="RFC5257" section="6"/> and located here:
        <eref target="https://www.iana.org/assignments/imap-annotate-extension/imap-annotate-extension.xhtml#imap-annotate-extension-entries"/>
        </t>
        <ul empty="true" spacing="normal">
          <li>To: iana@iana.org</li>
          <li>Subject: IMAP Annotate Registration</li>
          <li>Please register the following Annotate item:</li>
          <li>[X]Entry
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          [] Attribute</li>
          <li>Name: /snoozed</li>
          <li>Description: RFC XXXX, <xref target="annotate"/>.</li>
          <li>Content-Type: application/json</li>
          <li>Contact person: Ken Murchison</li>
          <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          email: murch@fastmailteam.com</li>
        </ul>
      </section>
    </section>
    <!-- IANA -->

    <section numbered="true" toc="default">
      <name>Acknowledgments</name>
      <t>The authors would like to thank the following individuals for
      contributing their ideas and support for writing this
      specification: Ned Freed, Barry Leiba, Alexey Melnikov, and Pete
      Resnick.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2342.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9051.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5228.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5232.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5490.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8474.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8579.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8457.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9042.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8620.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8621.xml"/>

        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-ietf-extra-sieve-action-registry.xml"/>

        <reference anchor="tzdb" target="https://www.iana.org/time-zones">
          <front>
            <title>Time Zone Database</title>
            <author>
              <organization>Internet Assigned Numbers Authority</organization>
            </author>
            <date/>
          </front>
        </reference>
      </references>

      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5260.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5231.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7942.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5257.xml"/>

      </references>
    </references>
<!--
    <section numbered="true" toc="default">
      <name>Change History (To be removed by RFC Editor before publication)</name>
      <t>Changes since draft-ietf-extra-sieve-snooze-00:
      </t>
      <ul spacing="normal">
        <li>Miscellaneous editorial changes.</li>
      </ul>
    </section>
-->
  </back>
</rfc>
