Unique Identifier (UIDL) in POP3 and IMAP4 protocol


Sometimes the developers want to leave a copy of email on the POP3 & IMAP4 server for backup, so they don't delete the email after the email was received. The common issue is how to detect if the email has been retrieved by the application already, otherwise, all the emails on the server will be retrieved again and again. In this case, we should use the Unique Identifier (UIDL) to avoid to receive the same email more than once.

Using Unique Identifier (UIDL)

The mail server assigns an unique identifier for every email in the same account. You can get the UIDL for every email by MailInfo.UIDL property. To avoid to receive 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 the email, compare your local uidl list with remote uidl. If this uidl exists in your local uidl list, then you don't receive it, otherwise you should receive it.

Difference with UIDL in POP3 and IMAP4

UIDL is always unique in IMAP4 and it is always increasing integer. UIDL in POP3 can be any valid asc-ii characters, and the UIDL may be reused by POP3 server if the email with the UIDL has been deleted from the server, so we suggest that you should remove the uidl from your local uidl list if the uidl is no longer existed 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 ActiveX Object
User Authentication and SSL Connection
Digital Signature and E-mail Encryption/Decryption
Parse Bounced Email (delivery-report)
Work with winmail.dat (TNEF Parser)
EAGetMail ActiveX Object References
EAGetMail POP3 & IMAP4 Component Samples