WITHIN Search Extension to the IMAP Protocol
RFC 5032

Document Type RFC - Proposed Standard (September 2007; No errata)
Updates RFC 3501
Last updated 2015-10-14
Stream IETF
Formats plain text pdf html bibtex
Stream WG state (None)
Document shepherd No shepherd assigned
IESG IESG state RFC 5032 (Proposed Standard)
Consensus Boilerplate Unknown
Telechat date
Responsible AD Chris Newman
Send notices to Chris.Newman@sun.com
Network Working Group                                     E. Burger, Ed.
Request for Comments: 5032                             BEA Systems, Inc.
Updates: 3501                                             September 2007
Category: Standards Track

              WITHIN Search Extension to the IMAP Protocol

Status of This Memo

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


   This document describes the WITHIN extension to IMAP SEARCH.  IMAP
   SEARCH returns messages whose internal date is within or outside a
   specified interval.  The mechanism described here, OLDER and YOUNGER,
   differs from BEFORE and SINCE in that the client specifies an
   interval, rather than a date.  WITHIN is useful for persistent
   searches where either the device does not have the capacity to
   perform the search at regular intervals or the network is of limited
   bandwidth and thus there is a desire to reduce network traffic from
   sending repeated requests and redundant responses.

1.  Introduction

   This extension exposes two new search keys, OLDER and YOUNGER, each
   of which takes a non-zero integer argument corresponding to a time
   interval in seconds.  The server calculates the time of interest by
   subtracting the time interval the client presents from the current
   date and time of the server.  The server then either returns messages
   older or younger than the resultant time and date, depending on the
   search key used.

1.1.  Conventions Used in This Document

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

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   document are to be interpreted as described in RFC 2119 [RFC2119].

Burger                      Standards Track                     [Page 1]
RFC 5032                     Search Within                September 2007

   When describing the general syntax, we omit some definitions, as RFC
   3501 [RFC3501] defines them.

2.  Protocol Operation

   An IMAP4 server that supports the capability described here MUST
   return "WITHIN" as one of the server supported capabilities in the
   CAPABILITY command.

   For both the OLDER and YOUNGER search keys, the server calculates a
   target date and time by subtracting the interval, specified in
   seconds, from the current date and time of the server.  The server
   then compares the target time with the INTERNALDATE of the message,
   as specified in IMAP [RFC3501].  For OLDER, messages match if the
   INTERNALDATE is less recent than or equal to the target time.  For
   YOUNGER, messages match if the INTERNALDATE is more recent than or
   equal to the target time.

   Both OLDER and YOUNGER searches always result in exact matching, to
   the resolution of a second.  However, if one is doing a dynamic
   evaluation, for example, in a context [CONTEXT], one needs to be
   aware that the server might perform the evaluation periodically.
   Thus, the server may delay the updates.  Clients MUST be aware that
   dynamic search results may not reflect the current state of the
   mailbox.  If the client needs a search result that reflects the
   current state of the mailbox, we RECOMMEND that the client issue a
   new search.

3.  Formal Syntax

   The following syntax specification uses the Augmented Backus-Naur
   Form (ABNF) notation.  Elements not defined here can be found in the
   formal syntax of ABNF [RFC4234] and IMAP [RFC3501].

   This document extends RFC 3501 [RFC3501] with two new search keys:
   OLDER <interval> and YOUNGER <interval>.

   search-key =/ ( "OLDER" / "YOUNGER" ) SP nz-number
                  ; search-key defined in RFC 3501

4.  Example

   S: a1 * SEARCH 4 8 15 16 23 42

   Search for all unseen messages within the past 3 days, or 259200
   seconds, according to the server's current time.

Burger                      Standards Track                     [Page 2]
RFC 5032                     Search Within                September 2007

5.  Security Considerations

   The WITHIN extension does not raise any security considerations that
   are not present in the base protocol.  Considerations are the same as
   for IMAP [RFC3501].

6.  IANA Considerations

   Per the IMAP RFC [RFC3501], registration of a new IMAP capability in
   the IMAP Capability registry requires the publication of a standards-
   track RFC or an IESG approved experimental RFC.  The registry is
   currently located at
   <http://www.iana.org/assignments/imap4-capabilities>.  This
   standards-track document defines the WITHIN IMAP capability.  IANA
Show full document text