diff --git a/hc/accounts/models.py b/hc/accounts/models.py index cb0cb3a2..036ade35 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -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, diff --git a/hc/api/tests/test_notify.py b/hc/api/tests/test_notify.py index b195ac53..99cf092d 100644 --- a/hc/api/tests/test_notify.py +++ b/hc/api/tests/test_notify.py @@ -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} diff --git a/hc/api/tests/test_sendreports.py b/hc/api/tests/test_sendreports.py index 22a49f4e..0ddc4e49 100644 --- a/hc/api/tests/test_sendreports.py +++ b/hc/api/tests/test_sendreports.py @@ -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) diff --git a/hc/api/transports.py b/hc/api/transports.py index 4d3cef91..7f53cff9 100644 --- a/hc/api/transports.py +++ b/hc/api/transports.py @@ -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