Module lettre::transport::stub[][src]

The stub transport only logs message envelope and drops the content. It can be useful for testing purposes.

Stub Transport

The stub transport returns provided result and drops the content. It can be useful for testing purposes.

use lettre::{transport::stub::StubTransport, Message, Transport};

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

let mut sender = StubTransport::new_ok();
let result = sender.send(&email);
assert!(result.is_ok());

Structs

Error
StubTransport

This transport logs the message envelope and returns the given response