From: Nicolas Iooss Date: Tue, 20 Aug 2013 11:47:46 +0000 (+0200) Subject: NL bounces: accept final-recipient starting with LOCAL; in findAddressInBounce X-Git-Tag: xorg/1.1.9~11 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8c9c7d77b0b064bc2b66bafeeeb5140ed1feef16;p=platal.git NL bounces: accept final-recipient starting with LOCAL; in findAddressInBounce Signed-off-by: Nicolas Iooss --- diff --git a/bin/newsletter.bounces.processor.py b/bin/newsletter.bounces.processor.py index 18f0cc7..b17d945 100755 --- a/bin/newsletter.bounces.processor.py +++ b/bin/newsletter.bounces.processor.py @@ -123,6 +123,8 @@ def findSubject(message): _recipient_re = re.compile(r'^rfc822; ?(.+)$', re.I | re.U) +# Some MTA set the Final-Recipient with "LOCAL;" instead of "rfc822;" +_recipient_re2 = re.compile(r'^local; ?(.+)$', re.I | re.U) def findAddressInBounce(bounce): @@ -156,8 +158,11 @@ def findAddressInBounce(bounce): # Extract the faulty email address recipient_match = _recipient_re.search(content['Final-Recipient']) if recipient_match is None: - print('! Missing final recipient.') - return None + # Be nice, test another regexp + recipient_match = _recipient_re2.search(content['Final-Recipient']) + if recipient_match is None: + print('! Missing final recipient.') + return None email = recipient_match.group(1) # Check the action field if content['Action'].lower() != 'failed':