From 5b8c0d22cc07ca727c032edf3309fab9cb39f21d Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 3 Jan 2013 20:41:45 +0100 Subject: [1.5.x] Fixed #19382 -- Stopped smtp backend raising exception when already closed Thanks Sebastian Noack for the report and the initial patch. Backport of ffa50ca35 from master. --- django/core/mail/backends/smtp.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django') diff --git a/django/core/mail/backends/smtp.py b/django/core/mail/backends/smtp.py index baffa8f2df..3ae08f4340 100644 --- a/django/core/mail/backends/smtp.py +++ b/django/core/mail/backends/smtp.py @@ -60,6 +60,8 @@ class EmailBackend(BaseEmailBackend): def close(self): """Closes the connection to the email server.""" + if self.connection is None: + return try: try: self.connection.quit() -- cgit v1.3