return None
email = recipient_match.group(1)
# Check the action field
- if content['Action'].lower() != 'failed':
+ if content['Action'].lower().strip() != 'failed':
print('! Not a failed action (%s).' % content['Action'])
return None
failure_hints = [
"insufficient system storage",
"mailbox full",
+ "mailbox recipient does not have a mailbox database",
+ "over quota",
"requested action aborted: local error in processing",
"user unknown",
]
"I'm sorry to have to inform you that your message could not",
"I wasn't able to deliver your message",
"try to send your message again at a later time",
+ "User unknown in local recipient table",
"> was undeliverable.",
"we were unable to deliver your message",
]
permanent_error_hints = [
"Delivery to the following recipient failed permanently",
"failed due to an unavailable mailbox",
+ "following addresses had permanent fatal errors",
"I'm sorry to have to inform you that your message could not",
+ "The email account that you tried to reach does not exist",
"This is a permanent error",
"Unknown address error",
"unreachable for too long",
# Additionnal checks, just to be sure
elif message['From'] != 'MAILER-DAEMON@polytechnique.org (Mail Delivery System)' \
or message['Subject'] != 'Undelivered Mail Returned to Sender':
- print('! Not an usual direct bounce (From="%s", Subject="%s").' % (message['From'], message['Subject']))
+ print('! Not an usual direct bounce (From=%r, Subject=%r).' % (message['From'], message['Subject']))
else:
email = findAddressInBounce(message)
if email is not None:
# 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: