Feb-04-2021, 07:27 AM
i added the lines as this:
my_config="""[options] verbose = 1 read_all = false delete = true received = false delivered_to = false message_log = /home/mail/log message_log_verbose = true [retriever] type = SimplePOP3Retriever [destination] type = MDA_external path = /usr/bin/exim arguments = ("-i", "-bm", "user@localhost") unixfrom = true""" config = configparser.ConfigParser() config.read_string(my_config) cur = conn.cursor() query = "SELECT user, passwd, server FROM pop" cur.execute(query) for idx, row in enumerate(cur, start=1): credentials = dict(zip(('username', 'password', 'server'), row)) config['options'].update(credentials) with open(f'mail{idx}', 'w') as f: config.write(f)and this was the output:
[options] verbose = 1 read_all = false delete = true received = false delivered_to = false message_log = /home/mail/log message_log_verbose = true username = [email protected] password = ****** server = pop.gmail.com [retriever] type = SimplePOP3Retriever [destination] type = MDA_external path = /usr/bin/exim arguments = ("-i", "-bm", "user@localhost") unixfrom = truei changed the double quotes to the deferent positions but no luck.