aboutsummaryrefslogtreecommitdiff
path: root/src/jobs
diff options
context:
space:
mode:
authorJoris2021-01-23 08:58:42 +0100
committerJoris2021-02-01 09:58:56 +0100
commita8e943c9a7abbde95c900d89fc5f2ed825e9afa3 (patch)
tree18ce24a52071933905bc35a68f1a1ec5978c9666 /src/jobs
parent9b85d7ff5e241f97141e85d60a5ce401963a35c3 (diff)
Fix mail sending
The error was due to the utilization of the special character “—” in the subject, with postfix’ sendmail. Also directly use process commands to get async support.
Diffstat (limited to 'src/jobs')
-rw-r--r--src/jobs/weekly_report.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/jobs/weekly_report.rs b/src/jobs/weekly_report.rs
index 819d30b..b482f0d 100644
--- a/src/jobs/weekly_report.rs
+++ b/src/jobs/weekly_report.rs
@@ -17,10 +17,17 @@ pub async fn send(
let users = db::users::list(pool).await;
mail::send(
config,
- users.into_iter().map(|u| (u.email, u.name)).collect(),
- "Budget — rapport hebdomadaire".to_string(),
+ users
+ .into_iter()
+ .map(|u| mail::Recipient {
+ name: u.name,
+ address: u.email,
+ })
+ .collect(),
+ "Rapport hebdomadaire".to_string(),
report,
)
+ .await
}
Err(err) => {
error!("Error preparing weekly report from template: {:?}", err);