Skip to content

Commit

Permalink
Added date in get_emails
Browse files Browse the repository at this point in the history
  • Loading branch information
JNAOB committed Nov 29, 2024
1 parent 2cd67ba commit 9d0aad7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions EMailService.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from smtplib import SMTP_SSL,SMTP_SSL_PORT
import email
from email.message import EmailMessage
from datetime import date


class ProtocolTemplate(ABC):
Expand All @@ -29,7 +30,7 @@ def delete_email(self, uid:int) -> bool:
"""Requierment: User is logged in"""
pass
@abstractmethod
def get_emails(self)->list[Email]:
def get_emails(self, date : date)->list[Email]:
pass

class ImapProtocol(ProtocolTemplate):
Expand Down Expand Up @@ -108,7 +109,7 @@ def delete_email(self, uid:int) -> bool:
if len(messages_ids)!= 0:
self.IMAP.delete_messages()

def get_emails(self)->list[Email]:
def get_emails(self, date : date)->list[Email]:
listofMails = []
self.IMAP.select_folder("INBOX")
messages_ids = self.IMAP.search(["ALL"])
Expand Down Expand Up @@ -253,7 +254,7 @@ def delete_email(self, uid:int) -> bool:
for item in self.acc.inbox.filter(message_id=uid):
item.move_to_trash()

def get_emails(self)->list[Email]:
def get_emails(self, date : date)->list[Email]:

if not self.logged_in:
return None
Expand Down

0 comments on commit 9d0aad7

Please sign in to comment.