From: Nicolas Iooss Date: Sat, 12 Oct 2013 10:45:36 +0000 (+0200) Subject: NL bounces: add known subjects and messages in findAddressInPlainBounce X-Git-Tag: xorg/1.1.9~5 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fa7bc0304e3139ffeef5d7e4563694c82e4964af;p=platal.git NL bounces: add known subjects and messages in findAddressInPlainBounce Signed-off-by: Nicolas Iooss --- diff --git a/bin/newsletter.bounces.processor.py b/bin/newsletter.bounces.processor.py index 95d80f4..95110b9 100755 --- a/bin/newsletter.bounces.processor.py +++ b/bin/newsletter.bounces.processor.py @@ -208,11 +208,14 @@ def findAddressInPlainBounce(bounce): print('! Not a valid plain bounce (expected text/plain, found %s).' % bounce.get_content_type()) return None subject = findSubject(bounce).lower() - if (subject != 'failure notice' - and subject != 'undeliverable message' - and not subject.startswith('mail delivery failed') - and subject != 'delivery status notification (failure)'): - + known_subjects = [ + "delivery status notification (failure)", + "failure notice", + "returned mail: see transcript for details", + "undeliverable message", + "undelivered mail returned to sender", + ] + if subject not in known_subjects and not subject.startswith('mail delivery failed'): print('! Not a valid plain bounce (unknown subject: %s).' % subject) return None @@ -232,6 +235,7 @@ def findAddressInPlainBounce(bounce): # The following message to was undeliverable. non_delivery_hints = [ "Delivery to the following recipient failed permanently", + "I'm sorry to have to inform you that your message could not", "I wasn't able to deliver your message", "> was undeliverable.", "could not be delivered to", @@ -247,6 +251,7 @@ def findAddressInPlainBounce(bounce): # 5.1.0 - Unknown address error 550-'email@example.com... No such user' permanent_error_hints = [ "Delivery to the following recipient failed permanently", + "I'm sorry to have to inform you that your message could not", "This is a permanent error", "Unknown address error", "550 Requested action not taken",