Disable smtp_use_tls with false instead of empty string (#1184)

`smtp_use_tls = bool(os.environ.get("EMAIL_SMTP_USE_TLS", True))` would only disable tls when `EMAIL_SMTP_USE_TLS` is set to an empty string which is not intuitive
This commit is contained in:
Vinzenz Sinapius 2023-09-28 21:10:20 +02:00 committed by GitHub
parent e93f195d59
commit cabf4ccc21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,9 @@ class EmailSender:
self.reply_to = os.environ.get("EMAIL_REPLY_TO") or self.sender
self.smtp_server = os.environ.get("EMAIL_SMTP_HOST")
self.smtp_port = int(os.environ.get("EMAIL_SMTP_PORT", 587))
self.smtp_use_tls = bool(os.environ.get("EMAIL_SMTP_USE_TLS", True))
self.smtp_use_tls = (
os.environ.get("EMAIL_SMTP_USE_TLS", "true").lower() != "false"
)
self.default_origin = os.environ.get("APP_ORIGIN")