emails: Reject sending emails with header parse errors.

Thanks to Jordan Milne (/u/largenocream) for
backing up our email queues^W^W^W^W^W bringing this to our attention. ;)
This commit is contained in:
Max Goodman
2014-02-27 17:57:03 -08:00
parent 5cb1f2e68d
commit d59c209c56

View File

@@ -21,6 +21,7 @@
###############################################################################
from email.MIMEText import MIMEText
from email.errors import HeaderParseError
import datetime
import traceback, sys, smtplib
@@ -177,7 +178,7 @@ def send_queued_mail(test = False):
email.set_sent(rejected = False)
# exception happens only for local recipient that doesn't exist
except (smtplib.SMTPRecipientsRefused, smtplib.SMTPSenderRefused,
UnicodeDecodeError, AttributeError):
UnicodeDecodeError, AttributeError, HeaderParseError):
# handle error and print, but don't stall the rest of the queue
print "Handled error sending mail (traceback to follow)"
traceback.print_exc(file = sys.stdout)