error when using poplib to get email
I am using poplib to get email from the POP3 server.
But this error开发者_高级运维 occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\site-packages\myutils.py", line 251, in dxDown
m=poplib.POP3('pop3.126.com')
File "C:\Python26\lib\poplib.py", line 83, in __init__
self.sock = socket.create_connection((host, port), timeout)
File "C:\Python26\lib\socket.py", line 500, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11004] getaddrinfo failed
My laptop is in an local network and using a server(ip 192.168.0.1:8080) as proxy to access internet. The error seems poplib cannot interpret the domain "pop3.126.com". How to solve this problem?Thanks!
Your proxy is for http, it doesn't effect the pop3 traffic.
A cursory glance suggests that it's probably not able to resolve the hostname to an IP address.
Can you try one of these:
pop3.126.idns.yeah.net
220.181.15.128
Or paste the output of:
nslookup pop3.126.com
精彩评论