c# - MailKit Imap get read and unread status of a mail -


i using mailkit read messages gmail account. works great. but, want message status whether read, unread, important, starred etc. possible mailkit? can´t seem find it.

here code:

 var inbox = client.inbox;  var message = inbox.getmessage(4442);//4442 index of message.   console.writeline("message importance : {0}", message.importance);  console.writeline("message priority : {0}", message.priority); 

importance , priority returns "normal". how find message marked important or not? , how read or unread status of message?.

there no message property because mimemessage parsed raw mime message stream , imap not store states on message stream, stores them separately.

to info want, you'll need use fetch() method:

var info = client.inbox.fetch (new [] { 4442 }, messagesummaryitems.flags | messagesummaryitems.gmaillabels); if (info[0].flags.value.hasflag (messageflags.flagged)) {     // message starred } if (info[0].flags.value.hasflag (messageflags.draft)) {     // draft } if (info[0].gmaillabels.contains ("important")) {     // message important } 

hope helps.


Comments

Popular posts from this blog

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

python - Terminate a gnome-terminal opened with subprocess -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -