I am working on an imap email client.
I have a search function, which is works perfectly.
It returns a custom EmailHeaderInfo List.
This EmailheaderInfo Class contains the next properties: UID, Subject, From(System.Net.Mail.MailAdress, its contain displayname too), Date(Receive),Size, Flag(to check read/unread status) and Attachment(To check email has attchment or not). I store everything in this class with the correct charset.
In this search function I use Imap SEARCH command to get uids, and with this uids I use the following FETCH command:
UID FETCH " + uids[i] + " (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (Received From Subject Content-Type)])
After each Fetch I get size and flag with regexp, and other information with parse header.
At the moment to list 250 emails takes 8 sec.
I really curious for other people opinion or suggestion about how to make it faster.
Update:
I run Fetch command with a messagetset(I made a messageset from the SEARCH command result).
Now to list ~450 mails takes 1-2 sec. Finally it's really fast.