perf: 优化邮件参数

pull/10998/head
halo 2023-07-17 22:13:58 +08:00 committed by Bryan
parent be17fe6c31
commit 6338ecc6fe
2 changed files with 2 additions and 7 deletions

View File

@ -78,9 +78,7 @@ class SendAndVerifyCodeUtil(object):
def __send_with_email(self):
subject = self.other_args.get('subject')
message = self.other_args.get('message')
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
send_mail_async.delay(subject, message, from_email, [self.target], html_message=message)
send_mail_async(subject, message, [self.target], html_message=message)
def __send(self, code):
"""

View File

@ -1,4 +1,3 @@
from django.conf import settings
from common.tasks import send_mail_async
from .base import BackendBase
@ -8,10 +7,8 @@ class Email(BackendBase):
is_enable_field_in_settings = 'EMAIL_HOST_USER'
def send_msg(self, users, message, subject):
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
accounts, __, __ = self.get_accounts(users)
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
send_mail_async(subject, message, from_email, accounts, html_message=message)
send_mail_async(subject, message, accounts, html_message=message)
backend = Email