Sample code for 30+ languages & platforms
VB.NET

Download POP3 Email using UIDLs

Demonstrates how to download POP3 email by first getting the complete set of UIDLs and then downloading email by calling FetchByUIDL for each UIDL.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

' The mailman object is used for receiving (POP3) 
' and sending (SMTP) email.
Dim mailman As New Chilkat.MailMan

' Set the POP3 server's hostname
mailman.MailHost = "pop.example.com"

' Set the POP3 login/password.
mailman.PopUsername = "myLogin"
mailman.PopPassword = "myPassword"

Dim stUidls As New Chilkat.StringTable
success = mailman.FetchUidls(stUidls)
If (success = False) Then
    Debug.WriteLine(mailman.LastErrorText)
    Exit Sub
End If


Dim email As New Chilkat.Email

Dim count As Integer = stUidls.Count
Dim i As Integer = 0
While i < count
    ' Download the full email.
    success = mailman.FetchByUidl(stUidls.StringAt(i),False,0,email)
    If (success = False) Then
        Debug.WriteLine(mailman.LastErrorText)
        Exit Sub
    End If


    Debug.WriteLine(i)
    Debug.WriteLine("From: " & email.From)
    Debug.WriteLine("Subject: " & email.Subject)

    i = i + 1
End While

mailman.Pop3EndSession()