rust-pop3-client
POP3 client for rust using rutls.
Features
- provides all mandatory POP3 commands
- provides most optional POP3 commands
(APOP is not provided, since it is not used often)
- allow to specify own certificates
(a rustls::RootCertStore
instance can be provided, if not system certificates will be used)
Depedency
Cargo.toml:
toml
[dependencies]
rust-pop3-client = { git = "https://github.com/falk-werner/rust-pop3-client" }
Example
````rust
use std::error::Error;
use std::io::{self, Write};
extern crate rustpop3client;
use rustpop3client::Pop3Connection;
fn readvalue(prompt: &str) -> Result> {
print!("{}: ", prompt);
io::stdout().flush()?;
let mut value = String::new();
io::stdin().readline(&mut value)?;
Ok(String::from(value.trim()))
}
fn readpassword(prompt: &str) -> Result> {
print!("{}: ", prompt);
io::stdout().flush()?;
Ok(rpassword::readpassword()?)
}
fn main() -> Result<(), Box> {
let host = readvalue("host (e.g. pop.gmail.com)")?;
let port = readvalue("port (e.g. 995)")?.parse::()?;
let user = readvalue("user (e-mail address)")?;
let password = readpassword("password")?;
let mut connection = Pop3Connection::new(&host, port)?;
connection.login(&user, &password)?;
println!("id\tsize");
let infos = connection.list()?;
for info in infos {
println!("{}\t{}", info.message_id, info.message_size);
}
Ok(())
}
````
Similar projects
- rust-pop3
(Seems promising, but is based on an outdated version of OpenSSL.)
References