#!/usr/bin/python3 import os import subprocess import confparser import imapclient def monitor_mailbox(server, port, user, password, conf): if conf.ssl: imapserv = imaplib.IMAP4_SSL(server, port) else: imapserv = imaplib.IMAP4(server, port) if conf.starttls: imapserv.starttls() def main(): confpath = os.path.expanduser('~') + '/temp/conf.cfg' conf = confparser.read_conf(confpath) print('Read conf:', conf) password_command = conf.get('imap.password_command', None) if password_command: password = subprocess.check_output(password_command, shell=True) print('got pasword:', password) main() # dev mode for now