Skip to content

Commit

Permalink
some debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Feb 21, 2024
1 parent 7b9cf0e commit badbcc2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fastn-core/src/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ impl Mailer {
subject: &str,
body: String,
) -> Result<(), MailError> {
println!("send_raw");
if !enable_email {
tracing::info!("enable_mail is not set, not sending mail to: {}", &to);
println!("enable_mail is not set, not sending mail to: {}", &to);
return Ok(());
}

Expand All @@ -64,17 +66,25 @@ impl Mailer {
.header(lettre::message::header::ContentType::TEXT_HTML)
.body(body)?;

println!("email: {:?}", &email);

let creds = lettre::transport::smtp::authentication::Credentials::new(
self.smtp_username.clone(),
self.smtp_password.clone(),
);

println!("creds created");

let mailer = lettre::AsyncSmtpTransport::<lettre::Tokio1Executor>::relay(&self.smtp_host)?
.credentials(creds)
.build();

println!("mailer created");

lettre::AsyncTransport::send(&mailer, email).await?;

println!("mail sent");

Ok(())
}
}

0 comments on commit badbcc2

Please sign in to comment.