

In this example the script would be run at 08:00, 13:00, and 18:00 every day. To run it from cron you would just need to add a line to your crontab (with crontab -e) looking something like 00 08,13,18 * * * /usr/bin/python3 /home/user/dovecot-snooze.py Server.store(message_id, '+FLAGS', '\\Deleted \\Seen') Server.store(message_id, '-FLAGS', '\\Seen') Print("Found folder matching " + time_now) If(server.list(pattern=folder_name) != ): Server.login(user=USER, password=PASSWORD) Server = IMAP4_SSL(host=SERVER, port=PORT)

# matches the folder name otherwise it will miss that # This needs to be run at exactly the same time which # be named the time they should be moved in HHMM format # Folders are expected to be subfolders of 'Snooze' and # Check IMAP snooze folders for mail to move to inbox I decided to try creating a script that can be run periodically from cron, rather than something that would need to run in the background all the time. I guess Python would be easiest, there must be an IMAP library for it. So now to make a little script to do that. So I am just going to stick with a time so I can choose to be reminded the next morning or in the evening. If you wanted more control over the day and time then that could also be done by creating even more folders matching the requirements, but things would get messy then. If the script finds mail in a folder called 1300 and the time now is 13:00 then it will move that mail back to the inbox and mark it as unread. You could then move a mail into one of these folders using any email client and have a script running on a server which checks the folders every hour or so. These folders could be set as favorites in your email client to make it easier to move stuff to them. For example a folder called Snooze with subfolders 08 inside it. It looks like the best way to implement it myself would be to create some special IMAP folders which correspond to different reminder times. My mail server uses dovecot as the IMAP server which doesn’t support snoozing at the moment, I guess it is something that would need to be added to the IMAP protocol to make sure all mail clients could use a feature like that properly. I use IMAP for my main email addresses though and wanted to have that feature for them. Not long ago I noticed that my Gmail app allowed me to snooze an email and get the “new mail” notification pop up again later.
