Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Elia Ponzio
cynomys
Commits
d5fd416c
Commit
d5fd416c
authored
Jun 24, 2021
by
Stephan Feurer
Browse files
Add email notifier first draft
parent
b85f57d7
Changes
2
Show whitespace changes
Inline
Side-by-side
cynomys/celery.py
View file @
d5fd416c
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
():
...
...
project/settings.py
View file @
d5fd416c
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment