I use MailKit to read some messages from a GMail Account. Works great, but when my application has read a message, I want to mark the message as read, and save that state to GMail. Is this possible with MailKit? I have not found anything about it yet.
The way to mark messages as read using the IMAP protocol is to set the \Seen
flag on the message(s).
To do this using MailKit, you will first need to know either the index(es) or the UID(s) of the messages
that you would like to set the \Seen
flag on. Once you have that information, you will want to call
one of the AddFlags()
methods on the ImapFolder
. For example:
folder.AddFlags (uids, MessageFlags.Seen, true);
To mark messages as unread, you would remove the \Seen
flag, like so:
folder.RemoveFlags (uids, MessageFlags.Seen, true);
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