Skip to content

Commit 22e6179

Browse files
committed
Quit SMTP connection on failed login
1 parent 906bd5d commit 22e6179

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

emails/backend/smtp/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ def __init__(self, parent, **kwargs):
2525

2626
SMTP.__init__(self, **kwargs)
2727

28-
self.initialize()
28+
try:
29+
self.initialize()
30+
except smtplib.SMTPAuthenticationError:
31+
self.quit()
32+
raise
2933

3034

3135
def initialize(self):

0 commit comments

Comments
 (0)