Skip to content

Instantly share code, notes, and snippets.

@sburlot
Created April 23, 2024 07:56
Show Gist options
  • Save sburlot/076a570e533bfbf1219581b4dd11eaf6 to your computer and use it in GitHub Desktop.
Save sburlot/076a570e533bfbf1219581b4dd11eaf6 to your computer and use it in GitHub Desktop.
Mark snoozed emails from FastMail as UNREAD
#!/usr/bin/python3
# When snoozing a Fastmail ( fastmail.com ) message, mark it as unread so when it appears
# again in the INBOX it's unread and I can see it, instead of being another
# email lost in all my messages
# run it as an hourly cron
# tested with Python 3.10.12
#
# Stephan Burlot [email protected] Apr 2024
#
from imap_tools import MailBox, MailMessageFlags, AND
mailbox = MailBox('imap.fastmail.com')
mailbox.login('LOGIN_NAME', 'SECRETPASSWORD', 'Snoozed')
mailbox.flag(mailbox.uids(AND(seen=True)), MailMessageFlags.SEEN, False)
mailbox.logout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment