Swift
Swift
IMAP Session Logging
Demonstrates how to use session logging with IMAP.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let imap = CkoImap()!
// Set the KeepSessionLog property to enable IMAP session logging
imap.keepSessionLog = true
// Connect to an IMAP server.
// Use TLS
imap.ssl = true
imap.port = 993
success = imap.connect(hostname: "imap.example.com")
if success != true {
print("\(imap.lastErrorText!)")
return
}
// Login
success = imap.login(login: "mylogin", password: "mypassword")
if success != true {
print("\(imap.lastErrorText!)")
return
}
// Select an IMAP mailbox
success = imap.selectMailbox(mailbox: "Inbox")
if success != true {
print("\(imap.lastErrorText!)")
return
}
// 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.sessionLog!)")
}