Version 0.2.0 #2

Merged
Thelie merged 15 commits from garbage into main 2021-05-23 22:47:43 +02:00
Showing only changes of commit af769100e7 - Show all commits

View file

@ -80,11 +80,13 @@ fn main() {
}
let mut mailer = SendmailTransport::new();
loop {
match rx.recv() {
Ok(data) => {
println!("Sending mail to: {}", data[0]);
let title = format!("You were mentioned in {} on {}", data[2], data[1]);
let body = format!("{} wrote: {}", data[3], data[4]).into_bytes();
let mail = lettre::SendableEmail::new(
lettre::Envelope::new(
Some(
@ -94,13 +96,14 @@ fn main() {
vec![
lettre::EmailAddress::new(data[0].clone()).unwrap()]
).unwrap(),
format!("You were mentioned in {} on {}", data[2], data[1]),
format!("{}: {}", data[3], data[4]).into_bytes()
title,
body
);
match mailer.send(mail) {
Ok(_) => println!("Email sent successfully!"),
Err(e) => panic!("Could not send email: {:?}", e),
}
match mailer.send(mail) {
Ok(_) => println!("Email sent successfully!"),
Err(e) => panic!("Could not send email: {:?}", e),
}
}
Err(_e) => (),
}