From 22e6179ddc97bdddb560d866f75bd39f1d82b014 Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 24 Apr 2025 15:21:23 +0200 Subject: [PATCH] Quit SMTP connection on failed login --- emails/backend/smtp/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emails/backend/smtp/client.py b/emails/backend/smtp/client.py index f6d41e4..a15ee62 100644 --- a/emails/backend/smtp/client.py +++ b/emails/backend/smtp/client.py @@ -25,7 +25,11 @@ def __init__(self, parent, **kwargs): SMTP.__init__(self, **kwargs) - self.initialize() + try: + self.initialize() + except smtplib.SMTPAuthenticationError: + self.quit() + raise def initialize(self):