py集成宝塔,flask已加入模块,无法实现自动发送邮件功能

在py执行smtp.qq.com的动作时

运行日志返回

File "/www/wwwroot/pythonFlask/app.py", line 47, in submit_form snedStatus = send_qq_mail( File "/www/wwwroot/pythonFlask/app.py", line 79, in send_qq_mail smtp.connect(smtpserver) File "/www/server/pyporject_evn/pythonFlask_venv/lib/python3.9/smtplib.py", line 341, in connect self.sock = self._get_socket(host, port, self.timeout) File "/www/server/pyporject_evn/pythonFlask_venv/lib/python3.9/smtplib.py", line 312, in _get_socket return socket.create_connection((host, port), timeout, File "/www/server/pyporject_evn/pythonFlask_venv/lib/python3.9/socket.py", line 843, in create_connection raise err File "/www/server/pyporject_evn/pythonFlask_venv/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) OSError: [Errno 101] Network is unreachabl

确认你在代码中使用的 SMTP 服务器地址和端口是正确的。对于 QQ 邮箱,通常使用 smtp.qq.com,端口 465(SSL)或 587(TLS)。

posted @ 2024-08-14 08:13  木子东晓东  阅读(19)  评论(0)    收藏  举报