You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds support for sending the user an email notification when
their email has been changed.
3 new environment variables are introduced:
- `GOTRUE_MAILER_SUBJECTS_EMAIL_CHANGED_NOTIFICATION`: Email subject to
use for password changed notification.
- `GOTRUE_MAILER_TEMPLATES_EMAIL_CHANGED_NOTIFICATION`: The URL to
specify a custom template.
- `GOTRUE_MAILER_NOTIFICATIONS_EMAIL_CHANGED_ENABLED`: whether the
notification is enabled or not.
The feature is disabled by default. To enable it, the
`GOTRUE_MAILER_NOTIFICATIONS_EMAIL_CHANGED_ENABLED` environment variable
must be set to `true`.
The default email will look as follows:
<img width="956" height="461" alt="Screenshot 2025-09-26 at 15 28 18"
src="https://github.com/user-attachments/assets/950812f5-5bfe-41ef-9368-9e479ab04f94"
/>
URL path to an email template to use when notifying a user that their password has been changed. (e.g. `https://www.example.com/path-to-email-template.html`)
670
-
`SiteURL` and `Email` variables are available.
674
+
`Email` variables are available.
671
675
672
676
Default Content (if template is unavailable):
673
677
@@ -679,12 +683,34 @@ Default Content (if template is unavailable):
679
683
just been changed. If you did not make this change, please contact support
680
684
immediately.
681
685
</p>
686
+
<p>If you did not make this change, please contact support.</p>
URL path to an email template to use when notifying a user that their email has been changed. (e.g. `https://www.example.com/path-to-email-template.html`)
696
+
`Email` and `OldEmail` variables are available.
697
+
698
+
Default Content (if template is unavailable):
699
+
700
+
```html
701
+
<h2>Your email address has been changed</h2>
702
+
703
+
<p>
704
+
The email address for your account has been changed from {{ .OldEmail }} to {{
705
+
.Email }}.
706
+
</p>
707
+
<p>If you did not make this change, please contact support.</p>
returnapierrors.NewBadRequestError(apierrors.ErrorCodeEmailAddressNotAuthorized, "Email address %q cannot be used as it is not authorized", u.GetEmail())
620
678
}
@@ -659,7 +717,7 @@ func (a *API) sendEmail(r *http.Request, tx *storage.Connection, u *models.User,
659
717
660
718
ifconfig.Hook.SendEmail.Enabled {
661
719
// When secure email change is disabled, we place the token for the new email on emailData.Token
0 commit comments