Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loMailman
LOCAL loStUidls
LOCAL loEmail
LOCAL lnCount
LOCAL i
lnSuccess = 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.
loMailman = CreateObject('Chilkat.MailMan')
* Set the POP3 server's hostname
loMailman.MailHost = "pop.example.com"
* Set the POP3 login/password.
loMailman.PopUsername = "myLogin"
loMailman.PopPassword = "myPassword"
loStUidls = CreateObject('Chilkat.StringTable')
lnSuccess = loMailman.FetchUidls(loStUidls)
IF (lnSuccess = 0) THEN
? loMailman.LastErrorText
RELEASE loMailman
RELEASE loStUidls
CANCEL
ENDIF
loEmail = CreateObject('Chilkat.Email')
lnCount = loStUidls.Count
i = 0
DO WHILE i < lnCount
* Download the full email.
lnSuccess = loMailman.FetchByUidl(loStUidls.StringAt(i),0,0,loEmail)
IF (lnSuccess = 0) THEN
? loMailman.LastErrorText
RELEASE loMailman
RELEASE loStUidls
RELEASE loEmail
CANCEL
ENDIF
? STR(i)
? "From: " + loEmail.From
? "Subject: " + loEmail.Subject
i = i + 1
ENDDO
loMailman.Pop3EndSession()
RELEASE loMailman
RELEASE loStUidls
RELEASE loEmail