Sometimes developers want to leave a copy of email on POP3 & IMAP4 server for backup, so they don't delete email after it was received. A question raised is how to detect if an email has been retrieved or not. If your server fails to determine this, all the emails on the server will be retrieved again and again. In this case, we should use Unique Identifier (UIDL) to prevent recurrent retrieval.
Using Unique Identifier (UIDL)
Mail server assigns an unique identifier for every email in the same account. You can get as UIDL for every email by MailInfo.UIDL property. To avoid receiving the same email twice, the best way is storing the UIDL of email retrieved to a text file or database. Next time before you retrieve email, compare your local uidl list with remote uidl. If this uidl exists in your local uidl list, don't receive it; otherwise receive it.
Different property of UIDL in POP3 and IMAP4
UIDL is always unique in IMAP4 and it is always an incremental integer. UIDL in POP3 can be any valid asc-ii characters, and an UIDL may be reused by POP3 server if email with this UIDL has been deleted from the server. Hence you are advised to remove the uidl from your local uidl list if that uidl is no longer exist on the POP3 server.
Remarks
You should create different local uidl list for different email account, because the uidl is only unique for the same account.
Example
To get the full samples of EAGetMail, please refer to Samples section. Every sample demonstrates how to use UIDL list.
See Also
Using EAGetMail POP3 & IMAP4 Component
User Authentication and SSL Connection
Digital Signature and E-mail Encryption/Decryption
Parse Bounced Email (delivery-report)
Work with winmail.dat (TNEF Parser)
EAGetMail Namespace References
EAGetMail POP3 & IMAP4 Component Samples