Unicode C++
Unicode C++
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 Unicode C++ Downloads
#include <CkImapW.h>
void ChilkatSample(void)
{
bool success = false;
// 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.
CkImapW imap;
imap.put_Ssl(true);
imap.put_Port(993);
success = imap.Connect(L"imap.example.com");
if (success == false) {
wprintf(L"%s\n",imap.lastErrorText());
return;
}
success = imap.Login(L"user@example.com",L"myPassword");
if (success == false) {
wprintf(L"%s\n",imap.lastErrorText());
return;
}
// Clear the session log (for example, before the next operation you want to capture).
imap.ClearSessionLog();
wprintf(L"Session log cleared.\n");
success = imap.Disconnect();
if (success == false) {
wprintf(L"%s\n",imap.lastErrorText());
return;
}
}