Skip to content

Commit

Permalink
Add unsubscribe link to opt-in confirmation e-mail. Closes #573.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jan 15, 2022
1 parent 28efe27 commit 3f02609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/subscribers.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type subOptin struct {
*models.Subscriber

OptinURL string
UnsubURL string
Lists []models.List
}

Expand Down Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions static/email-templates/subscriber-optin.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ <h2>{{ L.Ts "email.optin.confirmSubTitle" }}</h2>
<p>
<a href="{{ .OptinURL }}" class="button">{{ L.Ts "email.optin.confirmSub" }}</a>
</p>
<a href="{{ .UnsubURL }}">{{ L.T "email.unsub" }}</a>

{{ template "footer" }}
{{ end }}

0 comments on commit 3f02609

Please sign in to comment.