Rust Requires Chilkat v11.0.0+
Rust
Retrieve UIDL's from POP3 Server
Retrieve a list of UIDLs from a POP3 server. UIDLs are unique identifiers, 1 to 70 characters long, composed of characters ranging from 0x21 to 0x7E. These identifiers uniquely distinguish messages within a mailbox and remain consistent across sessions.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let mailman = chilkat::MailMan::new();
mailman.set_mail_host("pop.example.com");
mailman.set_pop_username("myLogin");
mailman.set_pop_password("myPassword");
mailman.set_mail_port(995);
mailman.set_pop_ssl(true);
let st_uidls = chilkat::StringTable::new();
if mailman.fetch_uidls(&st_uidls).is_err() {
println!("{}", mailman.last_error_text());
return;
}
// Download each email by UIDL.
let email = chilkat::Email::new();
let count = st_uidls.count();
let mut i = 0;
while i < count {
// Download the full email.
let uidl = st_uidls.string_at(i).unwrap_or_default();
if mailman.fetch_by_uidl(&uidl, false, 0, &email).is_err() {
println!("{}", mailman.last_error_text());
return;
}
println!("{}", i);
println!("UIDL: {}", uidl);
println!("From: {}", email.from());
println!("Subject: {}", email.subject());
i = i + 1;
}
let _ = mailman.pop3_end_session();