fix: manual mark as seen after getting email

This commit is contained in:
Zichao Lin 2024-07-25 20:02:06 +08:00
parent e54d35a9d7
commit 0ce2c5fb24
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB
2 changed files with 4 additions and 1 deletions

3
.gitignore vendored

@ -1,2 +1,3 @@
config.json
*.log
*.log
.vscode/

@ -89,6 +89,8 @@ def get_unforwarded_emails(account_config, logger):
if isinstance(response_part, tuple):
msg = email.message_from_bytes(response_part[1])
emails.append((email_id, msg))
imap.store(email_id, '+FLAGS', '\Seen')
imap.logout()
if len(emails) > 0:
logger.info(f"Retrieved {len(emails)} new emails from {account_config['email']}")