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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -