C: SEARCH MARKED NOT TO "nobody@example.com"
      S: * SEARCH 1 3-5 7
      S: +OK Messages searched
      C: SEARCH 1-5,15-20 LARGER 10000
      S: * SEARCH 1 3-5 17
      S: +OK Messages searched
The SEARCH command instructs
    the server to search messages in the currently open folder. The
    next whitespace delimited word specifies the set of messages to
    search. The remaining words specify the search criteria. The
    set of messages to search is specified in one of four ways:
Search only the messages that have the MARKED flag already set.
Search only the messages that do not have the
          MARKED flag set.
Search all messages.
rangerange is a
          comma-separated range of message numbers to search.
          Consecutive message numbers may be given as A-B, indicating messages A
          through B, inclusive.
Each SEARCH command specifies a
    single search criteria. Simple criterias are combined to form
    more complicated searches by using a series of SEARCH and STORE
    commands. First, all messages have their MARKED flag cleared. The list of messages
    found by the first SEARCH MARKED
    command is fed into the STORE
    command, setting their marked flags. Then additional searches
    are performed, using SEARCH MARKED
    or SEARCH UNMARKED, with or
    without the NOT keyword, forming a
    complex query.
The NOT keyword optional
    follows, and indicates that the following search criteria
    specification should be logically inverted. For example, if the
    search is for messages with the subject line containing
    “foo”, the search will not be for
    messages whose subject line does not contain “foo”.
The available search criteria are:
Search for messages that have the REPLIED flag set.
Search for messages that have the DELETED flag set.
Search for messages that have the DRAFT flag set.
Search for messages that have the SEEN flag set.
stringSearch for messages that have string in their
          “From:” header.
stringSearch for messages that have string in their
          “To:” header.
stringSearch for messages that have string in their
          “Cc:” header.
stringSearch for messages that have string in their
          “Bcc:” header.
stringSearch for messages that have string in their
          “Subject:”
          header.
header stringSearch for messages that have string in their
          “header”
          (without the colon) header.
stringSearch for messages that have string in their
          content.
stringSearch for messages that have string in their content
          or headers.
mm-ddd-yyyySearch for messages whose INTERNALDATE is earlier than mm-ddd-yyyy.
mm-ddd-yyyySearch for messages whose INTERNALDATE is mm-ddd-yyyy.
mm-ddd-yyyySearch for messages whose INTERNALDATE is on or after mm-ddd-yyyy.
mm-ddd-yyyySearch for messages whose Date: header is prior to mm-ddd-yyyy.
mm-ddd-yyyySearch for messages whose Date: header reads mm-ddd-yyyy.
mm-ddd-yyyySearch for messages whose Date: header reads on or after
          mm-ddd-yyyy.
nSearch for messages whose estimated size is more than
          n bytes.
nSearch for messages whose estimated size is less than
          n bytes.
All text strings above use the UTF-8 character set. For header or content searches, the search string must be converted to the header's (MIME-encoded) or content's character set. Searching should be case insensitive.
Date-based searches specify months by their short English names.
The server's * SEARCH reply
    enumerates messages found by the search. For extremely large
    folders, the server may send multiple *
    SEARCH replies in order to keep line lengths under the
    maximum. No * SEARCH replies are
    sent when no messages are found by the search criteria.