Xbase++ Requires Chilkat v11.0.0+
Xbase++
Download POP3 Email to MIME
Download the email from a POP3 mailbox directly into MIME, without parsing into email objects.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oMailman
LOCAL oStUidls
LOCAL oBdMime
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"
// First, get the complete set of UIDLs for the email in the POP3 mailbox:
oStUidls := CreateObject("Chilkat.StringTable")
nSuccess := oMailman:FetchUidls(oStUidls)
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
oStUidls:destroy()
RETURN
ENDIF
// Download each email as MIME.
// If desired, the MIME can be loaded into an email object.
oBdMime := CreateObject("Chilkat.BinData")
oEmail := CreateObject("Chilkat.Email")
nCount := oStUidls:Count
i := 0
DO WHILE i < nCount
nSuccess := oMailman:FetchMimeBd(oStUidls:StringAt(i), oBdMime)
IF (nSuccess == 0)
? oMailman:LastErrorText
oMailman:destroy()
oStUidls:destroy()
oBdMime:destroy()
oEmail:destroy()
RETURN
ENDIF
oEmail:SetFromMimeBd(oBdMime)
? "From: " + oEmail:From
? "Subject: " + oEmail:Subject
i := i + 1
ENDDO
oMailman:destroy()
oStUidls:destroy()
oBdMime:destroy()
oEmail:destroy()