Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Retrieve UIDL's from POP3 Server

Retrieve a list of UIDLs from a POP3 server. UIDLs are unique identifiers, 1 to 70 characters long, composed of characters ranging from 0x21 to 0x7E. These identifiers uniquely distinguish messages within a mailbox and remain consistent across sessions.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oMailman
LOCAL oStUidls
LOCAL oEmail
LOCAL nCount
LOCAL i
LOCAL cUidl

nSuccess := 0

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

oMailman := CreateObject("Chilkat.MailMan")

oMailman:MailHost := "pop.example.com"

oMailman:PopUsername := "myLogin"
oMailman:PopPassword := "myPassword"

oMailman:MailPort := 995
oMailman:PopSsl := 1

oStUidls := CreateObject("Chilkat.StringTable")
nSuccess := oMailman:FetchUidls(oStUidls)
IF (nSuccess == 0)
    ? oMailman:LastErrorText
    oMailman:destroy()
    oStUidls:destroy()
    RETURN
ENDIF

//  Download each email by UIDL.
oEmail := CreateObject("Chilkat.Email")

nCount := oStUidls:Count
i := 0
DO WHILE i < nCount
    //  Download the full email.
    cUidl := oStUidls:StringAt(i)
    nSuccess := oMailman:FetchByUidl(cUidl, 0, 0, oEmail)
    IF (nSuccess == 0)
        ? oMailman:LastErrorText
        oMailman:destroy()
        oStUidls:destroy()
        oEmail:destroy()
        RETURN
    ENDIF

    ? Str(i)
    ? "UIDL: " + cUidl
    ? "From: " + oEmail:From
    ? "Subject: " + oEmail:Subject

    i := i + 1
ENDDO

oMailman:Pop3EndSession()

oMailman:destroy()
oStUidls:destroy()
oEmail:destroy()