summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/mail/backends/smtp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/core/mail/backends/smtp.py b/django/core/mail/backends/smtp.py
index 4d554a2c42..05006a2b17 100644
--- a/django/core/mail/backends/smtp.py
+++ b/django/core/mail/backends/smtp.py
@@ -41,8 +41,9 @@ class EmailBackend(BaseEmailBackend):
def open(self):
"""
- Ensures we have a connection to the email server. Returns whether or
- not a new connection was required (True or False).
+ Ensure an open connection to the email server. Return whether or not a
+ new connection was required (True or False) or None if an exception
+ passed silently.
"""
if self.connection:
# Nothing to do if the connection is already open.
@@ -102,7 +103,7 @@ class EmailBackend(BaseEmailBackend):
return
with self._lock:
new_conn_created = self.open()
- if not self.connection:
+ if not self.connection or new_conn_created is None:
# We failed silently on open().
# Trying to send would be pointless.
return