stages/email: fix email task not falling back to use_global_settings
This commit is contained in:
parent
33f06f0799
commit
2e20d5dfbf
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue