1

I have Sieve rule:

 if header :contains "subject" ["TOP-SECRET"] {
    setflag "\\Seen";
    fileinto :create "Hidden-Folder";
    stop;
}

based on which anything what includes TOP-SECRET in the subject is moved to the hidden-folder and set as read.

Is there any way to set that Hidden-Folder as not subscribed (hidden from the folder list) via sieve? Or how "pipe" which account subscriptions file must to be edited by a script?

  • The "subscriptions" file (in user Maildir) save the folders subscribed by the user. The Hidden-Folder can be added by the user with its mail software – Dom Dec 6 '16 at 19:59
  • I know that but I need to set up that folder to be "hidden" (not subscribed) by default not by a mailbox user. – JackTheKnife Dec 6 '16 at 20:02
  • I think you can't but I will read the other answers – Dom Dec 6 '16 at 20:10
0

I don't think there's an option to configure such behavior -- neither in Sieve nor in the Pigeonhole or Dovecot configuration.

But I can propose a workaround: Create an unsubscribed, hidden folder and put subdirectories into that.

If you create a folder like Hidden-Folder which you define as unsubscribed (either manually or using doveadm), an action fileinto :create "Hidden-Folder.Foo" will create the folderfooinsideHidden-Folder`, but not automatically subscribe it.

You could of course also use vnd.dovecot.execute and run doveadm mailbox unsubscribe to unsubscribe the mailbox after running fileinto, or even create the mailbox (without subscribing it) before filing the message. I'm not really having a good feeling executing system commands through Sieve, though; even if it's only a predefined command with well-checked parameters.

0

After some testing I have got desired functionality to work via piping it to an external script.

Sieve code looks like:

if envelope :matches "To" "*@*" {
  set "recipient" "${0}";
}

     if header :contains "subject" ["TOP-SECRET"] {
        setflag "\\Seen";
        fileinto :create "Hidden-Folder";
        pipe "my-script" ["${recipient}"]; 
        stop;
    }

then sieve-pipe my-script code looks like

#!/bin/bash

mbox=$1
result=`find /mnt/var/mailboxes -type d -name $mbox`
perl -pi -e 's/Hidden-Folder//g' $result/subscriptions

Side note - be sure that owner of all mailboxes in /mnt/var/mailboxes is Dovecot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.