NL bounces: no longer crash on messages without a From header
authorNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Sun, 26 Jan 2014 19:16:29 +0000 (20:16 +0100)
committerNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Mon, 3 Feb 2014 20:08:42 +0000 (21:08 +0100)
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
bin/newsletter.bounces.processor.py

index e55251a..6546e88 100755 (executable)
@@ -609,8 +609,8 @@ class DeliveryStatusNotificationFilter(MboxFilter):
 
         # Detect ill-formatted reports, sent as plain text email
         if report_message.get_content_type() == 'text/plain' and (
-            'MAILER-DAEMON@' in message['From'].upper() or
-            'mail delivery failure' == message['Subject'].lower()
+            'MAILER-DAEMON@' in message.get('From', '').upper() or
+            'mail delivery failure' == message.get('Subject', '').lower()
             ):
             email = findAddressInPlainBounce(report_message)
             if email is not None: