From b952b644975c19ca49de14d699940fa18bb8dff8 Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Thu, 2 Apr 2020 15:54:17 +0200 Subject: [PATCH] Disable email sending when not in production. --- flaskr/extensions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flaskr/extensions.py b/flaskr/extensions.py index b78d1af..2e27502 100644 --- a/flaskr/extensions.py +++ b/flaskr/extensions.py @@ -2,6 +2,7 @@ import sys import traceback from os import getenv + from flask_admin import Admin from flask_basicauth import BasicAuth from flask_caching import Cache @@ -12,6 +13,7 @@ from flask_mail import Mail, Message from flaskr.models import User + # Setup flask cache cache = Cache() @@ -41,7 +43,9 @@ def load_user(userid): def send_email(to_recipient, subject, message): - print(getenv('MAIL_PORT')) + if 'production' != getenv('FLASK_ENV', 'production'): + print("Skipping sending email because we are not in production.") + return try: msg = Message( -- libgit2 0.21.2