Add unsubscribe link to opt-in confirmation e-mail. Closes #573.

This commit is contained in:
Kailash Nadh 2022-01-15 16:41:48 +05:30
parent 28efe27cbe
commit 3f026090ca
2 changed files with 3 additions and 0 deletions

View file

@ -65,6 +65,7 @@ type subOptin struct {
*models.Subscriber
OptinURL string
UnsubURL string
Lists []models.List
}
@ -830,6 +831,7 @@ func sendOptinConfirmation(sub models.Subscriber, listIDs []int64, app *App) (in
qListIDs.Add("l", l.UUID)
}
out.OptinURL = fmt.Sprintf(app.constants.OptinURL, sub.UUID, qListIDs.Encode())
out.UnsubURL = fmt.Sprintf(app.constants.UnsubURL, dummyUUID, sub.UUID)
// Send the e-mail.
if err := app.sendNotification([]string{sub.Email},

View file

@ -16,6 +16,7 @@
<p>
<a href="{{ .OptinURL }}" class="button">{{ L.Ts "email.optin.confirmSub" }}</a>
</p>
<a href="{{ .UnsubURL }}">{{ L.T "email.unsub" }}</a>
{{ template "footer" }}
{{ end }}