#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
pub staking_address: String,
+ pub smtp_relay_address: String,
pub smtp_login: String,
pub smtp_password: String,
}
pub fn default() -> Self {
Config {
staking_address: "192.168.2.102:8739".to_string(),
+ smtp_relay_address: "mail.something.com".to_string(),
smtp_login: "login".to_string(),
smtp_password: "password".to_string(),
}
match send_email(
"Watchdog Watchdog: Check alive error",
&format!("Error: {}", error),
+ &config.smtp_relay_address,
&config.smtp_login,
&config.smtp_password,
) {
}
}
-fn send_email(title: &str, body: &str, login: &str, pass: &str) -> Result<()> {
+fn send_email(
+ title: &str,
+ body: &str,
+ smtp_relay_address: &str,
+ login: &str,
+ pass: &str,
+) -> Result<()> {
let email = Message::builder()
.message_id(None)
.from("Staking Watchdog Watchdog <redmine@d-lan.net>".parse()?)
let creds = Credentials::new(login.to_string(), pass.to_string());
// Open a remote connection to gmail
- let mailer = SmtpTransport::relay("mail.infomaniak.com")?
+ let mailer = SmtpTransport::relay(smtp_relay_address)?
.credentials(creds)
.build();