How can I get the unread/new messages from Gmail using POP3?
Posted
by Ashley Simpson
on Stack Overflow
See other posts from Stack Overflow
or by Ashley Simpson
Published on 2010-01-16T13:50:20Z
Indexed on
2010/03/22
10:01 UTC
Read the original article
Hit count: 391
Using the OpenPOP .net client for getting messages from Gmail.
I'm wondering how I can get only the new messages?
Currently, I get the atom feed and then get as many emails as the feed has with the OpenPOP client (starting from the first).
GmailAtomFeed feed = new GmailAtomFeed("user", "pass");
feed.GetFeed();
int unread = feed.FeedEntries.Count;
POPClient client = new POPClient("pop.gmail.com", 995, "user", "pass", AuthenticationMethod.USERPASS, true);
for (int i = 0; i < unread; i++)
{
Message m = client.GetMessage(i, false);
// ...
}
Is there a better way to do this?
And how do I set the unread messages to be read?
© Stack Overflow or respective owner