Permalink
Browse files

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. ;)
  • Loading branch information...
1 parent 5cb1f2e commit d59c209c562292eb19f21eb11ffe7a366c839b3c @chromakode chromakode committed Feb 28, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 r2/r2/lib/emailer.py
@@ -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 sendmail(email):
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)

0 comments on commit d59c209

Please sign in to comment.