Trying to clean up an IMAP on AWS
MAIL_SERVER [imap.mail.us-east-1.awsapps.com]: MAIL_PORT [993]: USERNAME [user@domain.com.br]: PASSWORD [MyPassword]: MAX_DAYS [700]:
2023-04-08 19:32:08 Connecting to mailbox via IMAP... (\HasNoChildren) = Outbox
- Found a total of 0 messages in 'Outbox'.
- Nothing to remove. (\HasNoChildren \Trash) = "Deleted Items"
- Found a total of 0 messages in '"Deleted Items"'.
- Nothing to remove. (\HasNoChildren \Sent) = "Sent Items"
- Found a total of 0 messages in '"Sent Items"'.
- Nothing to remove. (\HasNoChildren \Drafts) = Drafts
- Found a total of 0 messages in 'Drafts'.
- Nothing to remove. (\HasNoChildren \Junk) = "Junk E-mail"
- Found a total of 0 messages in '"Junk E-mail"'.
- Nothing to remove. (\HasNoChildren) = Trash
- Found a total of 11 messages in 'Trash'.
- Marked 11 messages for removal with dates before 08-May-2021 in 'Trash'.
Traceback (most recent call last): File "clear-old-emails-imap.py", line 46, in move_to_trash_before_date m.store("{0}:{1}".format(start, end), '+X-GM-LABELS', '\Trash') # move to trash File "/usr/lib/python3.8/imaplib.py", line 842, in store typ, dat = self._simple_command('STORE', message_set, command, flags) File "/usr/lib/python3.8/imaplib.py", line 1205, in _simple_command return self._command_complete(name, self._command(name, *args)) File "/usr/lib/python3.8/imaplib.py", line 1030, in _command_complete raise self.error('%s command error: %s %s' % (name, typ, data)) imaplib.error: STORE command error: BAD [b'Error in IMAP command STORE: Invalid messageset (0.001 + 0.000 secs).']
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "clear-old-emails-imap.py", line 94, in move_to_trash_before_date(m_con, folder[1], config.MAX_DAYS) File "clear-old-emails-imap.py", line 49, in move_to_trash_before_date print("Deleting message #{0} error:\n{1}".format(num, Exception.with_traceback())) TypeError: descriptor 'with_traceback' of 'BaseException' object needs an argument