Compare commits

...

2 Commits

Author SHA1 Message Date
123efa1c8c Merge pull request 'only send mails to proper addresses' (#197) from staging into main
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
Reviewed-on: #197
2024-02-05 22:22:08 +01:00
19afa34c13 only send mails to proper addresses
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m2s
CI/CD Pipeline / deploy-staging (push) Successful in 4m33s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-02-04 10:34:58 +01:00

View File

@ -8,7 +8,7 @@ use sqlx::SqlitePool;
use crate::tera::admin::mail::MailToSend;
use super::{family::Family, role::Role, user::User};
use super::{family::Family, log::Log, role::Role, user::User};
pub struct Mail {}
@ -32,7 +32,16 @@ impl Mail {
for rec in role.mails_from_role(db).await {
let splitted = rec.split(',');
for single_rec in splitted {
email = email.bcc(single_rec.parse().unwrap());
match single_rec.parse() {
Ok(new_bcc_mail) => email = email.bcc(new_bcc_mail),
Err(_) => {
Log::create(
db,
format!("Mail not sent to {rec}, because it could not be parsed"),
)
.await;
}
}
}
}