The code you provided leads to System.InvalidOperationException: Not connected to the server.
The problem is that the list.Select(m => ...) is deferred execution, which means the lambda in Select() call is evaluated when the first used (lazy evaluation). Please read more at
https://www.davidhaney.io/linq-and-deferred-execution/
To fix the problem, evaluate the expression before disconnecting the client, e.g. list.Select(m => ...).ToList()
I have also one suggestion:
Searching with ImapListFields.FullHeaders is really not necessary, since you immediately download the whole message.
Final solution can look like this. Change:
var list = imap.Search(ImapListFields.FullHeaders, ImapSearchParameter.Unread);
var result = list.Select(m => imap.GetMailMessage(m.SequenceNumber));
to:
var list = imap.Search(ImapListFields.UniqueId, ImapSearchParameter.Unread);
var result = list.Select(m => imap.GetMailMessage(m.UniqueId)).ToList();