[][src]Module lettre::transport::sendmail

This is supported on crate feature sendmail-transport only.

The sendmail transport sends the email using the local sendmail command.

Sync example



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")
    .body("Be happy!")?;

let sender = SendmailTransport::new();
let result = sender.send(&email);
assert!(result.is_ok());

Async tokio 0.2 example


use lettre::{Message, Tokio02Transport, SendmailTransport};

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")
    .body("Be happy!")?;

let sender = SendmailTransport::new();
let result = sender.send(email).await;
assert!(result.is_ok());

Async async-std 1.x example


 use lettre::{Message, AsyncStd1Transport, SendmailTransport};

 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")
     .body("Be happy!")?;

 let sender = SendmailTransport::new();
 let result = sender.send(email).await;
 assert!(result.is_ok());

Structs

SendmailTransport

Sends an email using the sendmail command

Enums

Error

An enum of all error kinds.