[Dovecot] Marking all mail in one folder of public mailbox as read

Timo Sirainen tss at iki.fi
Thu Oct 18 06:31:19 EEST 2012


On 17.10.2012, at 15.44, Frerich Raabe wrote:

> I'm running Dovecot 1.2.17 on FreeBSD 9 to serve an archive of a few internal mailinglists. The archive is implemented using a public namespace:
> 
> namespace private {
>  separator = /
>  prefix =
>  inbox = yes
> }
> 
> namespace public {
>  separator = /
>  prefix = Lists/
>  location = maildir:/home/vmail/lists/Maildir:CONTROL=~/Maildir/lists:INDEX=~/Maildir/lists
>  subscriptions = no
> }
> 
> As you can see, the CONTROL/INDEX files are stored per-user to allow private \Seen flags. The different mailinglists are all sent to the 'lists' user which has a Sieve script to file them into different folders, so I have directories on my harddisk like
> 
>  /home/vmail/lists/Maildir/.somelist
>  /home/vmail/lists/Maildir/.anotherlist
> 
> Now, I'd like to mark the mail in *one* of those folders as \Seen by default. If the INDEX files weren't per-user, it would simply be a matter of using 'addflag "\Seen";' in the Sieve script of the lists user. Alas, this has no effect.
> 
> Hence my question - how can I have the mail of just one mailinglist get marked as "read" for all users?

You can't with the above settings. It would require writing the seen flag to all users' index files. Not easy to do and definitely not efficient to do. Maybe if there was some kind of a mixed hybrid of accepting seen flag changes from the shared index, but no such code exists (also private/shared index separation doesn't exist before v2.2).

> So far, the only option I see is to add a second public namespace, with a different prefix - and this namespace doesn't use private CONTROL/INDEX files. However, I'd like to keep using the "Lists" prefix if possible to avoid too many changes to the clients.

Use:

prefix=Lists/anotherlist/
location = maildir:/home/vmail/lists/sharedseen/Maildir

Then deliver the mails to /home/vmail/lists/sharedseen/Maildir root directly. Of course this means that you need to create a namespace for each such list.

Alternative would be to use prefix=Lists/sharedseen/ and create lists under it.




More information about the dovecot mailing list