0 votes
by (120 points)
edited

Hi

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
by (147k points)
edited

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:

ImapSearchParameter.HasFlagsNoneOf(ImapMessageFlags.Seen)

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))
...