pallets-eco/flask-mail

sender = sender or current_app.extensions['mail'].default_sender

Closed this issue · 2 comments

I use flask_mail in blueprint,app = Flask(__name__) in app.py
so I first from app import app in blueprint
then set sender app.config["MAIL_DEFAULT_SENDER"]
finally mail = Mail(app)
when run msg = Message(subject="xx", recipients=[xx], body=info) and mail.send(msg)
raise an error:sender = sender or current_app.extensions['mail'].default_sender

I think it's the reason why app is referenced in the blueprint
when I set app.config["MAIL_DEFAULT_SENDER"] and mail = Mail(app) in app.py
And I do not import app but import mail in blueprint
it works

I can't reproduce this issue with the information provided. If it's still happening, open a new issue with a minimal reproducible example, including the full traceback.