This project is read-only.

How to Mark the Mail as Read in IMAP Protocol

May 17, 2014 at 10:00 AM
Edited May 17, 2014 at 10:00 AM
Hi All,

I am just going through the documentation & yeah I have found how to mark email as UNREAD & for that below is the code

cl.ExecuteStore(1, StoreItem.FlagsReplace, "UNSEEN") ===> This is working & setting email as UNREAD

But how to mark email as Read... I am not sure about that I have tried using the below thing but it didn't worked out :(

cl.ExecuteStore(1, StoreItem.FlagsReplace, "READ") ==> This is not working

cl.ExecuteStore(1, StoreItem.FlagsReplace, "SEEN") ==> This is not working

So any 1 please tell me solution for the same. ?
May 18, 2014 at 8:40 AM
I am still waiting for the reply... on this... so any 1 please suggest me..
May 19, 2014 at 1:50 PM
Try it.
this.ExecuteStore(1, StoreItem.FlagsRemove, "\\Seen")
Marked as answer by rickjackson on 6/3/2014 at 6:41 AM
Aug 6, 2014 at 12:52 PM
Edited Aug 6, 2014 at 12:54 PM
Hi higty ..

my question is same as rickjackson
cl.ExecuteStore(1, StoreItem.FlagsRemove, "\\Seen")
not working for me. It is not setting my mail status as read(seen).
cl.ExecuteStore(1, StoreItem.FlagsReplace, "READ") ==> This is not working

cl.ExecuteStore(1, StoreItem.FlagsReplace, "SEEN") ==> This is not working
And what is this in
this.ExecuteStore(1, StoreItem.FlagsRemove, "\\Seen")
Aug 7, 2014 at 12:55 AM

What mail server do you use?
You can get all flags by calling GetMessageFlags method of ImapClient object with latest version.
Could you tell me what flags is set to your message by calling this method?
It may help to solve this problem.

Aug 7, 2014 at 5:16 AM
Edited Aug 7, 2014 at 6:02 AM
I am using gmail service. Here is my total code(some people are telling it will set the email status as read by default but it is not setting for me)
 Using cl As New ImapClient("")
            With cl
                cl.Port = 993
                cl.Ssl = True
                cl.UserName = ""
                cl.Password = "*********"

                If cl.Authenticate() = True Then

                    Dim folder As ImapFolder = cl.SelectFolder("INBOX")
                    Dim list As SearchResult = cl.ExecuteSearch("UNSEEN")

                    For i As Integer = 0 To list.MailIndexList.Count - 1
                        Dim mg As Object = cl.GetMessage(list.MailIndexList(i))
          'cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsRemove, "UNSEEN")
          'cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsReplace, "UNSEEN")

           cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsRemove, "\\Seen")

           'cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsReplace, "READ")
           'cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsReplace, "SEEN")


                End If

            End With
        End Using
I have tried all commented lines to set as read. still it is not setting as read. When I read a mail from my application I want it to be marked as read(seen).
cl.ExecuteStore(list.MailIndexList(i), StoreItem.FlagsReplace, "UNSEEN")
this line is able to mark the seen email as unread(unseen).
Aug 7, 2014 at 8:38 AM

Thank you for your replay.
I'll investigate this problem with your information.

Oct 14, 2014 at 1:05 PM
Edited Oct 14, 2014 at 1:51 PM
Hi higty,

POP3 -> cl.ExecuteQuit();

IMAP -> cl.ExecuteClose();

mark as read for email.
Oct 21, 2014 at 12:21 AM
Hi askatesi.

Thank you for your post.
I'll check it.