Xbase++ Requires Chilkat v11.0.0+
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oMailman
LOCAL oStUidls
LOCAL oEmail
LOCAL nCount
LOCAL i
nSuccess := 0
// 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.
oMailman := CreateObject("Chilkat.MailMan")
// Set the POP3 server's hostname
oMailman:MailHost := "pop.example.com"
// Set the POP3 login/password.
oMailman:PopUsername := "myLogin"
oMailman:PopPassword := "myPassword"
oStUidls := CreateObject("Chilkat.StringTable")
nSuccess := oMailman:FetchUidls(oStUidls)
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
oStUidls:destroy()
RETURN
ENDIF
oEmail := CreateObject("Chilkat.Email")
nCount := oStUidls:Count
i := 0
DO WHILE i < nCount
// Download the full email.
nSuccess := oMailman:FetchByUidl(oStUidls:StringAt(i), 0, 0, oEmail)
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
oStUidls:destroy()
oEmail:destroy()
RETURN
ENDIF
? Str(i)
? "From: " + oEmail:From
? "Subject: " + oEmail:Subject
i := i + 1
ENDDO
oMailman:Pop3EndSession()
oMailman:destroy()
oStUidls:destroy()
oEmail:destroy()