Use mailer to send mails

This commit is contained in:
Yohann D'ANELLO 2020-09-19 21:13:45 +02:00
parent f2b498c352
commit b7cb5aa776
4 changed files with 8 additions and 4 deletions

View File

@ -5,6 +5,7 @@ django-bootstrap-datepicker-plus
django-crispy-forms django-crispy-forms
django-extensions django-extensions
django-filter django-filter
django-mailer
django-polymorphic django-polymorphic
django-tables2 django-tables2
djangorestframework djangorestframework

View File

@ -51,10 +51,11 @@ INSTALLED_APPS = [
'django.forms', 'django.forms',
'bootstrap_datepicker_plus', 'bootstrap_datepicker_plus',
'django_extensions',
'polymorphic',
'crispy_forms', 'crispy_forms',
'django_extensions',
'django_tables2', 'django_tables2',
'mailer',
'polymorphic',
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',

View File

@ -1,4 +1,5 @@
# Database # Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_BACKEND = 'mailer.backend.DbBackend'
MAILER_EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View File

@ -9,7 +9,8 @@ ALLOWED_HOSTS = ['inscription.tfjm.org', 'plateforme.tfjm.org']
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'CHANGE_ME_IN_ENV_SETTINGS') SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'CHANGE_ME_IN_ENV_SETTINGS')
# Emails # Emails
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'mailer.backend.DbBackend'
MAILER_EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = True EMAIL_USE_SSL = True
EMAIL_HOST = os.getenv("SMTP_HOST") EMAIL_HOST = os.getenv("SMTP_HOST")
EMAIL_PORT = os.getenv("SMTP_PORT") EMAIL_PORT = os.getenv("SMTP_PORT")