[code.view]

[top] / python / PyMOTW / imaplib / imaplib_connect_fail.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import imaplib
     import ConfigParser
     import os
     
     # Read the config file
     config = ConfigParser.ConfigParser()
     config.read([os.path.expanduser('~/.pymotw')])
     
     # Connect to the server
     hostname = config.get('server', 'hostname')
     print 'Connecting to', hostname
     connection = imaplib.IMAP4_SSL(hostname)
     
     # Login to our account
     username = config.get('account', 'username')
     password = 'this_is_the_wrong_password'
     print 'Logging in as', username
     connection.login(username, password)
     

[top] / python / PyMOTW / imaplib / imaplib_connect_fail.py

contact | logmethods.com