Skip to content

Commit

Permalink
Merge branch 'EmailInfra' of https://github.com/koesterlab/remail int…
Browse files Browse the repository at this point in the history
…o EmailInfra
  • Loading branch information
JNAOB committed Nov 29, 2024
2 parents dcbb3a0 + 6fb0584 commit c96d7ca
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions EMailService.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ def get_emails(self, date : datetime = None)->list[Email]:
html_files = html_parts)]
return listofMails

def get_deleted_emails(self,uids:list[str])->list[str]:
listofUIPsIMAP = []
for mailbox in self.IMAP.list_folders():
self.IMAP.select_folder(mailbox)
messages_ids = self.IMAP.search(["ALL"])
for message_data in self.IMAP.fetch(messages_ids,["RFC822","UID"]).items():
listofUIPsIMAP.append(message_data.get(b"UID"))
self.IMAP.close_folder(mailbox)
return uids-listofUIPsIMAP

def mark_email(self,uid:str,read:bool):
if read:
self.IMAP.add_flags(uid,["SEEN"])
else:
self.IMAP.remove_flags(uid,["SEEN"])



class ExchangeProtocol(ProtocolTemplate):

Expand Down

0 comments on commit c96d7ca

Please sign in to comment.