October 6th, 2003, 05:37 PM
I've been messing around with imaplib some and I was wondering how to check if you are logged into a server. Does anyone know how to do this?
Thanks in advance.
Before you criticize someone, walk a mile in their shoes, that way when you do criticize them, you're a mile away and you have their shoes!
October 14th, 2003, 12:49 PM
Well, I have not messed around with imaplib but when you try to connect to a server:
m = imaplib.IMAP4(host="127.0.0.1",port=143)
Will give you a connection refused if you can't connect.
Just put the attempt to connect in a try block as in the example below...
... m = imaplib.IMAP4(host="127.0.0.1",port=143)
... print("You were not logged in")
You were not logged in