Dart
Dart
IMAP Session Logging
Demonstrates how to use session logging with IMAP.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final imap = CkImap();
// 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;
try {
imap.connect('imap.example.com');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Login
try {
imap.login('mylogin', 'mypassword');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Select an IMAP mailbox
try {
imap.selectMailbox('Inbox');
} on ChilkatException catch (e) {
print(e.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.
imap.disconnect();
// Display the session log...
print(imap.sessionLog);
}