Rust
Rust
IMAP Session Logging
Demonstrates how to use session logging with IMAP.Chilkat Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let imap = chilkat::Imap::new();
// Set the KeepSessionLog property to enable IMAP session logging
imap.set_keep_session_log(true);
// Connect to an IMAP server.
// Use TLS
imap.set_ssl(true);
imap.set_port(993);
if imap.connect("imap.example.com").is_err() {
println!("{}", imap.last_error_text());
return;
}
// Login
if imap.login("mylogin", "mypassword").is_err() {
println!("{}", imap.last_error_text());
return;
}
// Select an IMAP mailbox
if imap.select_mailbox("Inbox").is_err() {
println!("{}", imap.last_error_text());
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.
let _ = imap.disconnect().is_ok();
// Display the session log...
println!("{}", imap.session_log());