settings: Set a flag when email isn't configured, so we can warn.

This commit is contained in:
Greg Price
2018-01-24 14:18:50 -08:00
parent 08bbd7e61d
commit 6da9ecef88
2 changed files with 12 additions and 5 deletions

View File

@@ -51,10 +51,12 @@ ZULIP_ADMINISTRATOR = 'zulip-admin@example.com'
# /home/zulip/deployments/current/manage.py send_test_email username@example.com
#
# A common problem is hosting provider firewalls that block outgoing SMTP traffic.
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = ''
EMAIL_PORT = 587
EMAIL_USE_TLS = True
#
#EMAIL_HOST = 'smtp.gmail.com'
#EMAIL_HOST_USER = ''
#EMAIL_PORT = 587
#EMAIL_USE_TLS = True
EMAIL_HOST = None
## OPTIONAL SETTINGS

View File

@@ -273,6 +273,10 @@ DEFAULT_SETTINGS.update({
# available for sysadmin override in unusual cases.
'EMAIL_BACKEND': None,
# Whether to give admins a warning in the web app that email isn't set up.
# Set below when email isn't configured.
'WARN_NO_EMAIL': False,
# Whether to keep extra frontend stack trace data.
# TODO: Investigate whether this should be removed and set one way or other.
'SAVE_FRONTEND_STACKTRACES': False,
@@ -1537,7 +1541,8 @@ elif DEVELOPMENT:
# In the dev environment, emails are printed to the run-dev.py console.
EMAIL_BACKEND = 'zproject.email_backends.EmailLogBackEnd'
elif not EMAIL_HOST:
# If an email host is not specified, fail silently and gracefully
# If an email host is not specified, fail gracefully
WARN_NO_EMAIL = True
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
else:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'