WITHIN Search Extension to the IMAP Protocol
updates
- rfc-3501 — INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
Extracted elements (10)
WITHIN (OLDER/YOUNGER) differs from BEFORE/SINCE in that the client specifies a relative interval in seconds rather than an absolute date. This is useful for persistent searches on devices with limited capacity or on bandwidth-constrained networks, reducing repeated requests and redundant responses.
Both OLDER and YOUNGER searches use the server's current date and time as the reference point, and compare against INTERNALDATE as defined in RFC 3501. The resolution of matching is exact to the second.
An IMAP4 server that supports the WITHIN capability MUST return "WITHIN" as one of the server supported capabilities in the CAPABILITY command response.
Clients MUST be aware that dynamic search results (e.g., in a context evaluation) may not reflect the current state of the mailbox, as the server might perform evaluations periodically and delay updates.
If the client needs a search result that reflects the current state of the mailbox, it is RECOMMENDED that the client issue a new search rather than relying on dynamic evaluation results.
The OLDER search key takes a non-zero integer argument (interval in seconds). Messages match if their INTERNALDATE is less recent than or equal to the target time, which is computed by subtracting the interval from the server's current date and time.
The YOUNGER search key takes a non-zero integer argument (interval in seconds). Messages match if their INTERNALDATE is more recent than or equal to the target time, which is computed by subtracting the interval from the server's current date and time.
IANA has added the WITHIN capability to the IMAP4 Capabilities registry (located at http://www.iana.org/assignments/imap4-capabilities). Registration requires a standards-track RFC or IESG-approved experimental RFC per RFC 3501.
The WITHIN extension does not raise any security considerations beyond those present in the base IMAP protocol (RFC 3501). All security considerations from IMAP apply.
The ABNF syntax extends RFC 3501's search-key rule: `search-key =/ ( "OLDER" / "YOUNGER" ) SP nz-number`, where nz-number is a non-zero positive integer representing the time interval in seconds.