简体   繁体   English

python 2.7 imaplib错误

[英]python 2.7 imaplib error

I tried to connect to my mail server via imaplib and got an error in constructor: My code: 我试图通过imaplib连接到我的邮件服务器,并在构造函数中遇到错误:我的代码:

import imaplib
imaplib.IMAP4_SSL('my_host.com', 1234)

Error: 错误:

Traceback (most recent call last)

/home/username/www/site/<ipython console> in <module>()

/usr/lib/python2.7/imaplib.py in __init__(self, host, port, keyfile, certfile)
   1163             self.keyfile = keyfile
   1164             self.certfile = certfile
-> 1165             IMAP4.__init__(self, host, port)
   1166 
   1167 

/usr/lib/python2.7/imaplib.py in __init__(self, host, port)
    197             self.state = 'NONAUTH'
    198         else:
--> 199             raise self.error(self.welcome)
    200 
    201         typ, dat = self.capability()

error: None

Python recieved response from server and then raise an error, but it's a normal continuation response. Python从服务器接收到响应,然后引发错误,但这是正常的继续响应。 Response from server: 来自服务器的响应:

+OK my_host.com POP3 MDaemon 12.5.6 ready <MDAEMON-F201406061147.AA472534MD1387@my_host.com>

What I should do to recieve my mails from my server? 我应该怎么做才能从服务器接收邮件?

Demon point that he using protocol POP3. 恶魔点,他使用协议POP3。 You are trying to communicate whit him using IMAP protocol. 您正在尝试使用IMAP协议与他进行交流。 Change lib to poplib or change port to communicate via IMAP protocol(default is 143). 将lib更改为poplib或将端口更改为通过IMAP协议进行通信(默认值为143)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM