Sample code for 30+ languages & platforms
Xbase++

IMAP Session Logging

Demonstrates how to use session logging with IMAP.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oImap

nSuccess := 0

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

oImap := CreateObject("Chilkat.Imap")

//  Set the KeepSessionLog property to enable IMAP session logging
oImap:KeepSessionLog := 1

//  Connect to an IMAP server.
//  Use TLS
oImap:Ssl := 1
oImap:Port := 993
nSuccess := oImap:Connect("imap.example.com")
IF (nSuccess != 1)
    ? oImap:LastErrorText
    oImap:destroy()
    RETURN
ENDIF

//  Login
nSuccess := oImap:Login("mylogin", "mypassword")
IF (nSuccess != 1)
    ? oImap:LastErrorText
    oImap:destroy()
    RETURN
ENDIF

//  Select an IMAP mailbox
nSuccess := oImap:SelectMailbox("Inbox")
IF (nSuccess != 1)
    ? oImap:LastErrorText
    oImap:destroy()
    RETURN
ENDIF

//  We're not really doing anything in this example
//  other than to show how to examine the IMAP component's session log...

//  Disconnect from the IMAP server.
nSuccess := oImap:Disconnect()

//  Display the session log...
? oImap:SessionLog

oImap:destroy()