Go back to passwords stored in session. This time, we use pycrypto to encrypt passwords using the AES algorithm. http://www.dlitz.net/software/pycrypto/ IMAP connections are now refreshed.