Sample code for 30+ languages & platforms
Rust

IMAP NOOP Command

Demonstrates how to send an IMAP NOOP command using SendRawCommand.

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

let imap = chilkat::Imap::new();

// 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("****", "****").is_err() {
    println!("{}", imap.last_error_text());
    return;
}

// Send a NOOP command
let resp = imap.send_raw_command("NOOP").unwrap_or_default();
println!("{}", resp);

// Disconnect from the IMAP server.
let _ = imap.disconnect().is_ok();