Expanded mail client for easier email operations.

This commit is contained in:
mikestefanello 2022-01-14 15:42:32 -05:00
parent 3f053711ba
commit e8d73421aa
5 changed files with 160 additions and 59 deletions

View file

@ -105,12 +105,16 @@ func (c *Register) sendVerificationEmail(ctx echo.Context, usr *ent.User) {
}
// Send the email
err = c.Container.Mail.Send(ctx, usr.Email, fmt.Sprintf(
"Confirm your email address: %s",
ctx.Echo().Reverse("verify_email", token),
))
url := ctx.Echo().Reverse("verify_email", token)
err = c.Container.Mail.
Compose().
To(usr.Email).
Subject("Confirm your email address").
Body(fmt.Sprintf("Click here to confirm your email address: %s", url)).
Send(ctx)
if err != nil {
ctx.Logger().Errorf("unable to send email verification token: %v", err)
ctx.Logger().Errorf("unable to send email verification link: %v", err)
return
}