async-smtp

Crates.ioasync-smtp
lib.rsasync-smtp
version0.9.2
sourcesrc
created_at2019-11-11 17:53:31.348826
updated_at2024-10-14 07:05:04.536978
descriptionSMTP client
homepagehttps://github.com/async-email/async-smtp
repositoryhttps://github.com/async-email/async-smtp
max_upload_size
id180327
size133,422
link2xt (link2xt)

documentation

README

async-smtp

Async implementation of SMTP

Crates.io version Download docs.rs docs CI status

API Docs | Releases


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.

Commit count: 114

cargo fmt