瀏覽代碼

Fehler im Januar mit Monat-1

gc-server3 2 月之前
父節點
當前提交
742f2c976d
共有 1 個文件被更改,包括 6 次插入5 次删除
  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: