This project is read-only.

Problems with Examine and setting Seen

Topics: Help requests, Issues
Jul 14, 2014 at 4:02 PM

I want to synchronously get newly arrived email and mark the emails that I've gotten as seen. Here is my code:
            var messages = folder.Search("UNSEEN", Enums.MessageFetchMode.Minimal);
            foreach (var mess in messages)
                mess.Seen = true;
The only time it works as desired is when the unseen message is already in the inbox when the program starts. If an email arrives while the client is already logged in, the message is correctly returned but it is never marked as seen and is therefore returned with every subsequent call to get new messages. If on the other hand I remove the line folder.Examine();, the newly arrived email is never returned in messages (its count is 0).

What am I doing wrong?

Thanks for creating this very useful library!
Jul 15, 2014 at 7:26 AM
Hi Arbil,

the Folder.Examine method and the Folder.Search method do not depend on each other in any way. Removing the call to Examine should not change anything about the search later.

In order to figure out what the problem exactly is, there are two things to do:
  • Tell me which server you are connecting to (GMail, Yahoo,, own Exchange server, any other?)
  • Create a log file (if possible), as described in the documentation and send it to

Jul 15, 2014 at 8:14 AM
Hi Pavel,

Thanks for the willingness to help. The server is Gmail. I've done two logs, one with Examine call and one without and sent them to you.

Jul 15, 2014 at 8:48 AM
Edited Jul 15, 2014 at 9:15 AM
Hi Arbil,

thank you! As a temporary fix, you can replace folder.Examine() with folder.Select(). I will make an update soon.

UPDATE: The issue is fixed now, you can download the latest code from the repository.