mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.5.x] Fixed #19134 -- Allowed closing smtp backend when the server is stopped
Thanks Sebastian Noack for the report and the initial patch.
Backport of 1b3f832ab7 from master.
This commit is contained in:
@@ -63,9 +63,10 @@ class EmailBackend(BaseEmailBackend):
|
||||
try:
|
||||
try:
|
||||
self.connection.quit()
|
||||
except socket.sslerror:
|
||||
except (socket.sslerror, smtplib.SMTPServerDisconnected):
|
||||
# This happens when calling quit() on a TLS connection
|
||||
# sometimes.
|
||||
# sometimes, or when the connection was already disconnected
|
||||
# by the server.
|
||||
self.connection.close()
|
||||
except:
|
||||
if self.fail_silently:
|
||||
|
||||
Reference in New Issue
Block a user