Forums

flask-mail and flask-security-too problem

hi i can send an email alright with a custom route like the following:

    @app.route("/send")
def index():
   msg = Message('Hello', sender = 'support@example.com', recipients = ['recipientemail@gmail.com'])
   msg.body = "Hello Flask message sent from Flask-Mail"
   mail.send(msg)
   return "Sent"

the problem i am facing is when i use flask-security-too and goto the /confirm route it wont use my configuration for example:

    app.config['MAIL_SERVER']='mail.privateemail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = 'support@example'
app.config['MAIL_PASSWORD'] = '***************'
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True

mail = Mail(app)

but the route /send will how do i set global setting or what exactly is going on here.

so to answer my self i managed to resolve this by editing

config.get('MAIL_DEFAULT_SENDER', 'support.mydomain.com'),

in flask_mail.py file in my site packages folder seems it wont work if i supply it with app.config.

Glad you were able to fix it!