diff --git a/cmd/subscribers.go b/cmd/subscribers.go index 6a85478..1d77ec4 100644 --- a/cmd/subscribers.go +++ b/cmd/subscribers.go @@ -895,8 +895,21 @@ func makeOptinNotifyHook(unsubHeader bool, u *UrlConfig, q *models.Queries, i *i hdr.Set("List-Unsubscribe", `<`+unsubURL+`>`) } + // Build the subject with public list names. Private list names are + // not leaked in the subject, mirroring the e-mail body. + var pubNames []string + for _, l := range out.Lists { + if l.Type == models.ListTypePublic { + pubNames = append(pubNames, l.Name) + } + } + subject := i.T("subscribers.optinSubject") + if len(pubNames) > 0 { + subject = i.Ts("subscribers.optinSubjectList", "name", strings.Join(pubNames, ", ")) + } + // Send the e-mail. - if err := notifs.Notify([]string{sub.Email}, i.T("subscribers.optinSubject"), notifs.TplSubscriberOptin, out, hdr); err != nil { + if err := notifs.Notify([]string{sub.Email}, subject, notifs.TplSubscriberOptin, out, hdr); err != nil { lo.Printf("error sending opt-in e-mail for subscriber %d (%s): %s", sub.ID, sub.UUID, err) return 0, err } diff --git a/i18n/en.json b/i18n/en.json index 3a52b9a..dfe24b3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -617,6 +617,7 @@ "subscribers.newSubscriber": "New subscriber", "subscribers.numSelected": "{num} subscriber(s) selected", "subscribers.optinSubject": "Confirm subscription", + "subscribers.optinSubjectList": "Confirm subscription to {name}", "subscribers.preconfirm": "Preconfirm subscriptions", "subscribers.preconfirmHelp": "Don't send opt-in e-mails and mark all list subscriptions as 'subscribed'.", "subscribers.query": "Query", diff --git a/static/email-templates/base.html b/static/email-templates/base.html index f7ff0aa..7b1a9d4 100644 --- a/static/email-templates/base.html +++ b/static/email-templates/base.html @@ -8,63 +8,87 @@ - +
 
@@ -88,7 +112,7 @@ {{ define "footer" }}
- +