Simple IMAP Account Verification in Python
imaplib is a great library for handling IMAP communication. It supports both plaintext IMAP and IMAP over SSL (IMAPS) with ease. Connecting to an IMAP server is achieved as follows: import imaplib host = "" port = 143 ssl = 0 try: if ssl: imap = imaplib.IMAP4_SSL(host, port) else: imap = imaplib.IMAP4(host, port) welcomeMsg = imap.welcome print "IMAP Banner: %s" %(welcomeMsg) except: print "Connection Failed" quit() This results in