Reputation: 85
Instead of getting the number 1 - because there is only one sender that has sent a single email to my inbox with the specified email, instead I get the number 19.
using(ImapClient client = new ImapClient())
{
client.Connect("imap.gmail.com", 993, SecureSocketOptions.SslOnConnect);
client.Authenticate("[email protected]", "pass");
var inbox = client.Inbox;
inbox.Open(FolderAccess.ReadOnly);
var count = inbox.Search(SearchQuery.CcContains("[email protected]"));
Console.WriteLine(count);
}
Upvotes: 0
Views: 1238
Reputation: 1322
As @Fildor mentioned in a comment Search() returns the list of unique ids. Therefore try
var count = inbox.Search(SearchQuery.CcContains("[email protected]")).Count;
Upvotes: 1