Search

Lib.rs

› Email
#send-email

sendmail

Rust sending emails via sendmail. Works nicely with Iron Framework using form Posts.

by Alexander Elias, Proc

  • Install
  • API reference
  • GitHub (xeaone)

3 stable releases

Uses old Rust 2015

2.0.0 Mar 19, 2018
1.0.1 Jul 23, 2015
1.0.0 Jul 22, 2015

#506 in Email


Used in git-next

Custom license

4KB

Rust Sendmail

Rust sending emails via sendmail.

Required:

  1. linux/unix machine
  2. sendmail compatible software installed (postfix/exim4..)

* Note these instructions assume a Ubuntu machine

Step One

Install sendmail and configure

Run Commands:

apt-get install sendmail
nano /etc/hosts

Edit: 127.0.0.1 localhost localhost.localdomain HOSTNAME_IF_YOU_HAVE ONE

Run Commands:

/etc/init.d/networking stop
/etc/init.d/networking start

Run Command:

sendmailconfig

* Y to everything

Step Two

Create Main.rs File

extern crate sendmail;
use sendmail::email;

fn main() {

    // Configure email body and header
    email::send(
        // From Address
        "from.email@example.com",
        // To Address
        &["to.email@example.com"],
        // Subject
        "Subject - Hello World!",
        // Body
        "<html><body><h1>I am the body. Hello Wolrd!<br/><br/>And I accept html.</h1></body></html>"
    ).unwrap();
}

No runtime deps

See also: aws-sdk-sesv2, lettre, aws-sdk-ses, sendgrid_thin, smail, gmail, infobip_sdk, reinhardt-mail, rusoto_sesv2, onesignal-rust-api, rustack-ses-core

Lib.rs is an unofficial list of Rust/Cargo crates, created by kornelski. It contains data from multiple sources, including heuristics, and manually curated data. Content of this page is not necessarily endorsed by the authors of the crate. This site is not affiliated with nor endorsed by the Rust Project. If something is missing or incorrect, please file a bug.