I am using MailKit (https://github.com/jstedfast/MailKit) to connect to google apps via imap, how can I delete a single message though ? (I am fine to have it moved to trash, just need it out of the inbox.
So far I have it connected, downloading, parsing links from message bodies. I just need this one last action to have what I need.
Thanks!
Open the Gmail app . Open the message. (If you want to stay in your inbox, tap the letter or photo next to the message). Tap Delete .
From the reply, press the down arrow on your keyboard and then press Delete.
Once your inbox appears, click Select All option under the top banner if you want to remove all of your messages from Inbox. In case you need to delete only several messages, mark the empty checkbox on the left from the email groups of your choice. Once all the emails are selected, push the Trash button.
To delete a message from a folder on the IMAP server, this is all you need to do:
client.Inbox.AddFlags (new int[] { index }, MessageFlags.Deleted);
or
client.Inbox.AddFlags (new UniqueId[] { uid }, MessageFlags.Deleted);
Now the message is marked as \Deleted on the server.
You can then purge the folder of all deleted items by calling:
client.Inbox.Expunge ();
If you are using UIDs instead of indexes and the IMAP server supports the UIDPLUS extension (check the client.Capabilities), you can expunge just a selected set of messages like this:
if (client.Capabilities.HasFlag (ImapCapabilities.UidPlus))
client.Inbox.Expunge (new UniqueId[] { uid });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With