async-pop

Crates.ioasync-pop
lib.rsasync-pop
version1.1.1
sourcesrc
created_at2023-04-19 01:27:53.722089
updated_at2023-10-28 15:58:16.630991
descriptionA simple Pop3 compatible client
homepage
repositoryhttps://github.com/Dust-Mail/async-pop
max_upload_size
id843098
size89,294
Guus van Meerveld (Guusvanmeerveld)

documentation

README

Pop3 client

This is a simple Pop3 client that implements all of the features according to RFC 1939, written in Rust.

It is used in Dust-Mail to connect to Pop servers.

Usage

You can create a new session using the connect function or the connect_plain function.

connect expects a tls connector from the async-native-tls crate. In the future more tls options will be supported.

If you already have a connected socket, you can also create a new session using the new function.

Example

extern crate async_pop;
extern crate async_native_tls;
extern crate mailparse;

use async_native_tls::TlsConnector;
use mailparse::parse_mail;

#[tokio::main]
async fn main() {
    let tls = TlsConnector::new();

    let mut client = async_pop::connect(("pop.gmail.com", 995), "pop.gmail.com", &tls).await.unwrap();

    client.login("example@gmail.com", "password").await.unwrap();

    let bytes = client.retr(1).await.unwrap();

    let message = parse_mail(&bytes).unwrap();

    let subject = message.headers.get_first_value("Subject").unwrap();

    println!("{}", subject);

}
Commit count: 74

cargo fmt