rust-pop3-client

POP3 client for rust using rutls.

Features

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

References