Not setting MAIL_DEBUG while DEBUG=true results in an error
The code calls int() on the setting of MAIL_DEBUG, which defaults to app.debug, which isn't an integer value normally. When it's "true", it results in a ValueError:
File ".../app/__init__.py", line 42, in create_app
mail.init_app(app)
File ".../lib/python3.6/site-packages/flask_mail.py", line 566, in init_app
state = self.init_mail(app.config, app.debug, app.testing)
File ".../lib/python3.6/site-packages/flask_mail.py", line 552, in init_mail
int(config.get('MAIL_DEBUG', debug)),
ValueError: invalid literal for int() with base 10: 'true'
This can be solved by setting MAIL_DEBUG to something integer-like, but it probably should work by default.
@iandees
How it happens that you have string value in app.debug ?
It must be either True or False.
I think my description of the problem was incorrect back then. It doesn't default to app.debug, it first checks config.get('MAIL_DEBUG'), which can be set to whatever type you want when you load a config Python module.
MAIL_DEBUG is used by flask-mail to set the debug output level for smtplib
which can be set to whatever type you want when you load a config Python module.
Accordingly to smtplib documentation, it must be one of 0, False, 1, True, 2, but not whatever type you want.