linux - How to access delegated mailbox using Python without win32.client -
i have windows account mailbox. using python on linux environment, can access mail , directory mailbox using imaplib account credentials that's fine.
but now, want access delegated mailbox not belonging account , can't find how.
so far used code doc gives directories within mailbox. i'd reach mailbox.
i tried change username username/delegated-mailbox connection fails.
i've seen solutions on windows environment using win32.client, far, nothing on linux. there solution using imaplib or lib?
import imaplib import configparser def open_connection(verbose=false): # read config file config = configparser.configparser() config.read('connection.cfg') # connect server hostname = config.get('server', 'hostname') if verbose: print 'connecting to', hostname connection = imaplib.imap4_ssl(hostname) # login our account username = config.get('account', 'username') password = config.get('account', 'password') if verbose: print 'logging in as', username connection.login(username, password) return connection c = open_connection(verbose=true) try: typ, mailbox_data = c.list() line in mailbox_data: print line finally: try: c.close() except: pass c.logout()
config file like:
[server] hostname: the.hostname [account] username: test-account password: test-password
Comments
Post a Comment