OSError: [Errno 2] 当我尝试使用 flask_mail 发送邮件时没有这样的文件或目录。下面是我的代码:
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = parametter.email_sender
app.config['MAIL_PASSWORD'] = parametter.email_sender_password
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = False
mail = Mail(app)
@app.route('/')
def main():
msg = Message('Hello', sender = parametter.email_sender,recipients = [parametter.email_recipients])
msg.body = "Hello Flask message sent from Flask-Mail"
mail.send(msg)
return "Sent"
当我评论(#mail.send(msg))时,程序运行正常。但我无法发送消息。有人可以帮我解决这个问题吗?