error when using poplib to get email

守給你的承諾、 提交于 2019-12-13 05:23:25

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/4643367/error-when-using-poplib-to-get-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!