Please note the server response to a
SEARCH command is only collection of UniqueIds (or SequenceNumbers), but the
imap.Search() method do more than just the
SEARCH command. It depends which
ImapListFields you want to receive.
If you want to receive only
ImapListFields.UniqueId or only
imap.Search() method only parses the response of the
If you want to receive more than
imap.Search() method requests two commands. The
SEARCH command at first and then appropriate
FETCH command according to the
SEARCH response and a value of the
Please compare the log file of the
imap.Search(ImapListFields.UniqueId, ImapSearchParameter.All) and the
imap.Search(ImapListFields.Envelope | ImapListFields.Body, ImapSearchParameter.All) calls.
Therefore the code above doesn't do repetitive actions. It decreases server load.