Sample code for 30+ languages & platforms
Visual FoxPro

IMAP Session Logging

Demonstrates how to use session logging with IMAP.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loImap

lnSuccess = 0

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

loImap = CreateObject('Chilkat.Imap')

*  Set the KeepSessionLog property to enable IMAP session logging
loImap.KeepSessionLog = 1

*  Connect to an IMAP server.
*  Use TLS
loImap.Ssl = 1
loImap.Port = 993
lnSuccess = loImap.Connect("imap.example.com")
IF (lnSuccess <> 1) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    CANCEL
ENDIF

*  Login
lnSuccess = loImap.Login("mylogin","mypassword")
IF (lnSuccess <> 1) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    CANCEL
ENDIF

*  Select an IMAP mailbox
lnSuccess = loImap.SelectMailbox("Inbox")
IF (lnSuccess <> 1) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    CANCEL
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.
lnSuccess = loImap.Disconnect()

*  Display the session log...
? loImap.SessionLog

RELEASE loImap