feat: add confirmation link to email
This commit is contained in:
parent
0427df8656
commit
90fc6abf19
4 changed files with 56 additions and 7 deletions
|
|
@ -56,12 +56,20 @@ pub async fn subscribe(
|
|||
if insert_subscriber(&db_pool, &new_subscriber).await.is_err() {
|
||||
return (StatusCode::INTERNAL_SERVER_ERROR, "Something went wrong.").into_response();
|
||||
}
|
||||
let confirmation_link = "https://my-api.com/subscriptions/confirm";
|
||||
if email_client
|
||||
.send_email(
|
||||
new_subscriber.email,
|
||||
"Welcome!",
|
||||
"Welcome to our newsletter!",
|
||||
"Welcome to our newsletter!",
|
||||
&format!(
|
||||
"Welcome to our newsletter!<br />\
|
||||
Click <a href=\"{}\">here</a> to confirm your subscription.",
|
||||
confirmation_link,
|
||||
),
|
||||
&format!(
|
||||
"Welcome to our newsletter! \nVisit {} to confirm your subscription.",
|
||||
confirmation_link,
|
||||
),
|
||||
)
|
||||
.await
|
||||
.is_err()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue