mark as unseen message
This commit is contained in:
parent
5761718170
commit
9b594126a8
1 changed files with 9 additions and 1 deletions
|
@ -68,7 +68,7 @@ class BackupImap:
|
|||
if mailbox == '':
|
||||
real_mailbox = 'INBOX'
|
||||
else:
|
||||
real_mailbox = mailbox.encode()
|
||||
real_mailbox = mailbox
|
||||
self.imap.select(mailbox=f"\"{real_mailbox}\"", readonly=False)
|
||||
self._log.debug(
|
||||
"Searching for all messages in '%s'...",
|
||||
|
@ -100,6 +100,14 @@ class BackupImap:
|
|||
msg_counter += 1
|
||||
fetch_response, fetch_data = self.imap.fetch(message_uid, "(RFC822)")
|
||||
if fetch_response == 'OK':
|
||||
store_result, unseen_data = self.imap.store(message_uid, '-FLAGS', '\\Seen')
|
||||
if store_result != 'OK':
|
||||
self._log.error(
|
||||
"Error marking as unseen the message '%s'. %s",
|
||||
message_uid,
|
||||
unseen_data
|
||||
)
|
||||
sys.exit(6)
|
||||
subject = f'__no_subject__{message_uid}'
|
||||
data = fetch_data[0][1]
|
||||
subject_match = re.search(rb'Subject: (.*)\r\n', data)
|
||||
|
|
Loading…
Reference in a new issue