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

@ -84,10 +84,14 @@ func (c *ForgotPassword) Post(ctx echo.Context) error {
ctx.Logger().Infof("generated password reset token for user %d", u.ID)
// Email the user
err = c.Container.Mail.Send(ctx, u.Email, fmt.Sprintf(
"Go here to reset your password: %s",
ctx.Echo().Reverse("reset_password", u.ID, token),
))
url := ctx.Echo().Reverse("reset_password", u.ID, token)
err = c.Container.Mail.
Compose().
To(u.Email).
Subject("Reset your password").
Body(fmt.Sprintf("Go here to reset your password: %s", url)).
Send(ctx)
if err != nil {
return c.Fail(ctx, err, "error sending password reset email")
}