Skip to content

Commit

Permalink
Add timeout for establishing smtp connection
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Sep 5, 2024
1 parent d2fec06 commit 0cb613e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ns/adapters/outbound/smtp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, *, config: SmtpClientConfig):
@contextmanager
def get_connection(self) -> Generator[SMTP, None, None]:
"""Establish a connection to the SMTP server"""
with SMTP(self._config.smtp_host, self._config.smtp_port) as server:
with SMTP(self._config.smtp_host, self._config.smtp_port, timeout=60) as server:
yield server

def send_email_message(self, message: EmailMessage):
Expand Down

0 comments on commit 0cb613e

Please sign in to comment.