How to retrieve only new emails using POP3 protocol
Asked Answered
P

2

6

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.

Petrozavodsk answered 11/5, 2011 at 6:45 Comment(0)
K
8

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).

Kella answered 11/5, 2011 at 7:33 Comment(3)
if a message deleted on server, that mean old UIDL will be used again, and if used to a new message it will not be retrieved, any handles to solve this?Unanimity
I think UIDL is unique id and it always increments. So there may not be any chance of new email having old UIDL.Rabbitfish
This is ok in the case uidl is number, but if your uidl is string(include alphabet). It will be wrongHabitude
I
0

As long as your mailbox doesn't keep a copy of the emails on the server then you are fine and don't have to code for this.

Normally when an email client access the emails from a POP3 box they are downloaded and removed from the server.

Exchange is a different thing entirely.

Cheers

Inclining answered 11/5, 2011 at 6:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.