Setting Recent Flag on New Messages?

Timo Sirainen tss at iki.fi
Fri Jan 29 19:57:49 UTC 2016


> On 29 Jan 2016, at 17:09, Haravikk <e-mail at haravikk.me> wrote:
> 
> 
>> On 29 Jan 2016, at 14:29, Timo Sirainen <tss at iki.fi> wrote:
>> 
>> \Recent flag is special and you can't add/remove it. It's not even internally stored like regular flags.
> 
> Are you certain? The following commands seem to work just fine:
> 
> 	doveadm flags add -A ‘\Recent’ OLD UNSEEN
> 	doveadm search -A NEW
> 
> Before I ran the first command, the second wouldn’t return anything, so \Recent does seem to be set via doveadm flags, doveadm fetch flags also seems to confirm this.

I don't know how that would be possible.

>> I think what you want instead is:
>> 
>> doveadm expunge -A old seen savedbefore 7d mailbox Trash
> 
> While you’re right that I should probably be using saved before, I’m trying to find an alternative to this specific command because it seems like it would be possible for a message that’s 7 days old to potentially to be opened by the user such that is flagged as seen, but is actually still being read when the command is run, allowing it to be expunged before the user has a chance to do anything with it. Or is the saved before value updated when flags are changed?

There are no timestamps that are updated when a message flags are changed. I suppose if you have a nightly cronjob you could run:

doveadm expunge -A keyword seen-yesterday mailbox Trash
doveadm flags add -A 'seen-yesterday' seen savedbefore 7d mailbox Trash

So it guarantees that the \Seen flag was added at least the day before.



More information about the dovecot mailing list