我有一个非常小的烧瓶应用程序,它使用烧瓶邮件发送电子邮件,但是当我运行它时,什么都没有发生,没有错误,没有例外,没有!
这是代码
from flask import Flask
from flask_mail import Mail, Message
app = Flask(__name__)
DEBUG = True
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 465
MAIL_USE_TLS = False
MAIL_USE_SSL = True
MAIL_DEBUG = True
MAIL_USERNAME = "myemail@gmail.com"
MAIL_PASSWORD = "mypassword"
app.config.from_object(__name__)
mail = Mail(app)
@app.route("/")
def send_mail():
msg = Message("Hello",
sender="myemail@gmail.com",
recipients=["another_email@gmail.com"],
body="just testing",
)
mail.send(msg)
return "Message sent"
if __name__ == '__main__':
app.run()
更新
很长一段时间后我得到了这个错误
TimeoutError: [Errno 110] Connection timed out