commit 80371ae66a6c62e1a1d18e5fd123729925a88b4d Author: Cecylia Bocovich cohosh@torproject.org Date: Sun Mar 7 19:09:06 2021 -0500
Remove all requests that cause exceptions from db
This solves gettor#77 where a non-ascii email address was causing our SMTP client to throw an error. We need to remove the request from the database in order to move on and process the rest of the requests. --- gettor/services/email/sendmail.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/gettor/services/email/sendmail.py b/gettor/services/email/sendmail.py index 96113eb..869373d 100644 --- a/gettor/services/email/sendmail.py +++ b/gettor/services/email/sendmail.py @@ -231,13 +231,11 @@ class Sendmail(object): )
except smtp.SMTPClientError as e: - if e.code == 501: # Bad recipient address syntax - yield self.conn.remove_request( - id=id, service="email", date=date - ) - log.error( - strings.redact_emails("Error sending email:{}.".format(e)) - ) + yield self.conn.remove_request( + id=id, service="email", date=date + ) + log.error(strings.redact_emails( + "Error sending email to {}:{}.".format(id, e)))
except Exception as e: log.error(
tor-commits@lists.torproject.org