2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 22:05:52 +08:00
discourse/app/mailers
Régis Hanol 3e5727b76b
FEATURE: Add recipient_username interpolation key for email templates (#38096)
Admins customizing email templates had no way to reference the username
of the person receiving the email. The existing `%{username}` key refers
to the post author, not the recipient.

Pass the recipient user object through `build_email` via a new
`recipient_user` option across all mailer paths (notifications, account
emails, digest, token-based emails). `Email::MessageBuilder` then
extracts `recipient_username` into template args when present. The key
is also added to `ALLOWED_CUSTOM_INTERPOLATION_KEYS` so it appears in
the admin email template editor and passes validation.

Not available for invite emails since the recipient has no account yet.

Ref - t/172375
2026-02-27 17:18:02 +01:00
..
admin_confirmation_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
download_backup_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
group_smtp_mailer.rb UX: improve sender name in emails (#36974) 2026-01-06 15:41:01 +04:00
invite_mailer.rb UX: add modifier to customize invite template (#35458) 2025-10-27 11:58:58 -04:00
rejection_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
subscription_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
test_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
user_notifications.rb FEATURE: Add recipient_username interpolation key for email templates (#38096) 2026-02-27 17:18:02 +01:00
version_mailer.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00