使用poplib获取电子邮件时出错 [英] error when using poplib to get email

查看:152
本文介绍了使用poplib获取电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用poplib从POP3服务器获取电子邮件。

I am using poplib to get email from the POP3 server.

但是发生了这个错误:

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

我的笔记本电脑在本地网络中并使用服务器(ip 192.168.0.1:8080)作为访问互联网的代理。错误似乎poplib无法解释域pop3.126.com。如何解决这个问题?谢谢!

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!

推荐答案

您的代理是针对http的,它不会影响pop3流量。

Your proxy is for http, it doesn't effect the pop3 traffic.

粗略的一瞥表明它可能无法将主机名解析为IP地址。

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

或者粘贴输出:

nslookup pop3.126.com

这篇关于使用poplib获取电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆