Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import imaplib
- import os
- def open_connection(verbose=False):
- # Connect to the server
- hostname = "mail.google.com"
- if verbose: print 'Connecting to', hostname
- connection = imaplib.IMAP4_SSL(hostname)
- # Login to our account
- username = "mfurlend"
- password = "pass8900"
- if verbose: print 'Logging in as', username
- connection.login(username, password)
- return connection
- if __name__ == '__main__':
- c = open_connection(verbose=True)
- try:
- print c
- finally:
- c.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement