Crate samotop_delivery[−][src]
samotop-delivery is a set of transports to deliver mail to, notably to SMTP/LMTP, but also maildir... It is used in Samotop as a delivery solution for incoming mail.
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()?), vec!["root@localhost".parse()?], "id".to_string(), )?; 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")?; // Create a client, connect and send client.connect_and_send(envelope, message).await?; Ok(()) }
Modules
delivery | |
dir | Reference implementation of a mail service simply delivering mail to single directory. |
file | The file transport writes the emails to the given directory. The name of the file will be
|
prelude | |
sendmail | The sendmail transport sends the envelope using the local sendmail command. |
smtp | The SMTP transport sends emails using the SMTP protocol. |
stub | The stub transport only logs message envelope and drops the content. It can be useful for testing purposes. |
types |
Traits
MailDataStream | |
Transport | Transport method for emails |
Type Definitions
SyncFuture |