13 releases (7 breaking)

0.9.1 Apr 1, 2024
0.9.0 Mar 12, 2023
0.8.0 Feb 3, 2023
0.5.0 Jun 27, 2022
0.1.0 Nov 11, 2019

#22 in Email

Download history 928/week @ 2024-01-05 987/week @ 2024-01-12 724/week @ 2024-01-19 1108/week @ 2024-01-26 884/week @ 2024-02-02 961/week @ 2024-02-09 581/week @ 2024-02-16 545/week @ 2024-02-23 1069/week @ 2024-03-01 844/week @ 2024-03-08 979/week @ 2024-03-15 877/week @ 2024-03-22 2244/week @ 2024-03-29 1239/week @ 2024-04-05 989/week @ 2024-04-12 1027/week @ 2024-04-19

5,638 downloads per month
Used in 8 crates (4 directly)

MIT/Apache

78KB
2K SLoC

async-smtp

Async implementation of SMTP


Based on the great lettre library.

Example

pub type Error = Box<dyn std::error::Error + Send + Sync>;
pub type Result<T> = std::result::Result<T, Error>;

use async_smtp::{Envelope, SendableEmail, SmtpClient, SmtpTransport};

async fn smtp_transport_simple() -> Result<()> {
    let stream = TcpStream::connect("127.0.0.1:2525").await?;
    let client = SmtpClient::new();
    let mut transport = SmtpTransport::new(client, stream).await?;

    let email = SendableEmail::new(
        Envelope::new(
            Some("user@localhost".parse().unwrap()),
            vec!["root@localhost".parse().unwrap()],
        )?,
        "Hello world",
    );
    transport.send(email).await?;

    Ok(())
}

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2–14MB
~167K SLoC