List only New messages (not read)

0 votes
asked Feb 22, 2010 by Juan Carlos Pazos (120 points)
edited Feb 22, 2010


I'm evaluating the product, it is excellent.

I ask before to search only for messages with some text in the header, and works perfect. But I want only to do this for not read messages, usually are new. I found a New flag but I can not figure it how to handle this.

I'm using VB.NET and this is for IMAP (using a Gmail account)

Kindest regards

Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered Feb 22, 2010 by Lukas Pokorny (124,570 points)
edited Feb 22, 2010

ImapSearchParameter.New might not be what you need - it searches for messages with the "Recent" flag - these are messages that recently arrived and your IMAP session is the first and only session notified about this. Try searching for messages without the "Seen" flag using this search parameter:


In combination with a header search, that would be something like this:

Dim result As New ImapMessageCollection
result = client.Search( _
  ImapSearchParameter.HasFlagsNoneOf(ImapMessageFlags.Seen), _
  ImapSearchParameter.Header(headerName, queryTerm))