Setting Recent Flag on New Messages?
Haravikk
dovecot at haravikk.me
Thu Jan 28 15:51:18 UTC 2016
So I’m looking at setting up some house-keeping for my dovecot mailboxes, specifically deleting messages in trash, spam etc., by deleting Seen messages older than X days.
In order to protect against the edge case of a user reading a message right before the deletion task however I’d like to do something like the following:
doveadm expunge -A OLD SEEN BEFORE 7d MAILBOX Trash
doveadm flags -A remove '\Recent' SEEN BEFORE 7d MAILBOX Trash
(except I’m actually doing this per-user with a script and per-user settings for flexibility, but you get the idea)
Basically the expunge step only deletes messages without the Recent flag (and which haven’t been marked as unseen again). It then removes this flag from messages which have been seen, so that they will be deleted next time the expunge command runs. In other words, if this command runs once a day, there will be a minimum delay of 24 hours between a message being seen, and then being deleted.
However I can’t for the life of me figure out how to set the Recent flag except via doveadm flags. While I could periodically run doveadm -A flags add ‘\Recent’ SEEN or such this doesn’t seem like a great way to do it (adding the flag after the messages are stored), really I’d rather do it as they arrive. I’ve tried sieve, but it can’t set this flag.
Have I managed to completely miss an option for setting this when new messages arrive?
More information about the dovecot
mailing list