#email #mailgun

bin+lib mailgun-rs

An unofficial client library for the Mailgun API

4 releases

✓ Uses Rust 2018 edition

0.1.3 Sep 26, 2019
0.1.2 Sep 9, 2019
0.1.1 Sep 9, 2019
0.1.0 Sep 9, 2019

#60 in Email

Download history 2/week @ 2019-10-09 11/week @ 2019-10-16 60/week @ 2019-10-23 16/week @ 2019-10-30 1/week @ 2019-11-06 2/week @ 2019-11-13 13/week @ 2019-11-20 16/week @ 2019-11-27 4/week @ 2019-12-04 40/week @ 2019-12-11 12/week @ 2019-12-18 17/week @ 2019-12-25 2/week @ 2020-01-01 61/week @ 2020-01-08 29/week @ 2020-01-15

89 downloads per month

MIT license

15KB
109 lines

mailgun-rs

An unofficial client library for the Mailgun API

examples

extern crate mailgun_rs;

use mailgun_rs::{Mailgun, EmailAddress, Message};
use std::error::Error;

fn main() {
    let domain = "hackerth.com";
    let key = "key-xxxxxx";
    let recipient = "dongrify@gmail.com";
    let recipient = EmailAddress::address(&recipient);
    let message = Message {
        to: vec![recipient],
        subject: String::from("mailgun-rs"),
        html: String::from("<h1>hello from mailgun</h1>"),
        ..Default::default()
    };

    let client = Mailgun{api_key: String::from(key), domain: String::from(domain), message: message};
    let sender = EmailAddress::name_address("no-reply", "no-reply@hackerth.com");
    
    match client.send(&sender) {
      Ok(_) => {
        println!("successful");
      }
      Err(err) => {
        println!("{}", err.description());
      }
    }
}

Dependencies

~16MB
~392K SLoC