Lianja
Lianja
Download POP3 Email to MIME
Download the email from a POP3 mailbox directly into MIME, without parsing into email objects.Chilkat Lianja Downloads
llSuccess = .F.
// 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("CkMailMan")
// Set the POP3 server's hostname
loMailman.MailHost = "pop.example.com"
// Set the POP3 login/password.
loMailman.PopUsername = "myLogin"
loMailman.PopPassword = "myPassword"
// First, get the complete set of UIDLs for the email in the POP3 mailbox:
loStUidls = createobject("CkStringTable")
llSuccess = loMailman.FetchUidls(loStUidls)
if (llSuccess = .F.) then
? loMailman.LastErrorText
release loMailman
release loStUidls
return
endif
// Download each email as MIME.
// If desired, the MIME can be loaded into an email object.
loBdMime = createobject("CkBinData")
loEmail = createobject("CkEmail")
lnCount = loStUidls.Count
i = 0
do while i < lnCount
llSuccess = loMailman.FetchMimeBd(loStUidls.StringAt(i),loBdMime)
if (llSuccess = .F.) then
? loMailman.LastErrorText
release loMailman
release loStUidls
release loBdMime
release loEmail
return
endif
loEmail.SetFromMimeBd(loBdMime)
? "From: " + loEmail.From
? "Subject: " + loEmail.Subject
i = i + 1
enddo
release loMailman
release loStUidls
release loBdMime
release loEmail