python - Is it possible to send email from localhost by using flask-mail? -


i using windows os , trying send email localhost using flask-email extension. codes given below:

#!/usr/bin/env python # -*- coding: utf-8 -*-  flask import flask flask.ext.mail import mail, message  app = flask(__name__) mail = mail(app)  app.config['mail_server'] = 'smtp.gmail.com' app.config['mail_port'] = 465 app.config['mail_use_tls'] = true app.config['mail_use_ssl'] = false app.config['mail_username'] = "example@gmail.com" app.config['mail_password'] = "783798kljkld"   @app.route("/") def index():     msg = message("hello", sender="example@gmail.com", recipients=["to@gmail.com"])     msg.body = "testing"     msg.html = "<b>testing</b>"     return mail.send(msg)   if __name__ == '__main__':     app.run(debug=true) 

when run code in debugging mode, browser gives response "smtpserverdisconnected: connection unexpectedly closed"

so, problem in code & how can send email using flask-email extension localhost?


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -