|
|
@@ -41,6 +41,7 @@ class Imap:
|
|
|
|
|
|
with self.connect("archiv") as mb:
|
|
|
folder_list = [f.name for f in mb.folder.list() if "Archive." in f.name]
|
|
|
+ folder_list.append("INBOX")
|
|
|
folder_list.sort()
|
|
|
with open("mailserver/folder_list.json", "w") as fwh:
|
|
|
json.dump(folder_list, fwh, indent=2)
|
|
|
@@ -50,8 +51,8 @@ class Imap:
|
|
|
if msg_count < msg_limit:
|
|
|
continue
|
|
|
mb.folder.set(folder)
|
|
|
- uids = [0] * 101
|
|
|
- while len(uids) > 100:
|
|
|
+ uids = [0] * (msg_limit + 1)
|
|
|
+ while len(uids) > msg_limit:
|
|
|
messages = mb.fetch(
|
|
|
criteria=AND(date_lt=date_criteria), mark_seen=True, limit=1000, headers_only=True
|
|
|
)
|
|
|
@@ -65,10 +66,16 @@ class Imap:
|
|
|
)
|
|
|
|
|
|
for msg in messages:
|
|
|
- if msg.subject.count(";") > 3:
|
|
|
+ if (
|
|
|
+ msg.subject.count(";") > 3
|
|
|
+ or "status@global-cube.com" in msg.to
|
|
|
+ or "Kontenaktualisierung" in msg.subject
|
|
|
+ or "Wochenbericht" in msg.subject
|
|
|
+ ):
|
|
|
# statusmail
|
|
|
mb.delete([msg.uid])
|
|
|
continue
|
|
|
+
|
|
|
match = re.findall(r"\+(.*)@", msg.from_)
|
|
|
if not match:
|
|
|
# print(msg.from_, msg.to, msg.subject)
|