forked from GithubBackups/healthchecks
Add List-Unsubscribe-Post email header
This commit is contained in:
parent
0addbac7ba
commit
f7496fb8cf
@ -174,7 +174,11 @@ class Profile(models.Model):
|
||||
|
||||
unsub_url = self.reports_unsub_url()
|
||||
|
||||
headers = {"List-Unsubscribe": "<%s>" % unsub_url, "X-Bounce-Url": unsub_url}
|
||||
headers = {
|
||||
"List-Unsubscribe": "<%s>" % unsub_url,
|
||||
"X-Bounce-Url": unsub_url,
|
||||
"List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
|
||||
}
|
||||
|
||||
ctx = {
|
||||
"checks": checks,
|
||||
|
@ -274,6 +274,7 @@ class NotifyTestCase(BaseTestCase):
|
||||
self.assertEqual(email.to[0], "alice@example.org")
|
||||
self.assertTrue("X-Bounce-Url" in email.extra_headers)
|
||||
self.assertTrue("List-Unsubscribe" in email.extra_headers)
|
||||
self.assertTrue("List-Unsubscribe-Post" in email.extra_headers)
|
||||
|
||||
def test_email_transport_handles_json_value(self):
|
||||
payload = {"value": "alice@example.org", "up": True, "down": True}
|
||||
|
@ -46,6 +46,7 @@ class SendReportsTestCase(BaseTestCase):
|
||||
|
||||
email = mail.outbox[0]
|
||||
self.assertTrue("List-Unsubscribe" in email.extra_headers)
|
||||
self.assertTrue("List-Unsubscribe-Post" in email.extra_headers)
|
||||
|
||||
def test_it_obeys_next_report_date(self):
|
||||
self.profile.next_report_date = now() + td(days=1)
|
||||
|
@ -61,7 +61,11 @@ class Email(Transport):
|
||||
|
||||
unsub_link = self.channel.get_unsub_link()
|
||||
|
||||
headers = {"X-Bounce-Url": bounce_url, "List-Unsubscribe": "<%s>" % unsub_link}
|
||||
headers = {
|
||||
"X-Bounce-Url": bounce_url,
|
||||
"List-Unsubscribe": "<%s>" % unsub_link,
|
||||
"List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
|
||||
}
|
||||
|
||||
try:
|
||||
# Look up the sorting preference for this email address
|
||||
|
Loading…
x
Reference in New Issue
Block a user