#pop3-client #connect #async #tls #tls-connector #pop #server

async-pop2

A fork of simple Pop3 compatible client

1 stable release

1.1.1 Jan 8, 2025

#107 in Email

Download history 126/week @ 2025-01-06 17/week @ 2025-01-13 4/week @ 2025-01-20 17/week @ 2025-01-27 42/week @ 2025-02-03 4/week @ 2025-02-10

63 downloads per month
Used in getemail

MIT license

88KB
2K SLoC

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);

}

Dependencies

~2–10MB
~103K SLoC