Sample code for 30+ languages & platforms
Visual Basic 6.0

Fetch the UIDLs of All POP3 Messages

See more POP3 Examples

Demonstrates the Chilkat MailMan.FetchUidls method, which retrieves the UIDLs of the messages currently in the POP3 mailbox and stores them in a StringTable, one entry per message, in the server's current mailbox order. This example lists every UIDL.

Background: The UIDL list is the starting point for incremental mail retrieval. A client keeps a record of the UIDLs it has already downloaded; on each check it fetches the current list, computes the difference, and downloads only the new ones (see FetchUidlSet). This is how "leave a copy on the server" works without repeatedly re-downloading the same messages.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

'  Demonstrates the MailMan.FetchUidls method, which retrieves the UIDLs of the messages
'  currently in the POP3 mailbox and stores them in a StringTable, one entry per message, in
'  the server's current mailbox order.

Dim mailman As New ChilkatMailMan

'  Configure the POP3 server connection.
mailman.MailHost = "pop.example.com"
mailman.MailPort = 995
mailman.PopSsl = 1
mailman.PopUsername = "user@example.com"
mailman.PopPassword = "myPassword"

'  Retrieve the UIDLs of all messages in the mailbox.
Dim uidls As New ChilkatStringTable

success = mailman.FetchUidls(uidls)
If (success = 0) Then
    Debug.Print mailman.LastErrorText
    Exit Sub
End If

Dim n As Long
n = uidls.Count
Debug.Print "Mailbox contains " & n & " messages."

Dim i As Long
For i = 0 To n - 1
    Debug.Print "UIDL " & i & ": " & uidls.StringAt(i)
Next

'  Note: Explicitly connecting/authenticating is optional.  Chilkat MailMan automatically
'  connects and authenticates -- using the property settings above -- whenever a server
'  operation requires it.  Calling the explicit connect/authenticate methods can still be
'  helpful to determine whether a failure occurs while connecting or while authenticating.