Revision f46f80e4
Added by Serghei Mihai about 7 years ago
corbo/utils.py | ||
---|---|---|
60 | 60 |
'identifier': dest}) |
61 | 61 |
unsubscribe_link = urlparse.urljoin(settings.SITE_BASE_URL, reverse( |
62 | 62 |
'unsubscribe', kwargs={'unsubscription_token': unsubscribe_token})) |
63 |
message.set_headers({'List-Unsubscribe': '<%s>' % unsubscribe_link}) |
|
63 | 64 |
message.html = orig_html.replace(UNSUBSCRIBE_LINK_PLACEHOLDER, unsubscribe_link) |
64 | 65 |
message.text = orig_text.replace(UNSUBSCRIBE_LINK_PLACEHOLDER, unsubscribe_link) |
65 | 66 |
|
tests/test_emailing.py | ||
---|---|---|
134 | 134 |
index = i*subscriptions_number+counter |
135 | 135 |
signature = urllib.unquote(re.findall('/unsubscribe/(.*)"', mail.outbox[index].html)[0]) |
136 | 136 |
unsubscription_link = reverse('unsubscribe', kwargs={'unsubscription_token': signature}) |
137 |
assert mail.outbox[index]._headers['List-Unsubscribe'] == '<http://localhost%s>' % unsubscription_link |
|
137 | 138 |
assert unsubscription_link in mail.outbox[index].html |
138 | 139 |
assert unsubscription_link in mail.outbox[index].text |
139 | 140 |
assert unsubscription_link_sentinel != unsubscription_link |
Also available in: Unified diff
add unsubscription link in mail headers (#19579)