stages/email: fix make_msgid call

This commit is contained in:
Jens Langhammer 2020-10-16 16:07:59 +02:00
parent 2339e855bb
commit c49b57ad1d
1 changed files with 2 additions and 3 deletions

View File

@ -35,8 +35,7 @@ def send_mails(stage: EmailStage, *messages: List[EmailMultiAlternatives]):
base=MonitoredTask, base=MonitoredTask,
) )
def send_mail(self: MonitoredTask, email_stage_pk: int, message: Dict[Any, Any]): def send_mail(self: MonitoredTask, email_stage_pk: int, message: Dict[Any, Any]):
"""Send Email according to EmailStage parameters from background worker. """Send Email for Email Stage. Retries are scheduled automatically."""
Automatically retries if message couldn't be sent."""
self.save_on_success = False self.save_on_success = False
try: try:
stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk) stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk)
@ -49,7 +48,7 @@ def send_mail(self: MonitoredTask, email_stage_pk: int, message: Dict[Any, Any])
setattr(message_object, key, value) setattr(message_object, key, value)
message_object.from_email = stage.from_address message_object.from_email = stage.from_address
# Because we use the Message-ID as UID for the task, manually assign it # Because we use the Message-ID as UID for the task, manually assign it
message_id = make_msgid(DNS_NAME) message_id = make_msgid(domain=DNS_NAME)
message_object.extra_headers["Message-ID"] = message_id message_object.extra_headers["Message-ID"] = message_id
LOGGER.debug("Sending mail", to=message_object.to) LOGGER.debug("Sending mail", to=message_object.to)