feat(backend): Add one-click unsubscribe endpoints
This commit is contained in:
parent
c44dac26ec
commit
61f111fc8d
6 changed files with 93 additions and 11 deletions
|
@ -113,11 +113,13 @@ const send = async (test = true) => {
|
|||
|
||||
for (let sub of subscribers[lang]) {
|
||||
if (l > 0) {
|
||||
const unsubGet = `https://freesewing.org${
|
||||
lang === 'en' ? '/' : '/' + lang + '/'
|
||||
}newsletter/unsubscribe?x=${sub.ehash}`
|
||||
const unsubPost = `https://backend3.freesewing.org/ocunsub/${sub.ehash}`
|
||||
const body = mustache.render(template, {
|
||||
...i18n[lang],
|
||||
unsubscribe: `https://freesewing.org${
|
||||
lang === 'en' ? '/' : '/' + lang + '/'
|
||||
}newsletter/unsubscribe?x=${sub.ehash}`,
|
||||
unsubscribe: unsubGet,
|
||||
content,
|
||||
})
|
||||
console.log(`[${lang}] ${l}/${subs} (${i}) Sending to ${sub.email}`)
|
||||
|
@ -141,6 +143,16 @@ const send = async (test = true) => {
|
|||
Charset: 'utf-8',
|
||||
Data: i18n[lang].title,
|
||||
},
|
||||
Headers: [
|
||||
{
|
||||
Name: 'List-Unsubscribe',
|
||||
Value: unsubPost,
|
||||
},
|
||||
{
|
||||
Name: 'List-Unsubscribe-Post',
|
||||
Value: 'List-Unsubscribe=One-Click',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Destination: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue