Skip to content

Catch all exceptions during SMTP client initialization, not just SMTPAuthenticationError #179

@lavr

Description

@lavr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions