I assume you are probably using Gmail.
The easiest way to work with Gmail is to always use All Mail folder and apply labels to emails.
Here's the example to list all labels for all messages in the INBOX:
using (Imap imap = new Imap())
{
imap.ConnectSSL("imap.gmail.com");
imap.UseBestLogin("pat@gmail.com", "password");
imap.SelectInbox();
List<long> uids = imap.GetAll();
List<messageInfo> infos = imap.GetMessageInfoByUID(uids);
foreach (MessageInfo info in infos)
{
List<string> labels = info.GmailLabels.Labels;
Console.WriteLine("[{0}] {1}",
string.Join(" ", labels.ToArray()),
info.Envelope.Subject);
}
imap.Close();
}
Get Gmail labels for specified messages:
https://www.limilabs.com/blog/get-gmail-labels-for-specified-messages
Label message with Gmail label:
https://www.limilabs.com/blog/label-message-with-gmail-label