17 releases

0.10.0-alpha.2 Sep 9, 2020
0.10.0-alpha.1 May 31, 2020
0.9.3 Apr 19, 2020
0.9.2 Jun 11, 2019
0.5.0 Oct 26, 2015

#4 in Email

Download history 1932/week @ 2020-06-01 2132/week @ 2020-06-08 1823/week @ 2020-06-15 1661/week @ 2020-06-22 2233/week @ 2020-06-29 2060/week @ 2020-07-06 2236/week @ 2020-07-13 2265/week @ 2020-07-20 2075/week @ 2020-07-27 1973/week @ 2020-08-03 2722/week @ 2020-08-10 2522/week @ 2020-08-17 2598/week @ 2020-08-24 2929/week @ 2020-08-31 2865/week @ 2020-09-07 2611/week @ 2020-09-14

9,594 downloads per month
Used in 22 crates (21 directly)

MIT license

5.5K SLoC


A mailer library for Rust

NOTE: this readme refers to the 0.10 version of lettre, which is still being worked on. The master branch and the alpha releases will see API breaking changes and some features may be missing or incomplete until the stable 0.10.0 release is out. Use the v0.9.x branch for stable releases.


Lettre provides the following features:

  • Multiple transport methods
  • Unicode support (for email content and addresses)
  • Secure delivery with SMTP using encryption and authentication
  • Easy email builders
  • Async support (incomplete)

Lettre does not provide (for now):

  • Email parsing


This library requires Rust 1.40 or newer. To use this library, add the following to your Cargo.toml:

lettre = "0.10.0-alpha.2"
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};

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!")

let creds = Credentials::new("smtp_username".to_string(), "smtp_password".to_string());

// Open a remote connection to gmail
let mailer = SmtpTransport::relay("smtp.gmail.com")

// Send the email
match mailer.send(&email) {
    Ok(_) => println!("Email sent successfully!"),
    Err(e) => panic!("Could not send email: {:?}", e),


The lettre tests require an open mail server listening locally on port 2525 and the sendmail command.

Alternatively only unit tests can be run by doing cargo test --lib.

Code of conduct

Anyone who interacts with Lettre in any space, including but not limited to this GitHub repository, must follow our code of conduct.


This program is distributed under the terms of the MIT license.

The builder comes from emailmessage-rs by Kayo, under MIT license.

See LICENSE for details.


~24K SLoC