This project is read-only.

Set Email As Read and Check Only New Emails

May 1, 2012 at 11:01 AM


I have tried your library and it works great! Can you tell me on how to;

1. Check only new emails (unread emails)

2. I know how to read/download an email, but how to set it to "Read" on the server, so that next time I don't have to download the same email again? (As in question 1 above)


May 2, 2012 at 12:43 AM
Edited May 2, 2012 at 12:46 AM

HigLabo has two way to receive mail from mailbox.
To receive mail by using HigLabo library, you could select HigLabo.Net.Pop3 namespace or HigLabo.Net.Imap namaspace.


POP3 is very old protocol.If you use Pop3Client class, you have no way to make your mail as read.
You must manage read/unread status as yourself.

How to manage read/unread status?
Pop3Client class has ExecuteUidl method that return unique id about mail.
Like this.

1 abd123
2 rnd467
3 nrw490
460 zop429
461 ywk153

First number is the mail index on mailbox, second char "abd123" (format depend on mailserver...) is uid about this mail.
Mail index will change if you delete mail by DeleteEmail method of Pop3Client class.
Uid is never change.
So you manage uid somewhere(HDD or Database...) and check that the mail is read or not.
UidlCommandResult class represent this.
You could check Uid by Uid property of UidlCommandResult class.


IMAP is new protocol after considering missing feature about POP3.
IMAP has feature to manage folder, read/unread and other status, search functionality.
Although the implementation of IMAP protocol is different, I would explain about GMail.
GMail has unread folder and you would check this folder to check unread mail exist or not.

How to check folder by HigLabo.Mail?
ImapClient cl = new ImapClient();
//Set propety about server,username, password
SearchResult l = cl.ExecuteSearch("(UNSEEN)");
foreach(Int64 mailIndex in l.MailIndexList)
    //do something you want...

Is it helpful?

May 18, 2014 at 8:42 AM
but how to mark the Mail as read will you post some code... for this .?
Jun 3, 2014 at 2:42 PM
This post help me to solve this issue... Here is the link :