From 66778c53a61f9c09fa5d1c7bb3d2e8866f8a246c Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Fri, 18 Dec 2020 12:04:50 -0800 Subject: Added recognition for a non-compliant DSN from an unknown MTA. --- Mailman/Bouncers/SimpleMatch.py | 4 ++++ tests/bounces/simple_44.txt | 28 ++++++++++++++++++++++++++++ tests/test_bounces.py | 1 + 3 files changed, 33 insertions(+) create mode 100644 tests/bounces/simple_44.txt diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index 6de9a858..b7889d21 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -199,6 +199,10 @@ PATTERNS = [ (_c(r'wasn\'t able to deliver the following message'), _c(r'---Below this line is a copy of the message.'), _c(r'To: (?P[^\s@]+@[^\s@]+)')), + # From some unknown MTA + (_c(r'This is a delivery failure notification message'), + _c(r'The problem appears to be'), + _c(r'-- (?P[^\s@]+@[^\s@]+)')), # Next one goes here... ] diff --git a/tests/bounces/simple_44.txt b/tests/bounces/simple_44.txt new file mode 100644 index 00000000..832ca5f9 --- /dev/null +++ b/tests/bounces/simple_44.txt @@ -0,0 +1,28 @@ +Subject: [Postmaster] Email Delivery Failure +Message-Id: <111195647-1608276241173@example.com> +Date: Fri, 18 Dec 2020 09:24:01 +0200 +From: "Mail Delivery System" +To: "dns-operations" +X-Mimecast-Originator: <> +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-MIME-Autoconverted: from quoted-printable to 8bit by example.net id 0BI7O1sk026573 + +This is a delivery failure notification message indicating that +an email dns-operations-bounces@example.net addressed to email address : +-- user@example.com + +With subject Re: [dns-operations] Monitoring for impending expiration of domains? sent on the Mon, 14 Dec 2020 11:30:37 +0100 (CET) +could not be delivered. The problem appears to be : +-- Recipient server unavailable or busy + +Additional information follows : +-- 4.4.4 Temporary server error. Please try again later ATTR5 [VE1EUR02FT049.eop-EUR02.prod.protection.outlook.com] + +This condition occurred after 30 attempt(s) to deliver over +a period of 92 hour(s) and 52 minute(s). + +If you sent the email to multiple recipients, you will receive one +of these messages for each one which failed delivery, otherwise +they have been sent. + diff --git a/tests/test_bounces.py b/tests/test_bounces.py index 3ddde6b6..78527f8b 100644 --- a/tests/test_bounces.py +++ b/tests/test_bounces.py @@ -82,6 +82,7 @@ class BounceTest(unittest.TestCase): ('SimpleMatch', 'simple_38.txt', ['userx@example.com']), ('SimpleMatch', 'simple_39.txt', ['userx@example.ru']), ('SimpleMatch', 'simple_41.txt', ['userx@example.com']), + ('SimpleMatch', 'simple_44.txt', ['user@example.com']), ('SimpleMatch', 'bounce_02.txt', ['userx@example.com']), ('SimpleMatch', 'bounce_03.txt', ['userx@example.uk']), ('SimpleMatch', 'yahoo_12.txt', ['user@yahoo.com']), -- cgit v1.2.3