9 releases (5 stable)

1.1.1 Oct 28, 2023
1.1.0 Oct 24, 2023
1.0.1 Sep 10, 2023
0.1.7 Jul 25, 2023
0.1.6 Apr 19, 2023

#58 in Email

Download history 78/week @ 2023-12-13 45/week @ 2023-12-20 12/week @ 2023-12-27 29/week @ 2024-01-03 101/week @ 2024-01-10 76/week @ 2024-01-17 88/week @ 2024-01-24 57/week @ 2024-01-31 53/week @ 2024-02-07 44/week @ 2024-02-14 97/week @ 2024-02-21 58/week @ 2024-02-28 73/week @ 2024-03-06 44/week @ 2024-03-13 43/week @ 2024-03-20 51/week @ 2024-03-27

219 downloads per month
Used in 2 crates

MIT license

85KB
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

~3–17MB
~240K SLoC