Fix clippy and formatting

This commit is contained in:
Alexis Mousset
2019-03-17 13:21:14 +01:00
parent 0444e7833b
commit 2d4320ea45
2 changed files with 0 additions and 38 deletions

View File

@@ -1,38 +0,0 @@
extern crate lettre;
extern crate lettre_email;
use lettre::smtp::authentication::Credentials;
use lettre::{SmtpClient, Transport};
use lettre_email::Email;
fn main() {
let email = Email::builder()
.to("to@example.org")
.from("from@example.com")
.subject("subject")
.text("message")
.build()
.unwrap();
let creds = Credentials::new(
"example_username".to_string(),
"example_password".to_string(),
);
// Open connection to gmail
let mut mailer = SmtpClient::new_simple("smtp.gmail.com")
.unwrap()
.credentials(creds)
.transport();
// Send the email
let result = mailer.send(email.into());
if result.is_ok() {
println!("Email sent");
} else {
println!("Could not send email: {:?}", result);
}
assert!(result.is_ok());
}