Commit b641357a authored by Claude Paroz's avatar Claude Paroz
Browse files

[1.5.x] Replaced deprecated sslerror by ssl.SSLError

The exact conditions on which this exception is raised are not
known, but this replacement is the best guess we can do at this
point.
Backport of 850630b4 from master.
parent 5b8c0d22
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
"""SMTP email backend class."""
import smtplib
import socket
import ssl
import threading

from django.conf import settings
@@ -65,7 +65,7 @@ class EmailBackend(BaseEmailBackend):
        try:
            try:
                self.connection.quit()
            except (socket.sslerror, smtplib.SMTPServerDisconnected):
            except (ssl.SSLError, smtplib.SMTPServerDisconnected):
                # This happens when calling quit() on a TLS connection
                # sometimes, or when the connection was already disconnected
                # by the server.