Browse Source

Fehler im Januar mit Monat-1

gc-server3 2 months ago
parent
commit
742f2c976d
1 changed files with 6 additions and 5 deletions
  1. 6 5
      mailserver/imap.py

+ 6 - 5
mailserver/imap.py

@@ -1,10 +1,11 @@
-from imap_tools import MailBox, AND, MailMessage
-import re
 import json
 import os
-import plac
-from datetime import datetime, date
+import re
 from dataclasses import dataclass
+from datetime import datetime, timedelta
+
+import plac
+from imap_tools import AND, MailBox, MailMessage
 
 
 @dataclass
@@ -35,7 +36,7 @@ class Imap:
 
     def cleanup(self):
         date_now = datetime.now()
-        date_criteria = date(date_now.year, date_now.month - 1, 1)
+        date_criteria = (date_now - timedelta(days=60)).date()
         msg_limit = 100
 
         with self.connect("archiv") as mb: