fix send_email

This commit is contained in:
UlricQin 2021-07-27 18:31:50 +08:00
parent f2e3e3dbf1
commit 0c35f32c5c
1 changed files with 4 additions and 4 deletions

View File

@ -230,15 +230,15 @@ def persist(payload, rule_id, event_id, trigger_time):
class Send(object):
@classmethod
def send_mail(cls, payload):
users = payload.get("event").get("users")
def send_email(cls, alert_content, payload):
users = payload.get("users")
emails = [x.get("email") for x in users]
if not emails:
print("[emails_empty]")
return
recipients = emails
message = MIMEText(mail_body, 'html', 'utf-8')
message = MIMEText(alert_content, 'html', 'utf-8')
message['From'] = mail_from
message['To'] = ", ".join(recipients)
message["Subject"] = "n9e alert"