In #173 we added a quit() call when SMTPAuthenticationError is raised during SMTP client initialization. However, initialize() can also fail on starttls() or ehlo_or_helo_if_needed(), leaving the connection open.
Consider broadening the except clause to Exception to ensure the connection is always cleaned up on any initialization failure.
https://github.com/lavr/python-emails/blob/master/emails/backend/smtp/client.py#L28-L32
In #173 we added a
quit()call whenSMTPAuthenticationErroris raised during SMTP client initialization. However,initialize()can also fail onstarttls()orehlo_or_helo_if_needed(), leaving the connection open.Consider broadening the
exceptclause toExceptionto ensure the connection is always cleaned up on any initialization failure.https://github.com/lavr/python-emails/blob/master/emails/backend/smtp/client.py#L28-L32