flask-mail

Configure Flask-Mail to use GMail

走远了吗. 提交于 2019-11-27 01:24:02
问题 When I try to send an email using Flask-Mail to Gmail's SMTP server using the settings below, I get [Errno -2] Name or service not known . How do I fix my configuration to send email with Gmail? from flask import Flask, render_template, redirect, url_for from flask_mail import Mail, Message app = Flask(__name__) app.config.update( MAIL_SERVER='smtp@gmail.com', MAIL_PORT=587, MAIL_USE_SSL=True, MAIL_USERNAME = 'ri******a@gmail.com', MAIL_PASSWORD = 'Ma*****fe' ) mail = Mail(app) @app.route('