* Update dependencies (#386) * Update dependencies and set MSRV to 1.40 * update hyperx * Use display instead of description for errors * Make hostname an optional feature * Envelope from headers * Update hyperx to 1.0 * rename builder to message * Cleanup and make Transport send Messages * Update rustls from 0.16 to 0.17 * Move transports into a common folder * Merge imports from same crate * Add message creation example to the site * Hide "extern crate" in doc examples * Add References and In-Reply-To methods * Add message-id header * Add blog posts and improve doc examples
22 lines
657 B
Rust
22 lines
657 B
Rust
#[cfg(test)]
|
|
#[cfg(feature = "smtp-transport")]
|
|
mod test {
|
|
use lettre::{ClientSecurity, Message, SmtpClient, Transport};
|
|
|
|
#[test]
|
|
fn smtp_transport_simple() {
|
|
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!")
|
|
.unwrap();
|
|
SmtpClient::new("127.0.0.1:2525", ClientSecurity::None)
|
|
.unwrap()
|
|
.transport()
|
|
.send(email)
|
|
.unwrap();
|
|
}
|
|
}
|