Added settings to mail
ci/woodpecker/push/woodpecker Pipeline failed Details

Removed some comments
This commit is contained in:
Martin Slot 2022-12-07 08:34:31 +01:00
parent 2a1b5c2518
commit a5d4044ec8
2 changed files with 8 additions and 3 deletions

View File

@ -143,13 +143,11 @@ pub mod notification {
self.smtp_password.to_string(),
);
// Open a remote connection to gmail
let mailer = SmtpTransport::relay(self.smtp_relay.as_str())
.unwrap()
.credentials(creds)
.build();
// Send the email
match mailer.send(&email) {
Ok(_) => println!("Email sent successfully!"),
Err(e) => panic!("Could not send email: {:?}", e), //Todo: this shouldn't panic

View File

@ -7,7 +7,14 @@ fn main() {
let parser = ArgumentParser {};
let settings = Settings::new(None).unwrap();
let console = Console {};
let notification = EmailNotification;
// TODO: maybe not clone here, but reference?
let notification = EmailNotification {
smtp_relay: settings.email.smtp_relay.clone(),
smtp_username: settings.email.smtp_username.clone(),
smtp_password: settings.email.smtp_password.clone(),
from: settings.email.from.clone(),
};
let args = std::env::args().collect();
let application = Application::new(&settings, &console, &notification, parser, args);