Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
85782e87 by Mark Sapiro at 2021-08-30T22:02:53-07:00
VERPed vacation responses and similar are no longer scored as bounces.

- - - - -
34730d84 by Mark Sapiro at 2021-08-31T13:53:19+00:00
Merge branch 'bounce' into 'master'

VERPed vacation responses and similar are no longer scored as bounces.

Closes #939

See merge request mailman/mailman!913
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/runners/bounce.py
- src/mailman/runners/tests/test_bounce.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -104,6 +104,8 @@ Bugs
   without specifying policy.  (Closes #934)
 * Improve error message from REST API for invalid email address (Fixes #872)
 * Nonmember posts gated from usenet bypass nonmember moderation.  (Closes #937)
+* VERPed vacation responses and similar are no longer scored as bounces.
+  (Closes #939)
 
 Command line
 ------------


=====================================
src/mailman/runners/bounce.py
=====================================
@@ -51,13 +51,18 @@ class BounceRunner(Runner):
         addresses = StandardVERP().get_verp(mlist, msg)
         if len(addresses) > 0:
             # Scan the message to see if it contained permanent or temporary
-            # failures.  We'll ignore temporary failures, but even if there
-            # are no permanent failures, we'll assume VERP bounces are
-            # permanent.
+            # failures.  We'll ignore temporary failures, and if there
+            # are no permanent failures, we'll assume this is a vacation
+            # response or similar.
             temporary, permanent = all_failures(msg)
             if len(temporary) > 0:
                 # This was a temporary failure, so just ignore it.
                 return False
+            if len(permanent) == 0:
+                log.info('VERPed bounce message but not a recognized DSN: %s',
+                         msg.get('message-id', 'n/a'))
+                maybe_forward(mlist, msg)
+                return False
         else:
             # See if this was a probe message.
             addresses = ProbeVERP().get_verp(mlist, msg)


=====================================
src/mailman/runners/tests/test_bounce.py
=====================================
@@ -58,7 +58,16 @@ class TestBounceRunner(unittest.TestCase):
 From: mail-dae...@example.com
 To: test-bounces+anne=example....@example.com
 Message-Id: <first>
+Content-Type: multipart/report; report-type=delivery-status; boundary=AAA
+MIME-Version: 1.0
+
+--AAA
+Content-Type: message/delivery-status
 
+Action: fail
+Original-Recipient: rfc822; a...@example.com
+
+--AAA--
 """)
         self._msgdata = dict(listid='test.example.com')
         self._processor = getUtility(IBounceProcessor)
@@ -92,6 +101,21 @@ Message-Id: <first>
         self.assertEqual(events[0].context, BounceContext.normal)
         self.assertEqual(events[0].processed, True)
 
+    def test_verp_non_dsn(self):
+        # A VERPed non DSN (vacation response) is not scored.
+        nondsn = message_from_string("""\
+From: mail-dae...@example.com
+To: test-bounces+anne=example....@example.com
+Message-Id: <first>
+
+I'm out of the office.
+""")
+        self._bounceq.enqueue(nondsn, self._msgdata)
+        self._runner.run()
+        get_queue_messages('bounces', expected_count=0)
+        events = list(self._processor.events)
+        self.assertEqual(len(events), 0)
+
     def test_nonfatal_verp_detection(self):
         # A VERPd bounce was received, but the error was nonfatal.
         nonfatal = message_from_string("""\



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/66a852fe496289f781c6251827f9cd12f75d3928...34730d8486e7a71e60592ba76beced6bc98adc64

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/66a852fe496289f781c6251827f9cd12f75d3928...34730d8486e7a71e60592ba76beced6bc98adc64
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to