Commit d5fd416c authored by Stephan Feurer's avatar Stephan Feurer
Browse files

Add email notifier first draft

parent b85f57d7
import os
from celery import Celery
from django.core.mail import send_mail
import subprocess
......@@ -47,8 +48,15 @@ def l4_check():
pass
@app.task()
def notify_email():
pass
def notify_email(checkTask, receiver):
print("Sending email from task " + checkTask + " to " + receiver)
send_mail(
"Status Change",
"Message which task etc.",
None,
[receiver],
fail_silently=False
)
@app.task()
def notify_webhook():
......
......@@ -149,3 +149,16 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Celery settings
CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/0"
# Email settings
# https://docs.djangoproject.com/en/3.2/ref/settings/#email-backend
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "cynomys.vshn@gmail.com"
EMAIL_HOST_PASSWORD = "4PQtEPsLSKstjTFKD29LeScowxsFxS8n"
EMAIL_PORT = 587
EMAIL_SUBJECT_PREFIX = "[cynomys] "
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment