Advertisement
Guest User

Untitled

a guest
May 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import imaplib
  2.  
  3. import os
  4.  
  5. def open_connection(verbose=False):
  6.  
  7.  
  8.     # Connect to the server
  9.     hostname = "mail.google.com"
  10.     if verbose: print 'Connecting to', hostname
  11.     connection = imaplib.IMAP4_SSL(hostname)
  12.  
  13.     # Login to our account
  14.     username = "mfurlend"
  15.     password = "pass8900"
  16.     if verbose: print 'Logging in as', username
  17.     connection.login(username, password)
  18.     return connection
  19.  
  20. if __name__ == '__main__':
  21.     c = open_connection(verbose=True)
  22.     try:
  23.         print c
  24.     finally:
  25.         c.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement