mirror of https://github.com/jumpserver/jumpserver
perf: 优化邮件参数
parent
be17fe6c31
commit
6338ecc6fe
|
@ -78,9 +78,7 @@ class SendAndVerifyCodeUtil(object):
|
||||||
def __send_with_email(self):
|
def __send_with_email(self):
|
||||||
subject = self.other_args.get('subject')
|
subject = self.other_args.get('subject')
|
||||||
message = self.other_args.get('message')
|
message = self.other_args.get('message')
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
send_mail_async(subject, message, [self.target], html_message=message)
|
||||||
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
|
||||||
send_mail_async.delay(subject, message, from_email, [self.target], html_message=message)
|
|
||||||
|
|
||||||
def __send(self, code):
|
def __send(self, code):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.conf import settings
|
|
||||||
from common.tasks import send_mail_async
|
from common.tasks import send_mail_async
|
||||||
from .base import BackendBase
|
from .base import BackendBase
|
||||||
|
|
||||||
|
@ -8,10 +7,8 @@ class Email(BackendBase):
|
||||||
is_enable_field_in_settings = 'EMAIL_HOST_USER'
|
is_enable_field_in_settings = 'EMAIL_HOST_USER'
|
||||||
|
|
||||||
def send_msg(self, users, message, subject):
|
def send_msg(self, users, message, subject):
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
|
||||||
accounts, __, __ = self.get_accounts(users)
|
accounts, __, __ = self.get_accounts(users)
|
||||||
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
send_mail_async(subject, message, accounts, html_message=message)
|
||||||
send_mail_async(subject, message, from_email, accounts, html_message=message)
|
|
||||||
|
|
||||||
|
|
||||||
backend = Email
|
backend = Email
|
||||||
|
|
Loading…
Reference in New Issue