This commit is contained in:
holger krekel
2020-06-05 23:12:05 +02:00
parent 4ad4d6d10d
commit d97d9980dd
2 changed files with 7 additions and 9 deletions

View File

@@ -14,23 +14,23 @@ def db_folder_attr(name):
class ImapConn:
def __init__(self, account):
self.account = account
host = account.get_config("configured_mail_server"),
user = account.get_config("addr"),
pw = account.get_config("mail_pw"))
host = account.get_config("configured_mail_server")
user = account.get_config("addr")
pw = account.get_config("mail_pw")
self.connection = imaplib.IMAP4_SSL(host)
self.connection.login(user, pw)
self._original_msg_count = {}
self.select_folder("INBOX")
def shutdown(self):
try:
self.connection.logout()
except Exception:
print("Could not logout direct_imap conn")
try:
self.connection.close()
except Exception:
pass
try:
self.connection.logout()
except Exception:
print("Could not logout direct_imap conn")
def select_folder(self, foldername):
status, messages = self.connection.select(foldername)