fix before criteria

This commit is contained in:
Antonio J. Delgado 2025-03-28 10:22:20 +02:00
parent 79df8cbaa3
commit 456dc1b2db

View file

@ -101,7 +101,7 @@ class BackupImap:
os.mkdir(mailbox_path) os.mkdir(mailbox_path)
current = time.gmtime() current = time.gmtime()
for year in range(current.tm_year-10, current.tm_year+1): for year in range(current.tm_year-10, current.tm_year+1):
search_response, search_data = self.imap.search('UTF-8', 'UNDELETED', f'BEFORE={year}') search_response, search_data = self.imap.search('UTF-8', f'(BEFORE "{year}-1-1")')
if search_response == 'OK': if search_response == 'OK':
all_msgs_uids = search_data[0].split() all_msgs_uids = search_data[0].split()
self._log.debug( self._log.debug(