mirror of https://github.com/jumpserver/jumpserver
perf: 优化发送邮件
parent
56a26481a4
commit
2069fee795
|
@ -36,7 +36,9 @@ def send_mail_async(*args, **kwargs):
|
||||||
args[0] = (settings.EMAIL_SUBJECT_PREFIX or '') + args[0]
|
args[0] = (settings.EMAIL_SUBJECT_PREFIX or '') + args[0]
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
||||||
args.insert(2, from_email)
|
args.insert(2, from_email)
|
||||||
args = tuple(args)
|
|
||||||
|
args[3] = [mail for mail in args[3] if mail != 'admin@mycomany.com']
|
||||||
|
args = tuple(args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return send_mail(*args, **kwargs)
|
return send_mail(*args, **kwargs)
|
||||||
|
@ -50,6 +52,7 @@ def send_mail_attachment_async(subject, message, recipient_list, attachment_list
|
||||||
attachment_list = []
|
attachment_list = []
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
||||||
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
||||||
|
recipient_list = [mail for mail in recipient_list if mail != 'admin@mycomany.com']
|
||||||
email = EmailMultiAlternatives(
|
email = EmailMultiAlternatives(
|
||||||
subject=subject,
|
subject=subject,
|
||||||
body=message,
|
body=message,
|
||||||
|
|
Loading…
Reference in New Issue