flask_mail()发送邮件 in send connection.send(self)错误

flask发送邮件折腾了好久,还是失败,163邮箱,已开启SMTP,连接时用的是独立密钥,TLS是False,SSL是True,然后就出错了,

File "D:\NewFlasky\venv\lib\site-packages\flask_mail.py", line 427, in send connection.send(self)
File "D:\NewFlasky\venv\lib\site-packages\flask_mail.py", line 427, in send connection.send(self)
RuntimeError: maximum recursion depth exceeded

第一句和第二句重复了大概100次,人家都是到下一步才卡壳,我这刚到一半就结束了,好不甘心啊。求大神帮帮新手,谢谢!

阅读 3k
2 个回答

个人觉得是程序逻辑的问题和flask没有关系。最好贴下代码块。

注意最后一行的报错信息 RuntimeError: maximum recursion depth exceeded,尝试提高 Recursion limit。

import sys
sys.setrecursionlimit(1000)

数值可以适当调整,逐步提高直到不出错。但要谨慎设置,太高了也会导致崩溃。

参照官方文档说明:

Set the maximum depth of the Python interpreter stack to limit. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python.

The highest possible limit is platform-dependent. A user may need to set the limit higher when they have a program that requires deep recursion and a platform that supports a higher limit. This should be done with care, because a too-high limit can lead to a crash.

官方文档链接:sys.setrecursionlimit(limit)

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题