From 9772cd0186cca3409bd59ea1fca4d17c685f91aa Mon Sep 17 00:00:00 2001 From: Jose Zambudio Bernabeu Date: Tue, 23 Jul 2024 13:39:31 +0200 Subject: [PATCH] [IMP] We exclude read emails (#17) --- fetchmail_attach_from_folder/models/fetchmail_server_folder.py | 2 +- fetchmail_attach_from_folder/wizard/attach_mail_manually.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fetchmail_attach_from_folder/models/fetchmail_server_folder.py b/fetchmail_attach_from_folder/models/fetchmail_server_folder.py index 3e351fb3623..c361f20cac2 100644 --- a/fetchmail_attach_from_folder/models/fetchmail_server_folder.py +++ b/fetchmail_attach_from_folder/models/fetchmail_server_folder.py @@ -173,7 +173,7 @@ def check_imap_archive_folder(self, connection): def retrieve_imap_folder(self, connection): """Retrieve all mails for one IMAP folder.""" self.ensure_one() - msgids = self.get_msgids(connection, "UNDELETED") + msgids = self.get_msgids(connection, "UNSEEN UNDELETED") for msgid in msgids[0].split(): # We will accept exceptions for single messages try: diff --git a/fetchmail_attach_from_folder/wizard/attach_mail_manually.py b/fetchmail_attach_from_folder/wizard/attach_mail_manually.py index bd75b208d29..a57305e7fd1 100644 --- a/fetchmail_attach_from_folder/wizard/attach_mail_manually.py +++ b/fetchmail_attach_from_folder/wizard/attach_mail_manually.py @@ -42,7 +42,7 @@ def default_get(self, fields_list): folder = folder_model.browse([folder_id]) connection = folder.server_id.connect() connection.select(folder.path) - criteria = "FLAGGED" if folder.flag_nonmatching else "UNDELETED" + criteria = "FLAGGED" if folder.flag_nonmatching else "UNSEEN UNDELETED" msgids = folder.get_msgids(connection, criteria) for msgid in msgids[0].split(): mail_message, message_org = folder.fetch_msg(connection, msgid)