Loading django/core/mail/backends/smtp.py +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class EmailBackend(BaseEmailBackend): self.connection.ehlo() if self.username and self.password: self.connection.login(self.username, self.password) return True except smtplib.SMTPException: if not self.fail_silently: raise Loading tests/mail/tests.py +10 −0 Original line number Diff line number Diff line Loading @@ -894,6 +894,16 @@ class SMTPBackendTests(BaseEmailBackendTests, SimpleTestCase): self.assertRaisesMessage(SMTPException, 'SMTP AUTH extension not supported by server.', backend.open) def test_server_open(self): """ Test that open() tells us whether it opened a connection. """ backend = smtp.EmailBackend(username='', password='') self.assertFalse(backend.connection) opened = backend.open() backend.close() self.assertTrue(opened) def test_server_stopped(self): """ Test that closing the backend while the SMTP server is stopped doesn't Loading Loading
django/core/mail/backends/smtp.py +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ class EmailBackend(BaseEmailBackend): self.connection.ehlo() if self.username and self.password: self.connection.login(self.username, self.password) return True except smtplib.SMTPException: if not self.fail_silently: raise Loading
tests/mail/tests.py +10 −0 Original line number Diff line number Diff line Loading @@ -894,6 +894,16 @@ class SMTPBackendTests(BaseEmailBackendTests, SimpleTestCase): self.assertRaisesMessage(SMTPException, 'SMTP AUTH extension not supported by server.', backend.open) def test_server_open(self): """ Test that open() tells us whether it opened a connection. """ backend = smtp.EmailBackend(username='', password='') self.assertFalse(backend.connection) opened = backend.open() backend.close() self.assertTrue(opened) def test_server_stopped(self): """ Test that closing the backend while the SMTP server is stopped doesn't Loading