diff --git a/authentik/events/models.py b/authentik/events/models.py index 8fcfe3b3a..2e5875f46 100644 --- a/authentik/events/models.py +++ b/authentik/events/models.py @@ -282,7 +282,7 @@ class NotificationTransport(models.Model): try: # pyright: reportGeneralTypeIssues=false return send_mail(mail.__dict__) # pylint: disable=no-value-for-parameter - except (SMTPException, ConnectionError) as exc: + except (SMTPException, ConnectionError, OSError) as exc: raise NotificationTransportError from exc def __str__(self) -> str: diff --git a/authentik/stages/email/tasks.py b/authentik/stages/email/tasks.py index 0c62ab511..84cb73134 100644 --- a/authentik/stages/email/tasks.py +++ b/authentik/stages/email/tasks.py @@ -31,6 +31,7 @@ def send_mails(stage: EmailStage, *messages: list[EmailMultiAlternatives]): autoretry_for=( SMTPException, ConnectionError, + OSError, ), retry_backoff=True, base=MonitoredTask, @@ -44,7 +45,7 @@ def send_mail( self.set_uid(slugify(message_id.replace(".", "_").replace("@", "_"))) try: if not email_stage_pk: - stage: EmailStage = EmailStage() + stage: EmailStage = EmailStage(use_global_settings=True) else: stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk) backend = stage.backend