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

#27 in Email

Download history 1206/week @ 2024-07-25 1724/week @ 2024-08-01 1329/week @ 2024-08-08 1568/week @ 2024-08-15 1566/week @ 2024-08-22 1552/week @ 2024-08-29 1371/week @ 2024-09-05 1455/week @ 2024-09-12 1431/week @ 2024-09-19 1566/week @ 2024-09-26 2251/week @ 2024-10-03 1895/week @ 2024-10-10 2284/week @ 2024-10-17 1543/week @ 2024-10-24 2048/week @ 2024-10-31 2130/week @ 2024-11-07

8,202 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