From b2a5032ad1093b9d07a3a7c3114f2192f5a83443 Mon Sep 17 00:00:00 2001 From: Marnik De Bont Date: Sun, 24 Apr 2022 19:00:43 +0200 Subject: [PATCH 1/2] Add django-mailer to supported email schemes --- docs/types.rst | 1 + environ/environ.py | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/types.rst b/docs/types.rst index 292ed64f..d5585949 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -56,6 +56,7 @@ Supported types * SMTP: ``smtp://`` * SMTP+SSL: ``smtp+ssl://`` * SMTP+TLS: ``smtp+tls://`` + * django-mailer: ``djangomailer://`` * Console mail: ``consolemail://`` * File mail: ``filemail://`` * LocMem mail: ``memorymail://`` diff --git a/environ/environ.py b/environ/environ.py index acdfb153..a4b37bf6 100644 --- a/environ/environ.py +++ b/environ/environ.py @@ -142,6 +142,7 @@ class Env: 'smtps': 'django.core.mail.backends.smtp.EmailBackend', 'smtp+tls': 'django.core.mail.backends.smtp.EmailBackend', 'smtp+ssl': 'django.core.mail.backends.smtp.EmailBackend', + 'djangomailer': 'mailer.backend.DbBackend', 'consolemail': 'django.core.mail.backends.console.EmailBackend', 'filemail': 'django.core.mail.backends.filebased.EmailBackend', 'memorymail': 'django.core.mail.backends.locmem.EmailBackend', From c3529ae28317a3bc5758f6cd90e484d7a3bd55cf Mon Sep 17 00:00:00 2001 From: Marnik De Bont Date: Sun, 24 Apr 2022 21:11:41 +0200 Subject: [PATCH 2/2] Add TLS and SSl option to django-mailer scheme --- docs/types.rst | 2 ++ environ/environ.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/types.rst b/docs/types.rst index d5585949..6bf97194 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -57,6 +57,8 @@ Supported types * SMTP+SSL: ``smtp+ssl://`` * SMTP+TLS: ``smtp+tls://`` * django-mailer: ``djangomailer://`` + * django-mailer+SSL: ``djangomailer+ssl://`` + * django-mailer+TLS: ``djangomailer+tls://`` * Console mail: ``consolemail://`` * File mail: ``filemail://`` * LocMem mail: ``memorymail://`` diff --git a/environ/environ.py b/environ/environ.py index a4b37bf6..924f2b3e 100644 --- a/environ/environ.py +++ b/environ/environ.py @@ -143,6 +143,8 @@ class Env: 'smtp+tls': 'django.core.mail.backends.smtp.EmailBackend', 'smtp+ssl': 'django.core.mail.backends.smtp.EmailBackend', 'djangomailer': 'mailer.backend.DbBackend', + 'djangomailer+tls': 'mailer.backend.DbBackend', + 'djangomailer+ssl': 'mailer.backend.DbBackend', 'consolemail': 'django.core.mail.backends.console.EmailBackend', 'filemail': 'django.core.mail.backends.filebased.EmailBackend', 'memorymail': 'django.core.mail.backends.locmem.EmailBackend', @@ -652,9 +654,9 @@ def email_url_config(cls, url, backend=None): elif url.scheme in cls.EMAIL_SCHEMES: config['EMAIL_BACKEND'] = cls.EMAIL_SCHEMES[url.scheme] - if url.scheme in ('smtps', 'smtp+tls'): + if url.scheme in ('smtps', 'smtp+tls', 'djangomailer+tls'): config['EMAIL_USE_TLS'] = True - elif url.scheme == 'smtp+ssl': + elif url.scheme in ('smtp+ssl', 'djangomailer+ssl'): config['EMAIL_USE_SSL'] = True if url.query: