Sample code for 30+ languages & platforms
Lua

IMAP Session Logging

Demonstrates how to use session logging with IMAP.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local imap = chilkat.Imap.new()

-- Set the KeepSessionLog property to enable IMAP session logging
imap.keep_session_log = true

-- Connect to an IMAP server.
-- Use TLS
imap.ssl = true
imap.port = 993
local success = imap:connect("imap.example.com")
if not success then
    print(imap.last_error_text)
    return
end

-- Login
success = imap:login("mylogin", "mypassword")
if not success then
    print(imap.last_error_text)
    return
end

-- Select an IMAP mailbox
success = imap:select_mailbox("Inbox")
if not success then
    print(imap.last_error_text)
    return
end

-- 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.
success = imap:disconnect()

-- Display the session log...
print(imap.session_log)