我正在学习Python,我想尝试一个小的python脚本,在那里我可以用这个脚本发送电子邮件。
我的守则:
import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.login("youremailusername", "password")
msg = "Hello! Test Script For Sending an email"
server.sendmail("you@gmail.com", "target@example.com", msg)错误信息:
socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond有人能帮我解决问题吗?
发布于 2018-09-19 01:27:33
您所在的网络可能会阻塞传出连接的端口(587),或者Google可能会阻塞您的IP地址。如果您使用的是VPS,您可以检查系统的防火墙设置并查看是否可以打开它。
https://stackoverflow.com/questions/52396679
复制相似问题