Skip to content

fix(mailer): include SiteURL in notification template data#2532

Merged
cstockton merged 3 commits into
supabase:masterfrom
jeffreywescott:fix/notification-templates-siteurl
May 26, 2026
Merged

fix(mailer): include SiteURL in notification template data#2532
cstockton merged 3 commits into
supabase:masterfrom
jeffreywescott:fix/notification-templates-siteurl

Conversation

@jeffreywescott
Copy link
Copy Markdown
Contributor

Summary

The seven notification mail builders (PasswordChanged, EmailChanged, PhoneChanged, IdentityLinked, IdentityUnlinked, MFAFactorEnrolled, MFAFactorUnenrolled) omitted SiteURL from their template data maps, so templates referencing {{ .SiteURL }} render an empty string at runtime. The standard mail builders (Invite, Confirmation, Recovery, MagicLink, EmailChange, Reauthentication) already include it, and checkDefaults in template.go already whitelists SiteURL for all template types — so this looks like an oversight from when notification templates were added, not an intentional restriction.

Closes #2468

Test plan

  • go build ./... passes
  • go test ./internal/mailer/templatemailer/... passes
  • gofmt clean

The seven notification mail builders (PasswordChanged, EmailChanged,
PhoneChanged, IdentityLinked, IdentityUnlinked, MFAFactorEnrolled,
MFAFactorUnenrolled) omitted SiteURL from their template data maps,
so templates referencing {{ .SiteURL }} rendered an empty string at
runtime. The standard mail builders (Invite, Confirmation, Recovery,
MagicLink, EmailChange, Reauthentication) already include it, and
checkDefaults whitelists SiteURL for all template types, so this was
an oversight rather than an intentional restriction.

Closes supabase#2468
@jeffreywescott jeffreywescott requested a review from a team as a code owner May 15, 2026 17:13
@vonschappler
Copy link
Copy Markdown

@jeffreywescott - ty for hopping in... someone else has dropped in, but they were ignored - i just hope that the same does not happens with you, because i'm tired of "hacking" for things to work (and not all the hacks work as expected, and this is draining me up!)

@cstockton
Copy link
Copy Markdown
Contributor

@jeffreywescott @vonschappler Thanks for taking the time to point this out and apologies for the delay, I'll get this merged soon as the tests pass.

cstockton pushed a commit to supabase/supabase that referenced this pull request May 26, 2026
This will make email templates more consistent and may be merged
after supabase/auth#2532 is deployed.
Copy link
Copy Markdown
Contributor

@cstockton cstockton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thank you!

@cstockton
Copy link
Copy Markdown
Contributor

This will be available to use inside templates immediately after the next auth release. However it will not show up in the dashboard template editor until supabase/supabase#46393 is merged, which must be done after the auth release.

@cstockton cstockton merged commit dc015da into supabase:master May 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go lang variables such as {{.SiteUrl}} not being gobally exposed to all email templates

3 participants