Reputation: 164
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.
Upvotes: 0
Views: 721
Reputation: 501
First you need to check messages info return time. How fast server returns all info without parsing. Then you can see how much time you spend ...
Off topic note: Subject,From consist strings, as per IMAP any string can be represented as string literal. So you need to be prepared to receive them. This means command can expand to multiple lines, you need to read more lines to get complete data ... RFC 3501 string literal will describe it.
Upvotes: 1