aboutsummaryrefslogtreecommitdiff
path: root/src/mail.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-05-04 01:38:32 +0200
committermetamuffin <metamuffin@disroot.org>2024-05-04 01:38:32 +0200
commit24b10f4d389fcc5c23406eceef5d6e9a35551d21 (patch)
tree2353159f79d7c0495d3f6ab9717dfc727ae46f23 /src/mail.rs
parentc59d4bbb60a56eb8a69d3896390b9610b62a5be3 (diff)
downloadstatuspage-24b10f4d389fcc5c23406eceef5d6e9a35551d21.tar
statuspage-24b10f4d389fcc5c23406eceef5d6e9a35551d21.tar.bz2
statuspage-24b10f4d389fcc5c23406eceef5d6e9a35551d21.tar.zst
extra recipients per service
Diffstat (limited to 'src/mail.rs')
-rw-r--r--src/mail.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mail.rs b/src/mail.rs
index 841b552..d6a22b1 100644
--- a/src/mail.rs
+++ b/src/mail.rs
@@ -12,8 +12,8 @@ use crate::Config;
#[derive(Debug, Deserialize)]
pub struct MailConfig {
- from: String,
- to: Vec<String>,
+ mail_from: String,
+ mail_to: Vec<String>,
smtp_auth: SmtpAuth,
smtp_port: u16,
smtp_timeout: Option<f64>,
@@ -59,11 +59,10 @@ pub async fn send_mail(
}
let transport = transport.build();
- for recipient in &mconfig.to {
- let service = &config.services[service];
-
+ let service = &config.services[service];
+ for recipient in mconfig.mail_to.iter().chain(service.mail_to.iter()) {
let message = Message::builder()
- .from(Mailbox::from_str(&mconfig.from)?)
+ .from(Mailbox::from_str(&mconfig.mail_from)?)
.to(Mailbox::from_str(&recipient)?)
.subject(format!("{} failed.", service.title))
.body(format!(