new setting MAILTEST which sends mail only to EVA_MAIL not to departments

This commit is contained in:
Benni Bärmann 2021-03-25 10:09:27 +01:00
parent 6d87e1a766
commit f131d4d0c9
5 changed files with 18 additions and 7 deletions

4
TODO
View File

@ -2,10 +2,10 @@ known bugs:
html problem in mails: 14" -> 14" html problem in mails: 14" -> 14"
stellenbeschreibung -> stellenbezeichnung
evapp/settings auf die richtigen adressen setzen evapp/settings auf die richtigen adressen setzen
Accounts klären Accounts klären
mail in production testen mail in production testen
Bemerkung like "E - VA soon" auf die webseite

View File

@ -27,6 +27,9 @@ SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
# send mails only to debug mode adress even if in production
MAILTEST = True
STATIC_ROOT = BASE_DIR / 'staticfiles' STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@ -49,15 +49,15 @@ SECRET_KEY = get_secret('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = False
# send mails only to debug mode adress even if in production
MAILTEST = True
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
# SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' # SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
STATIC_ROOT = BASE_DIR / 'staticfiles' STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@ -1,7 +1,7 @@
# temporary setting while change and exit is not yet fully implemented # temporary setting while change and exit is not yet fully implemented
ONLY_ONBOARDING = True ONLY_ONBOARDING = True
# sender mail adress # sender mail adress also used for MAILTEST mode
EVA_MAIL = 'benni.baermann@wikimedia.de' EVA_MAIL = 'benni.baermann@wikimedia.de'
# these Fields should be included in every mail # these Fields should be included in every mail

View File

@ -130,6 +130,14 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
try: try:
mail_template = get_template(f'evapp/department_mail.txt') mail_template = get_template(f'evapp/department_mail.txt')
if settings.MAILTEST:
send_mail(
'EVA: Neuzugang',
mail_template.render(context),
EVA_MAIL,
[EVA_MAIL, self.instance.usermail],
fail_silently=False)
else:
send_mail( send_mail(
'EVA: Neuzugang', 'EVA: Neuzugang',
mail_template.render(context), mail_template.render(context),