I can recommend this library:
GitHub - jstedfast/MimeKit: A .NET MIME creation and parser library with support for S/MIME, PGP, DKIM, TNEF and Unix mbox spools.[
^]
It allows you to get new mail like this:
public static void DownloadNewMessages()
{
using (var client = new ImapClient())
{
client.Connect(imapHost, port);
client.Authenticate(userName, passWord);
client.Inbox.Open(FolderAccess.ReadOnly);
var uids = client.Inbox.Search(SearchQuery.New);
foreach (var uid in uids)
{
var message = client.Inbox.GetMessage(uid);
message.WriteTo(string.Format("{0}.eml", uid));
}
client.Disconnect(true);
}
}
For getting mail after a certain time, see the
DeliveredAfter or
SentAfter method:
SearchQuery Class[
^]