Sample code for 30+ languages & platforms
Lianja

Read Gmail POP3 Mailbox

Reads the header for each email in a GMail POP3 mailbox and displays the FROM and SUBJECT header fields. In your GMail "Forwarding and POP" settings, be sure to select "When messages are accessed with POP keep Gmail's copy in the Inbox".

Chilkat Lianja Downloads

Lianja
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 GMail account POP3 properties.
loMailman.MailHost = "pop.gmail.com"
loMailman.PopUsername = "myLogin"
loMailman.PopPassword = "myPassword"
loMailman.PopSsl = .T.
loMailman.MailPort = 995

// Read mail headers and one line of the body.
// To get the full emails, set headersOnly = .F.
loBundle = createobject("CkEmailBundle")
llKeepOnServer = .T.
llHeadersOnly = .T.
lnNumBodyLines = 1
llSuccess = loMailman.FetchAll(llKeepOnServer,llHeadersOnly,lnNumBodyLines,loBundle)
if (llSuccess = .F.) then
    ? loMailman.LastErrorText
    release loMailman
    release loBundle
    return
endif

i = 0
loEmail = createobject("CkEmail")
do while i < loBundle.MessageCount
    loBundle.EmailAt(i,loEmail)

    // Display the From email address and the subject.
    ? "From: " + loEmail.From
    ? "Subject: " + loEmail.Subject

    i = i + 1
enddo


release loMailman
release loBundle
release loEmail