Search Fails To See Messages Received Since Previous Search

Topics: Help requests
Aug 25, 2014 at 3:22 PM
Thanks for a great library! I've been able to use it to easily do most of what I've needed.

I am finding that Folder.Search results only contain messages that were present when the search is first run after login. If I run the search again the returned messages will not contain messages that have been received since login. To rerun a search I need to logout, disconnect, connect and login between each search call.

Is there a way to run search multiple times, with each getting latest folder contents, without reconnecting and re-logging in each time? (basically poll instead of using idle events)

Thanks again!

Sep 1, 2014 at 10:03 AM
Hi Brian,

using the search you should be able to always fetch the latest messages, the behavior you describe is unusual. Can you tell me which server you are using? I will test it and let you know the results.

Best regards,

Sep 2, 2014 at 3:17 PM
Thanks Pavel!

I am using GMail (

In case it matters I am watching the inbox for messages to a specific address with a specific subject. The IMAP query I am using looks like: 'TO "myaccount+testid@mydomain" SUBJECT "Exact subject expected"'.
Sep 29, 2014 at 9:19 PM
Edited Sep 30, 2014 at 1:00 PM
First of all sorry for my bad english :)
I got this problem too... i get correct messages at the first download("UNSEEN") but after that (when i make messages SEEN or get new messages) it returns the same emails i got at the first download()

I'm guessing Client.Folders.Inbox.Messages are not refreshing?

and I'm also using Gmail.


EDIT: I got mine working with search() method... Thanks for the great library :)
Oct 3, 2014 at 8:33 PM
Hi SaeedOmnia,

the Folder.Messages contains all the messages that have been downloaded, which means - it will also include messages from previous search requests. If you want to perform a fresh search, and get only the messages that apply the supplied search criteria - use the Folder.Search method.

Best regards,

Oct 3, 2014 at 8:46 PM
Thanks Pavel for your answer but Folder.Search() is acting exactly like the first post (not getting new messages after the first search)... probably i'm doing something wrong but i managed to solve it by using Folder.Examine() before the search. I don't quite get why it is working but no problem so far :)
Oct 4, 2014 at 1:10 PM

I have added a call to Folder.Examine before the search is executed, using the latest code from the repository you no longer need to do it manually.

Thank you for the suggestion!