From 2f027567c6181b9a21e62c9889787511f4291c7e Mon Sep 17 00:00:00 2001 From: Chandler Rosenthal <19955692+Metrea@users.noreply.github.com> Date: Tue, 12 Mar 2024 08:03:04 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Add=20`SMTP=5FSSL`=20option=20fo?= =?UTF-8?q?r=20older=20SMTP=20servers=20(#365)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastián Ramírez --- .env | 1 + backend/app/core/config.py | 1 + backend/app/utils.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.env b/.env index 9c2dd3aa45..40f9d761f9 100644 --- a/.env +++ b/.env @@ -21,6 +21,7 @@ SMTP_USER= SMTP_PASSWORD= EMAILS_FROM_EMAIL=info@example.com SMTP_TLS=True +SMTP_SSL=False SMTP_PORT=587 # Postgres diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 81a7df206d..060090f6e1 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -64,6 +64,7 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn: ) SMTP_TLS: bool = True + SMTP_SSL: bool = False SMTP_PORT: int = 587 SMTP_HOST: str | None = None SMTP_USER: str | None = None diff --git a/backend/app/utils.py b/backend/app/utils.py index 407314693f..8d5616a6a1 100644 --- a/backend/app/utils.py +++ b/backend/app/utils.py @@ -40,6 +40,8 @@ def send_email( smtp_options = {"host": settings.SMTP_HOST, "port": settings.SMTP_PORT} if settings.SMTP_TLS: smtp_options["tls"] = True + elif settings.SMTP_SSL: + smtp_options["ssl"] = True if settings.SMTP_USER: smtp_options["user"] = settings.SMTP_USER if settings.SMTP_PASSWORD: