python PySocks smtplib错误

时间:2016-12-02 08:06:29

标签: python sockets proxy smtplib

我正在尝试the code given in an answer,但我收到了错误:

Traceback (most recent call last):
  File "testpysocks.py", line 18, in <module>
    server = smtplib.SMTP(smtpserver,587)
  File "/usr/lib/python2.6/smtplib.py", line 239, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.6/smtplib.py", line 295, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.6/smtplib.py", line 273, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib/python2.6/socket.py", line 547, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

第18行

socks.set_default_proxy(socks.SOCKS5, "xx.xx.xx", 8080, 'username','pass')

可能是什么原因?我在代理后面,我已正确设置代理用户名,密码。我尝试了HTTP和SOCKS5,但得到了同样的错误。我用Google搜索但无法得到答案。

如何解决这个问题?

0 个答案:

没有答案