
October 14th, 2003, 12:49 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Location: Tucson AZ
Posts: 29
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
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...
>>> try:
... m = imaplib.IMAP4(host="127.0.0.1",port=143)
... except:
... print("You were not logged in")
...
You were not logged in
>>>
|