Reputation: 139
I tried to connect to my mail server via imaplib and got an error in constructor: My code:
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. 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?
Upvotes: 0
Views: 723
Reputation: 56
Demon point that he using protocol POP3. You are trying to communicate whit him using IMAP protocol. Change lib to poplib or change port to communicate via IMAP protocol(default is 143).
Upvotes: 2