Available on crate feature
sendmail-transport only.Expand description
The sendmail transport sends the email using the local sendmail command.
§Sync example
use lettre::{Message, SendmailTransport, Transport, message::header::ContentType};
let email = Message::builder()
.from("NoBody <nobody@domain.tld>".parse()?)
.reply_to("Yuin <yuin@domain.tld>".parse()?)
.to("Hei <hei@domain.tld>".parse()?)
.subject("Happy new year")
.header(ContentType::TEXT_PLAIN)
.body(String::from("Be happy!"))?;
let sender = SendmailTransport::new();
sender.send(&email)?;
§Async tokio 1.x example
use lettre::{
AsyncSendmailTransport, AsyncTransport, Message, SendmailTransport, Tokio1Executor,
message::header::ContentType,
};
let email = Message::builder()
.from("NoBody <nobody@domain.tld>".parse()?)
.reply_to("Yuin <yuin@domain.tld>".parse()?)
.to("Hei <hei@domain.tld>".parse()?)
.subject("Happy new year")
.header(ContentType::TEXT_PLAIN)
.body(String::from("Be happy!"))?;
let sender = AsyncSendmailTransport::<Tokio1Executor>::new();
sender.send(email).await?;§Async async-std 1.x example
use lettre::{Message, AsyncTransport, AsyncStd1Executor,message::header::ContentType, AsyncSendmailTransport};
let email = Message::builder()
.from("NoBody <nobody@domain.tld>".parse()?)
.reply_to("Yuin <yuin@domain.tld>".parse()?)
.to("Hei <hei@domain.tld>".parse()?)
.subject("Happy new year").header(ContentType::TEXT_PLAIN)
.body(String::from("Be happy!"))?;
let sender = AsyncSendmailTransport::<AsyncStd1Executor>::new();
sender.send(email).await?;Structs§
- Async
Sendmail Transport async-std1ortokio1 - Asynchronously sends emails using the
sendmailcommand - Error
- The Errors that may occur when sending an email over sendmail
- Sendmail
Transport - Sends emails using the
sendmailcommand