An IMAP server advertises support for the PARTIAL extension by including the "PARTIAL" capability in the CAPABILITY response / response code.
The PARTIAL SEARCH return option causes the server to provide in an ESEARCH response [
RFC 4731] [
RFC 9051] a subset of the results denoted by the sequence range given as the mandatory argument. The first result (message with the lowest matching Unique Identifier (UID)) is 1; thus, the first 500 results would be obtained by a return option of "PARTIAL 1:500" and the second 500 by "PARTIAL 501:1000". This intentionally mirrors message sequence numbers.
It is also possible to direct the server to start the SEARCH from the latest matching (with the highest UID) message. This can be done by prepending "-" to the index. For example, -1 is the last message, -2 is next to the last, and so on. Using this syntax helps server implementations to optimize their SEARCHes.
A single command
MUST NOT contain more than one PARTIAL or ALL search return option; that is, either one PARTIAL, one ALL, or neither PARTIAL nor ALL is allowed.
For SEARCH results, the entire list of results
MUST be ordered in mailbox order -- that is, in UID or message sequence number order.
In cases where a PARTIAL SEARCH return option references results that do not exist by using a range that starts or ends higher (or lower) than the current number of results, the server returns the results that are in the set. This yields a PARTIAL return data item that has, as payload, the original range and a potentially missing set of results that may be shorter than the extent of the range. If the whole range references results that do not exist, a special value "NIL" is returned by the server instead of the sequence set.
Clients need not request PARTIAL results in any particular order. Because mailboxes may change, clients might wish to use PARTIAL in combination with UPDATE (see [
RFC 5267]) if the server also advertises the "CONTEXT=SEARCH" capability, especially if the intent is to walk a large set of results; however, these return options do not interact -- the UPDATE will provide notifications for all matching results.
// Let's assume that the A01 SEARCH without PARTIAL would return
// 23764 results.
C: A01 UID SEARCH RETURN (PARTIAL -1:-100) UNDELETED
UNKEYWORD $Junk
S: * ESEARCH (TAG "A01") UID PARTIAL (-1:-100 ...)
// 100 most recent results in set syntax elided.
S: A01 OK Completed.
// Let's assume that the A02 SEARCH without PARTIAL would return
// 23764 results.
C: A02 UID SEARCH RETURN (PARTIAL 23500:24000) UNDELETED
UNKEYWORD $Junk
C: A03 UID SEARCH RETURN (PARTIAL 1:500) UNDELETED
UNKEYWORD $Junk
C: A04 UID SEARCH RETURN (PARTIAL 24000:24500) UNDELETED
UNKEYWORD $Junk
S: * ESEARCH (TAG "A02") UID PARTIAL (23500:24000 ...)
// 264 results in set syntax elided;
// this spans the end of the results.
S: A02 OK Completed.
S: * ESEARCH (TAG "A03") UID PARTIAL (1:500 ...)
// 500 results in set syntax elided.
S: A03 OK Completed.
S: * ESEARCH (TAG "A04") UID PARTIAL (24000:24500 NIL)
// No results are present; this is beyond the end of the results.
S: A04 OK Completed.
This section only applies if the server advertises the "PARTIAL" IMAP capability or "CONTEXT=SEARCH" [
RFC 5267], together with "ESEARCH" [
RFC 4731] and/or IMAP4rev2 [
RFC 9051].
The SAVE result option doesn't change whether the server would return items corresponding to PARTIAL SEARCH result options.
As specified in
Section 3.1, it is an error to specify both the PARTIAL and ALL result options in the same SEARCH command.
When the SAVE result option is combined with the PARTIAL result option and none of the MIN/MAX/COUNT result options are present, the corresponding PARTIAL is returned, and the "$" marker would contain references to all messages returned by the PARTIAL result option.
When the SAVE and PARTIAL result options are combined with the MIN or MAX result option and the COUNT result option is absent, the corresponding PARTIAL result and MIN/MAX are returned (if the SEARCH result is not empty), and the "$" marker would contain references to all messages returned by the PARTIAL result option together with the corresponding MIN/MAX message.
If the SAVE and PARTIAL result options are combined with both the MIN and MAX result options and the COUNT result option is absent, the PARTIAL, MIN, and MAX result options are returned (if the SEARCH result is not empty), and the "$" marker would contain references to all messages returned by the PARTIAL result option together with the MIN and MAX messages.
If the SAVE and PARTIAL result options are combined with the COUNT result option, the PARTIAL and COUNT result options are returned, and the "$" marker would always contain references to all messages found by the SEARCH or UID SEARCH command.
Table 1 summarizes additional requirements for ESEARCH server implementations described in this section.
Note regarding
Table 1: "[m]" means optional "MIN" and/or "MAX".
Combination of Result Options |
"$" Marker Value |
SAVE PARTIAL |
PARTIAL |
SAVE PARTIAL MIN |
PARTIAL & MIN |
SAVE PARTIAL MAX |
PARTIAL & MAX |
SAVE PARTIAL MIN MAX |
PARTIAL & MIN & MAX |
SAVE PARTIAL COUNT [m] |
all found messages |
Table 1
The PARTIAL extension also extends the UID FETCH command with a PARTIAL FETCH modifier. The PARTIAL FETCH modifier has the same syntax as the PARTIAL SEARCH result option. The presence of the PARTIAL FETCH modifier instructs the server to only return FETCH results for messages in the specified range. It is useful when the sequence-set (first) parameter in the UID FETCH command includes an unknown number of messages.
// Returning information for the last 3 messages in the UID range
C: 10 UID FETCH 25900:26600 (UID FLAGS) (PARTIAL -1:-3)
S: * 12888 FETCH (FLAGS (\Seen) UID 25996)
S: * 12889 FETCH (FLAGS (\Flagged \Answered) UID 25997)
S: * 12890 FETCH (FLAGS () UID 26600)
S: 10 OK FETCH completed
// Returning information for the first 5 messages in the UID range
C: 11 UID FETCH 25900:26600 (UID FLAGS) (PARTIAL 1:5)
S: * 12591 FETCH (FLAGS (\Seen) UID 25900)
S: * 12592 FETCH (FLAGS (\Flagged) UID 25902)
S: * 12593 FETCH (FLAGS (\Answered) UID 26310)
S: * 12594 FETCH (FLAGS () UID 26311)
S: * 12595 FETCH (FLAGS (\Answered) UID 26498)
S: 11 OK FETCH completed
This section is informative.
The PARTIAL FETCH modifier can be combined with the CHANGEDSINCE FETCH modifier [
RFC 7162].
// Returning information for the last 30 messages in the UID range
// that have any flags/keywords modified since MODSEQ 98305
C: 101 UID FETCH 25900:26600 (UID FLAGS
) (PARTIAL -1:-30 CHANGEDSINCE 98305)
S: * 12888 FETCH (FLAGS (\Flagged \Answered
) MODSEQ (98306) UID 25997)
S: * 12890 FETCH (FLAGS () MODSEQ (98312) UID 26600)
S: 101 OK FETCH completed
The above example causes the server to first select the last 30 messages and then only return flag changes for a subset of those messages that have MODSEQ higher than 98305.
Note that the order of PARTIAL and CHANGEDSINCE FETCH modifiers in the UID FETCH command is not important, i.e., the above example can also use the "UID FETCH 25900:26600 (UID FLAGS) (CHANGEDSINCE 98305 PARTIAL -1:-30)" command and it would result in the same responses.