14 releases (7 breaking)

0.9.2 Oct 14, 2024
0.9.1 Apr 1, 2024
0.9.0 Mar 12, 2023
0.5.0 Jun 27, 2022
0.1.0 Nov 11, 2019

#28 in Email

Download history 1120/week @ 2024-07-13 1184/week @ 2024-07-20 1554/week @ 2024-07-27 1429/week @ 2024-08-03 1365/week @ 2024-08-10 1548/week @ 2024-08-17 1655/week @ 2024-08-24 1356/week @ 2024-08-31 1547/week @ 2024-09-07 1473/week @ 2024-09-14 1325/week @ 2024-09-21 1569/week @ 2024-09-28 2221/week @ 2024-10-05 2490/week @ 2024-10-12 1885/week @ 2024-10-19 1572/week @ 2024-10-26

8,409 downloads per month
Used in 9 crates (5 directly)

MIT/Apache

79KB
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–13MB
~169K SLoC