blob: 8549a4335f35b50c615bf624c3b300884de64b5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/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
|