Sample code for 30+ languages & platforms
Lianja

POP3 Fetch Mime Source of Email by UIDL

Demonstrates how to fetch the MIME source of a single email by UIDL.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

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

loMailman = createobject("CkMailMan")

loMailman.MailHost = "pop.example.com"

loMailman.PopUsername = "myLogin"
loMailman.PopPassword = "myPassword"

loMailman.MailPort = 995
loMailman.PopSsl = .T.

loStUidls = createobject("CkStringTable")
llSuccess = loMailman.FetchUidls(loStUidls)
if (llSuccess = .F.) then
    ? loMailman.LastErrorText
    release loMailman
    release loStUidls
    return
endif

// Download each email as MIME.
loBdMime = createobject("CkBinData")

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
        return
    endif

    // Do whatever is needed with the MIME contained in bdMime.

    i = i + 1
enddo


release loMailman
release loStUidls
release loBdMime