Fix mark as read

This commit is contained in:
Antonio J. Delgado 2024-09-04 13:40:57 +03:00
parent f642297868
commit 0250ce45f4

View file

@ -73,12 +73,16 @@ class RemoveDuplicateImapMessages:
if typ != 'OK':
self._log.error('Error, server replied: %s', data)
return False
typ, unseen_data = self.imap.store(message_id, '-FLAGS', '\Seen')
self._log.debug('Response: %s', typ)
if typ != 'OK':
self._log.error('Error, server replied: %s', unseen_data)
return False
self._process_message(message_id, data[0])
return True
def _process_message(self, message_id, data):
'''Process a mail message'''
# print(data)
if isinstance(data[1], int):
self._log.warning(
"Response part is integer %s in data '%s'. Try again.",
@ -88,7 +92,6 @@ class RemoveDuplicateImapMessages:
return False
part = data[1].decode('utf-8')
message = email.message_from_string(part)
# print(message)
hash_obj = hashlib.sha256()
hash_obj.update(message.as_bytes())
hash_obj.digest()