You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
504 B

from django.core.mail import send_mail
def send_status_notification(check):
if check.status == "down":
subject = "Alert DOWN"
body = "Hi, the check %s has gone down" % check.code
elif check.status == "up":
subject = "Alert UP"
body = "Hi, the check %s has gone up" % check.code
else:
raise NotImplemented("Unexpected status: %s" % check.status)
send_mail(subject, body, '[email protected]', [check.user.email],
fail_silently=False)