How to retrieve only new emails using POP3 protocol

Anu picture Anu · May 11, 2011 · Viewed 8.4k times · Source

I am using POP3 protocol to retrieve my emails in my .NET application. I need to read just new emails only but found in many blogs that it is not possible to retrieve just "unseen" or "new" mails using POP3. Is that true? If so, could you please help me understand how Outlook Express manages to get new mails using POP3?

Is there any way that I can flag the seen mails in the email server itself? Or please help me find out a way to retrieve new mails using POP3 protocol.

Answer

abaumg picture abaumg · May 11, 2011

You have to store the UIDL of each email in a local database. When you want to check for new mail, you retrieve the UIDLs on the server and see if you have if already in your local database; if not, it's a new mail.

Outlook uses the same strategy, BTW (see this KB article).