Commit 700bb6e9 by Juan Diego Caballero

Email Notifications Implementation

The manage command notifysendemails is implemented. The command forks a process that can be daemonized and starts sending the emails to subscribed users taking into account the interval subscriptions.

The commit contains a dummy backend.
parent e448e2b7
...@@ -18,6 +18,11 @@ ENABLE_ADMIN = getattr(django_settings, "NOTIFY_ENABLE_ADMIN", False) ...@@ -18,6 +18,11 @@ ENABLE_ADMIN = getattr(django_settings, "NOTIFY_ENABLE_ADMIN", False)
# to a proper SMTP server, just leave it off... # to a proper SMTP server, just leave it off...
SEND_EMAILS = getattr(django_settings, "NOTIFY_SEND_EMAILS", False) SEND_EMAILS = getattr(django_settings, "NOTIFY_SEND_EMAILS", False)
DEFAULT_EMAIL = 'notifications@django-wiki.org'
#NOTIFY_SLEEP_TIME must be greater than 0 to allow for Garbage Collection
NOTIFY_SLEEP_TIME = 10
# You can always make up more numbers... they simply identify which notifications # You can always make up more numbers... they simply identify which notifications
# to send when invoking the script, and the number indicates how many hours # to send when invoking the script, and the number indicates how many hours
# to minimum pass between each notification. # to minimum pass between each notification.
...@@ -27,12 +32,11 @@ DAILY = 24-1 # Subtract 1, because the job finishes less than 24h before the nex ...@@ -27,12 +32,11 @@ DAILY = 24-1 # Subtract 1, because the job finishes less than 24h before the nex
WEEKLY = 7*24-1 WEEKLY = 7*24-1
INTERVALS = getattr(django_settings, "NOTIFY_INTERVALS", INTERVALS = getattr(django_settings, "NOTIFY_INTERVALS",
[(INSTANTLY, _(u'instantly')), [(INSTANTLY, _(u'instant')),
(DAILY, _(u'daily')), (DAILY, _(u'daily')),
(WEEKLY, _(u'weekly'))]) (WEEKLY, _(u'weekly'))])
INTERVALS_DEFAULT = INSTANTLY INTERVALS_DEFAULT = INSTANTLY
# Minimum logging and digital garbage! Don't save too much crap! # Minimum logging and digital garbage! Don't save too much crap!
# After how many days should viewed notifications be deleted? # After how many days should viewed notifications be deleted?
......
...@@ -4,6 +4,8 @@ PROJECT_PATH = os_path.abspath(os_path.split(__file__)[0]) ...@@ -4,6 +4,8 @@ PROJECT_PATH = os_path.abspath(os_path.split(__file__)[0])
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '%s/app-messages' %(PROJECT_PATH) # change this to a proper location
ADMINS = ( ADMINS = (
# ('Your Name', 'your_email@example.com'), # ('Your Name', 'your_email@example.com'),
......
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