jumpserver/apps/notifications/backends/email.py

18 lines
480 B
Python
Raw Normal View History

from django.conf import settings
from django.core.mail import send_mail
from .base import BackendBase
class Email(BackendBase):
account_field = 'email'
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)
2021-06-17 04:19:05 +00:00
send_mail(subject, message, from_email, accounts, html_message=message)
backend = Email