I've found this:
client.Inbox.AddFlags (new int[] { index }, MessageFlags.Deleted);
or
client.Inbox.AddFlags (new UniqueId[] { uid }, MessageFlags.Deleted);
then
client.Inbox.Expunge ();
I don't know how to obtain index or uid to use here. My client works like this:
using (var client = new ImapClient())
{
client.Connect(serverM.Text, Convert.ToInt32(portM.Text), true);
client.AuthenticationMechanisms.Remove("XOAUTH");
client.Authenticate(user.Text, pass.Text);
var inbox = client.GetFolder(inbox.Text);
inbox.Open(FolderAccess.ReadWrite);
var message = inbox.GetMessage(i);
for (int i = 0; i < inbox.Count; i++) //
{
var message = inbox.GetMessage(i);
...
}
}
Also int I is not the index. message.MessageID not equal to UID. Where is my mistake?