Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
3f61fd77 by Mark Sapiro at 2019-08-15T21:45:01Z
Do not report non-VERP temp failure DSNs as unrecognized.
- - - - -
e99fdce9 by Mark Sapiro at 2019-08-15T21:45:01Z
Merge branch 'bounce' into 'master'
Do not report non-VERP temp failure DSNs as unrecognized.
Closes #622
See merge request mailman/mailman!549
- - - - -
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
=====================================
@@ -37,6 +37,8 @@ Bugs
(Closes #614)
* Encoded (base64 or quoted-printable) HTML message bodies are now decoded for
``html_to_plaintext``. (Closes #616)
+* Non-VERPed temporary failure DSNs are no longer reported as unrecognized
+ bounces. (Closes #622)
Command line
------------
=====================================
src/mailman/runners/bounce.py
=====================================
@@ -19,7 +19,7 @@
import logging
-from flufl.bounce import all_failures, scan_message
+from flufl.bounce import all_failures
from mailman.app.bounces import ProbeVERP, StandardVERP, maybe_forward
from mailman.core.runner import Runner
from mailman.interfaces.bounce import BounceContext, IBounceProcessor
@@ -64,11 +64,14 @@ class BounceRunner(Runner):
context = BounceContext.probe
else:
# That didn't give us anything useful, so try the old fashion
- # bounce matching modules. This returns only the permanently
- # failing addresses. Since Mailman currently doesn't score
- # temporary failures, if we get no permanent failures, we're
- # done.s
- addresses = scan_message(msg)
+ # bounce matching modules. Since Mailman currently doesn't
+ # score temporary failures, if we get no permanent failures,
+ # we're done, but we do need to check for temporary failures
+ # to know if the bounce was recognized.
+ temporary, addresses = all_failures(msg)
+ if len(addresses) == 0 and len(temporary) > 0:
+ # This is a recognized temp fail so ignore it.
+ return False
# If that still didn't return us any useful addresses, then send it on
# or discard it. The addresses will come back from flufl.bounce as
# bytes/8-bit strings, but we must store them as unicodes in the
=====================================
src/mailman/runners/tests/test_bounce.py
=====================================
@@ -169,7 +169,10 @@ Original-Recipient: rfc822; [email protected]
def test_nonverp_detectable_nonfatal_bounce(self):
# Here's a bounce that is not VERPd, but which has a bouncing address
# that can be parsed from a known bounce format. The bounce is
- # non-fatal so no bounce event is registered.
+ # non-fatal so no bounce event is registered and the bounce is not
+ # reported as unrecognized.
+ self._mlist.forward_unrecognized_bounces_to = (
+ UnrecognizedBounceDisposition.site_owner)
dsn = message_from_string("""\
From: [email protected]
To: [email protected]
@@ -186,10 +189,15 @@ Original-Recipient: rfc822; [email protected]
--AAA--
""")
self._bounceq.enqueue(dsn, self._msgdata)
+ mark = LogFileMark('mailman.bounce')
self._runner.run()
get_queue_messages('bounces', expected_count=0)
events = list(self._processor.events)
self.assertEqual(len(events), 0)
+ # There should be nothing in the 'virgin' queue.
+ get_queue_messages('virgin', expected_count=0)
+ # There should be nothing logged.
+ self.assertEqual(len(mark.readline()), 0)
def test_no_detectable_bounce_addresses(self):
# A bounce message was received, but no addresses could be detected.
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/9e12b0f79b46c175065d6ba6d20399a48d654ec1...e99fdce9a4ac1c3e1287500e9c1efbde47a58402
--
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/9e12b0f79b46c175065d6ba6d20399a48d654ec1...e99fdce9a4ac1c3e1287500e9c1efbde47a58402
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org