feat: extend email support for SSL/No Auth Email Support (#1235)

* Changes Settings to use new SMTP_AUTH_STRATEGY variable in place of SMTP_TLS with transition support

#1187

* Wires up default email client to use ssl or tls authentication if enabled in settings

* Updates the docs

* Update template file

* remove SMTP_TLS and use staticmethod for validate

* consolidate test cases with params

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
Nick Kringle
2022-05-21 14:15:14 -05:00
committed by GitHub
parent b2066dfe72
commit 6a88a59981
7 changed files with 98 additions and 46 deletions

View File

@@ -24,8 +24,10 @@ class DefaultEmailSender(ABCEmailSender, BaseService):
)
smtp_options: dict[str, str | bool] = {"host": self.settings.SMTP_HOST, "port": self.settings.SMTP_PORT}
if self.settings.SMTP_TLS:
if self.settings.SMTP_AUTH_STRATEGY.upper() == "TLS":
smtp_options["tls"] = True
if self.settings.SMTP_AUTH_STRATEGY.upper() == "SSL":
smtp_options["ssl"] = True
if self.settings.SMTP_USER:
smtp_options["user"] = self.settings.SMTP_USER
if self.settings.SMTP_PASSWORD: