feat(email): every email Minstrel sends uses one layout (#8150)

The password reset, the new-music and activity summaries and the SMTP
test message each drew their own page; the test message had no layout
at all. They now share internal/mailer's layout: the Minstrel name at
the top, the email's heading and message on a card in the design
system's dark theme, and a footer saying which server sent it and why,
signed "— Minstrel", with the notification-settings link on the
summaries. A plain-text body in the same frame goes alongside.

An email supplies only its content templates and a Frame (heading,
server, reason). Links, buttons and quiet text take named styles from
the layout ({{style "link"}}), so colours change in one place; an
unknown style name fails the render. The SMTP test message is a
template now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 10:27:16 -05:00
co-authored by Claude Opus 5.5
parent a18d5aaa11
commit bae3421057
14 changed files with 331 additions and 113 deletions
+6 -3
View File
@@ -120,9 +120,12 @@ func (h *handlers) handleTestSMTPConfig(w http.ResponseWriter, r *http.Request)
defer cancel()
sender := mailer.NewSMTPSender(h.pool, h.logger)
textBody := "This is a test message from your Minstrel server.\n\nIf you got this, your SMTP config is working.\n\n— Minstrel"
htmlBody := "<p>This is a test message from your Minstrel server.</p><p>If you got this, your SMTP config is working.</p><p>— Minstrel</p>"
if err := sender.Send(ctx, *caller.Email, "Minstrel SMTP test", textBody, htmlBody); err != nil {
textBody, htmlBody, err := mailer.RenderSMTPTestEmail(h.netSettings.PublicURL())
if err != nil {
writeErrWithLog(w, h.logger, "admin smtp: render test email failed", apierror.Internal(err))
return
}
if err := sender.Send(ctx, *caller.Email, mailer.SMTPTestSubject, textBody, htmlBody); err != nil {
if errors.Is(err, mailer.ErrNotConfigured) {
writeErr(w, apierror.BadRequest("not_configured",
"SMTP is not enabled or required fields are empty"))
+1
View File
@@ -117,6 +117,7 @@ func (h *handlers) sendResetEmail(ctx context.Context, user dbq.User) error {
Username: user.Username,
ResetURL: resetURL,
ExpiryHours: int(resetTokenTTL.Hours()),
Server: h.netSettings.PublicURL(),
})
if err != nil {
return err