SMTPAuthenticationError 535 Error(关键词:flask/bug)

来源:互联网 发布:linux 新建数据库实例 编辑:程序博客网 时间:2024/06/02 02:13

报错信息简略版:

SMTPAuthenticationError: (535, 'Error: \xc7\xeb\xca\xb9\xd3\xc3\xca\xda\xc8\xa8\xc2\xeb\xb5\xc7\xc2\xbc\xa1\xa3\xcf\xea\xc7\xe9\xc7\xeb\xbf\xb4: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256')

报错信息完整版:

(venv_flask_henry) henry@henry-virtual-machine:~/dev/flask_henry$ python hello.py shell>>> from flask_mail import Message>>> from hello import mail>>> msg = Message('test subject', sender='331243543@qq.com', recipients=['mailhenry@hotmail.com'])>>> msg.body = 'text body'>>> msg.html = '<b>HTML</b> body'>>> with app.app_context():...     mail.send(msg)... Traceback (most recent call last):  File "<console>", line 2, in <module>  File "/home/henry/dev/flask_henry/venv_flask_henry/local/lib/python2.7/site-packages/flask_mail.py", line 491, in send    with self.connect() as connection:  File "/home/henry/dev/flask_henry/venv_flask_henry/local/lib/python2.7/site-packages/flask_mail.py", line 144, in __enter__    self.host = self.configure_host()  File "/home/henry/dev/flask_henry/venv_flask_henry/local/lib/python2.7/site-packages/flask_mail.py", line 165, in configure_host    host.login(self.mail.username, self.mail.password)  File "/usr/lib/python2.7/smtplib.py", line 622, in login    raise SMTPAuthenticationError(code, resp)SMTPAuthenticationError: (535, 'Error: \xc7\xeb\xca\xb9\xd3\xc3\xca\xda\xc8\xa8\xc2\xeb\xb5\xc7\xc2\xbc\xa1\xa3\xcf\xea\xc7\xe9\xc7\xeb\xbf\xb4: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256')

根据互联网上搜到的:
Flask发送邮件
和报错信息中给的链接:
http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256’

原因就是,应该是授权码,而不是普通的邮箱密码。

参考文献:
1.Flask发送邮件
2.什么是授权码,它又是如何设置?

阅读全文
0 0