Why can't I login to an imap server twice in Python
问题 As the error message below states, I cannot log in because I'm in state LOGOUT and not in state NONAUTH. How do I get from LOGOUT to NONAUTH? Example below (obviously the login credentials are faked below) Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import imaplib >>> imap_server = imaplib.IMAP4_SSL("imap.gmail.com",993) >>> imap_server.login('something@myserver.com', 'mypassword') ('OK', [