Sample code for 30+ languages & platforms
PowerBuilder

Clear the IMAP Session Log

See more IMAP Examples

Demonstrates the Chilkat Imap.ClearSessionLog method, which clears the in-memory text returned by the SessionLog property. Session logging remains enabled or disabled according to the KeepSessionLog property. This example connects, logs in, and clears the log.

Background: When session logging is enabled, the SessionLog accumulates the raw IMAP command/response dialog — the first thing to inspect when diagnosing a failure. Over a long-lived session that log grows continuously; ClearSessionLog resets it so you can capture just the exchange for the next operation of interest, rather than sifting through the entire history.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Imap

li_Success = 0

//  Demonstrates the Imap.ClearSessionLog method, which clears the in-memory text returned by
//  the SessionLog property.  Session logging remains enabled or disabled according to the
//  KeepSessionLog property.

loo_Imap = create oleobject
li_rc = loo_Imap.ConnectToNewObject("Chilkat.Imap")
if li_rc < 0 then
    destroy loo_Imap
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Imap.Ssl = 1
loo_Imap.Port = 993

li_Success = loo_Imap.Connect("imap.example.com")
if li_Success = 0 then
    Write-Debug loo_Imap.LastErrorText
    destroy loo_Imap
    return
end if

li_Success = loo_Imap.Login("user@example.com","myPassword")
if li_Success = 0 then
    Write-Debug loo_Imap.LastErrorText
    destroy loo_Imap
    return
end if

//  Clear the session log (for example, before the next operation you want to capture).
loo_Imap.ClearSessionLog()

Write-Debug "Session log cleared."

li_Success = loo_Imap.Disconnect()
if li_Success = 0 then
    Write-Debug loo_Imap.LastErrorText
    destroy loo_Imap
    return
end if



destroy loo_Imap