Crate mailstrom [] [src]

Mailstrom handles email delivery in a background worker thread, with the following features:

Limitations

You can use it as follows:

extern crate email_format;
extern crate mailstrom;

use email_format::Email;
use mailstrom::{Mailstrom, Config, MemoryStorage};

fn main() {
    let mut email = Email::new(
        "myself@mydomain.com",  // "From:"
        "Wed, 05 Jan 2015 15:13:05 +1300" // "Date:"
    ).unwrap();

    email.set_bcc("myself@mydomain.com").unwrap();
    email.set_sender("from_myself@mydomain.com").unwrap();
    email.set_reply_to("My Mailer <no-reply@mydomain.com>").unwrap();
    email.set_to("You <you@yourdomain.com>, AndYou <andyou@yourdomain.com>").unwrap();
    email.set_cc("Our Friend <friend@frienddomain.com>").unwrap();
    email.set_subject("Hello Friend").unwrap();
    email.set_body("Good to hear from you.\r\n\
                    I wish you the best.\r\n\
                    \r\n\
                    Your Friend").unwrap();

    let mut mailstrom = Mailstrom::new(
        Config {
            helo_name: "my.host.domainname".to_owned(),
            smtp_timeout_secs: 30,
        },
        MemoryStorage::new());

    // We must explicitly tell mailstrom to start actually sending emails.  If we
    // were only interested in reading the status of previously sent emails, we
    // would not send this command.
    mailstrom.start().unwrap();

    let message_id = mailstrom.send_email(email).unwrap();

    // Later on, after the worker thread has had time to process the request,
    // you can check the status:

    let status = mailstrom.query_status(&*message_id).unwrap();
    println!("{:?}", status);
}

Reexports

pub use status::Status;
pub use status::DeliveryResult;

Modules

error
internal_status

This is exposed for implementers of MailstromStorage but otherwise should not be needed by users of this library.

status

Structs

Config
Mailstrom
MemoryStorage

Enums

WorkerStatus

Traits

MailstromStorage

A trait for implementing Mailstrom storage

MailstromStorageError