This example demonstrates how to connect to an IMAP server and subsequently search for mail messages that match multiple search criteria.
Searching for mail messages on the IMAP server
using System;
using S22.Imap;
namespace Test {
class Program {
static void Main(string[] args)
{
using (ImapClient client = new ImapClient("imap.gmail.com", 993, "username", "password", AuthMethod.Login, true))
{
// Find messages that were sent from abc@def.com and have the string "Hello World" in their subject line.
IEnumerable<uint> uids = client.Search(
SearchCondition.From("abc@def.com").And(
SearchCondition.Subject("Hello World"))
);
}
}
}
}