test(transport): add sendmail transport

This commit is contained in:
Alexis Mousset
2016-10-23 20:42:13 +02:00
parent cc6ca7633d
commit 73e7aa3639
8 changed files with 92 additions and 55 deletions

View File

@@ -1,19 +1,19 @@
extern crate lettre;
use lettre::transport::stub::StubEmailTransport;
use lettre::transport::EmailTransport;
use lettre::email::EmailBuilder;
use lettre::transport::EmailTransport;
use lettre::transport::stub::StubEmailTransport;
#[test]
fn stub_transport() {
let mut sender = StubEmailTransport;
let email = EmailBuilder::new()
.to("root@localhost")
.from("user@localhost")
.body("Hello World!")
.subject("Hello")
.build()
.unwrap();
.to("root@localhost")
.from("user@localhost")
.body("Hello World!")
.subject("Hello stub")
.build()
.unwrap();
let result = sender.send(email);
assert!(result.is_ok());
}