Skip to content

Commit

Permalink
Add MAIL_DEBUG_BODY and modify the behaviour of MAIL_DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Ledez committed Oct 18, 2024
1 parent 362c19c commit 5400ca6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion zou/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
MAIL_PORT = os.getenv("MAIL_PORT", 25)
MAIL_USERNAME = os.getenv("MAIL_USERNAME", "")
MAIL_PASSWORD = os.getenv("MAIL_PASSWORD", "")
MAIL_DEBUG = envtobool("MAIL_DEBUG", False)
MAIL_DEBUG = envtobool("MAIL_DEBUG", 0)
MAIL_DEBUG_BODY = envtobool("MAIL_DEBUG_BODY", False)
MAIL_USE_TLS = envtobool("MAIL_USE_TLS", False)
MAIL_USE_SSL = envtobool("MAIL_USE_SSL", False)
MAIL_DEFAULT_SENDER = os.getenv(
Expand Down
4 changes: 2 additions & 2 deletions zou/app/utils/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def send_email(subject, html, recipient_email, body=None):
"""
if body is None:
body = strip_html_tags(html)
if app.config["MAIL_DEBUG"]:
if app.config["MAIL_DEBUG_BODY"]:
print(body)
elif app.config["MAIL_ENABLED"]:
if app.config["MAIL_ENABLED"]:
with app.app_context():
try:
mail_default_sender = app.config["MAIL_DEFAULT_SENDER"]
Expand Down

0 comments on commit 5400ca6

Please sign in to comment.