perf: 异步发送

This commit is contained in:
halo
2023-07-17 14:54:30 +08:00
committed by Bryan
parent 27c10fcae1
commit a18c97aec0
2 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,5 @@
from django.conf import settings
from django.core.mail import send_mail
from common.tasks import send_mail_async
from .base import BackendBase
@@ -12,7 +11,7 @@ class Email(BackendBase):
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
accounts, __, __ = self.get_accounts(users)
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
send_mail(subject, message, from_email, accounts, html_message=message)
send_mail_async.delay(subject, message, from_email, accounts, html_message=message)
backend = Email