3 unstable releases

new 0.5.0 Nov 21, 2020
0.4.4 Oct 30, 2020
0.4.4-samotop-dev Oct 28, 2020

#34 in Email


Used in samotop

MIT/Apache

150KB
4K SLoC

samotop-delivery 0.5.0

samotop-delivery is an implementation of the smtp protocol client in Rust.

Example

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

use samotop_delivery::prelude::{
    Envelope, SmtpClient, Transport,
};

async fn smtp_transport_simple() -> Result<()> {
    let envelope = Envelope::new(
            Some("user@localhost".parse().unwrap()),
            vec!["root@localhost".parse().unwrap()],
            "id".to_string(),
        ).unwrap();
    let message = "From: user@localhost\r\n\
                    Content-Type: text/plain\r\n\
                    \r\n\
                    Hello example"
                    .as_bytes();
    let client = SmtpClient::new("127.0.0.1:2525").unwrap();

    // Create a client, connect and send
    client.connect_and_send(envelope, message).await.unwrap();

    Ok(())
}

Credits

This is a fork of async-smtp

License - MIT OR Apache-2.0

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2.5–6.5MB
~142K SLoC