有人可以给我一些关于为什么会出现这种情况的见解吗:
mailServer = smtplib.SMTP("smtp.gmail.com", 587)
和这个:
mailServer = smtplib.SMTP('smtp.gmail.com:587')
正在说这样的话:
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
mailServer = smtplib.SMTP("smtp.gmail.com", 587)
File "C:\Users\user\Documents\Shuttlecock_new\python\lib\smtplib.py", line 242, in __init__
(code, msg) = self.connect(host, port)
File "C:\Users\user\Documents\Shuttlecock_new\python\lib\smtplib.py", line 302, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Users\user\Documents\Shuttlecock_new\python\lib\smtplib.py", line 277, in _get_socket
return socket.create_connection((port, host), timeout)
File "C:\Users\user\Documents\Shuttlecock_new\python\lib\socket.py", line 571, in create_connection
raise err
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
- 我在中国。
- 我有一个VPN。我尝试过使用和不使用 VPN 的情况。
- 我之前曾多次使用此代码从我的 Gmail 帐户发送电子邮件。今天突然出现这个错误。
- 如果通过我的 Chrome 浏览器访问 Gmail,则工作正常。尽管如此,发送简单的电子邮件需要花费异常长的时间......嗯