Can we apply restriction to search only 100 records per session?

Mar 11, 2014 at 1:33 PM
Edited Mar 12, 2014 at 7:26 AM

I have just started to use this API and found it very useful. Great Work!

I was able to get unseen records. However, when number of unread emails is large, response is timed out.

I want to be able to select first 1000 mails and download them only. How can I achieve that?

Note: I am using IMAP.
Mar 17, 2014 at 1:27 AM

You would better download mail data to your Database (or your local hard disk as text file).
Once download data, it is a simple database application.
That you may create before or easy to create because of you can find many sample application about database application.

Mar 26, 2014 at 5:02 AM
Edited Mar 26, 2014 at 5:07 AM

Thanks for your suggestion.
I was able to restrict the download of 100 mails only by restricting the loop to execute only 100 times even if there are more emails.

However, I am facing new problems.

Since I am using IMAP, my initial assumption was that, after downloading an email it will be marked as read on mail server. But it seems it's not true. So, I updated code to mark the message as read with following line:
cl2.ExecuteStore(list.MailIndexList[i], StoreItem.FlagsReplace, "UNSEEN");
It works when I debug the code, however, it don't when I schedule the app to download mails.

Any suggestions?
Mar 31, 2014 at 1:28 AM
Hi PadekarMahesh.

It may depends on the spec of IMAP server whether you must use ExecuteStore or not.
From my assumption, we must use ExecuteStore to update a mail as read.
It works when I debug the code, however, it don't...
It may be a problem about network or something else that is not from HigLabo.Mail.dll.
Because you can do it in debug mode.
You can output all data that sent to network by using SocketClient.TraceSource property.
You can select the output target to Console or Text file.
To use it, see document here.