server: use async api for email sending

Fixes #378
This commit is contained in:
Michał Mrozek
2022-11-24 14:47:56 +01:00
committed by GitHub
parent 80fc94c4db
commit dd7e392626
3 changed files with 24 additions and 12 deletions
+10 -1
View File
@@ -131,7 +131,16 @@ fn send_test_email_command(opts: TestEmailOpts) -> Result<()> {
let to = opts.to.parse()?;
let config = infra::configuration::init(opts)?;
infra::logging::init(&config)?;
mail::send_test_email(to, &config.smtp_options)
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()?;
runtime.block_on(
mail::send_test_email(to, &config.smtp_options)
.unwrap_or_else(|e| error!("Could not send email: {:#}", e)),
);
Ok(())
}
fn run_healthcheck(opts: RunOpts) -> Result<()> {