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

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

Sync example

use lettre::{Message, Envelope, Transport, SendmailTransport};

let email = Message::builder()
    .from("NoBody <nobody@domain.tld>".parse().unwrap())
    .reply_to("Yuin <yuin@domain.tld>".parse().unwrap())
    .to("Hei <hei@domain.tld>".parse().unwrap())
    .subject("Happy new year")
    .body("Be happy!")
    .unwrap();

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

Async tokio 0.2 example

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

let email = Message::builder()
    .from("NoBody <nobody@domain.tld>".parse().unwrap())
    .reply_to("Yuin <yuin@domain.tld>".parse().unwrap())
    .to("Hei <hei@domain.tld>".parse().unwrap())
    .subject("Happy new year")
    .body("Be happy!")
    .unwrap();

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

Async async-std 1.x example

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

 let email = Message::builder()
     .from("NoBody <nobody@domain.tld>".parse().unwrap())
     .reply_to("Yuin <yuin@domain.tld>".parse().unwrap())
     .to("Hei <hei@domain.tld>".parse().unwrap())
     .subject("Happy new year")
     .body("Be happy!")
     .unwrap();

 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.