0 votes

hello. how to search for a letter by sender? for example, in the line to search enter mail delas@mail.com and the program finds 1 last message from a person with a given email address? I apologize for such stupid questions. thank you

by (1.4k points)
C#, IMAP
sorry

1 Answer

0 votes
 
Best answer

Mail.dll IMAP client supports expression syntax to build simple and complex email search queries:

List<long> uids = imap.Search().Where(
    Expression.From("delas@mail.com"));

using Expression.And (unseen email from specific email):

List<long> uids = imap.Search().Where(
    Expression.And(
        Expression.From("delas@mail.com"),
        Expression.HasFlag(Flag.Unseen)));

Last element in uids list is the newest email.

Here's a more detail explanation on how to search for emails in .NET using IMAP:
https://www.limilabs.com/blog/how-to-search-imap-in-net

by (300k points)
selected by
...