diff options
| author | Mole Shang <135e2@135e2.dev> | 2023-01-25 16:40:48 +0800 | 
|---|---|---|
| committer | Mole Shang <135e2@135e2.dev> | 2023-01-25 16:40:48 +0800 | 
| commit | 12b38b59e73f45c542d87bd2acf553f837e20179 (patch) | |
| tree | 586632713db2e0b484b467add7f2ffce47d344c5 /utils | |
| parent | b6d4781af03497c19442cc2081790793bbe25e87 (diff) | |
| download | telegram-mail-bot-12b38b59e73f45c542d87bd2acf553f837e20179.tar.gz telegram-mail-bot-12b38b59e73f45c542d87bd2acf553f837e20179.tar.bz2 telegram-mail-bot-12b38b59e73f45c542d87bd2acf553f837e20179.zip | |
feat: support showing mails list
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/client.py | 10 | 
1 files changed, 9 insertions, 1 deletions
| diff --git a/utils/client.py b/utils/client.py index e0bd2f9..676a859 100644 --- a/utils/client.py +++ b/utils/client.py @@ -34,9 +34,17 @@ class EmailClient(object):      def get_mail_by_index(self, index):          list = self.get_mails_list() -        msg_data = list[int(index)-1][1] +        msg_data = list[int(index) - 1][1]          return Email(msg_data[b"RFC822"]) +    def get_listed_mails(self): +        list = self.get_mails_list() +        listed_mails = [] +        for i in range(0, self.get_mails_count()): +            email = Email(list[i][1][b"RFC822"]) +            listed_mails.append([email.subject, email.sender, email.date]) +        return listed_mails +      def __enter__(self):          return self | 
