mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-15 21:21:00 +00:00
Fix.
This commit is contained in:
parent
3f3c73a93e
commit
123e7f139c
1 changed files with 6 additions and 3 deletions
|
@ -43,15 +43,18 @@ pub async fn subscribe(
|
|||
.await
|
||||
.map_err(|_| HttpResponse::InternalServerError().finish())?;
|
||||
// We are swallowing the error for the time being.
|
||||
let _ = send_confirmation_email(&email_client).await;
|
||||
let _ = send_confirmation_email(&email_client, new_subscriber).await;
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "Send a confirmation email to a new subscriber",
|
||||
skip(new_subscriber, pool)
|
||||
skip(email_client, new_subscriber)
|
||||
)]
|
||||
pub async fn send_confirmation_email(email_client: &EmailClient) -> Result<(), reqwest::Error> {
|
||||
pub async fn send_confirmation_email(
|
||||
email_client: &EmailClient,
|
||||
new_subscriber: NewSubscriber,
|
||||
) -> Result<(), reqwest::Error> {
|
||||
let confirmation_link = "https://my-api.com/subscriptions/confirm";
|
||||
let plain_body = format!(
|
||||
"Welcome to our newsletter!\nVisit {} to confirm your subscription.",
|
||||
|
|
Loading…
Reference in a new issue