如何创build一个文件夹,但不订阅它在达夫科特的筛?

我有Sieve规则:

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

基于此,主题中包含TOP-SECRET任何内容都将移至hidden-folder并设置为已读。

有没有办法通过sieve将Hidden-Folder设置为未订阅(从文件夹列表中隐藏)? 或者如何“pipe道”帐户订阅文件必须由脚本编辑?

我不认为有configuration这种行为的选项 – 既不在Sieve中,也不在Pigeonhole或Dovecotconfiguration中。

但是我可以提出一个解决方法:创build一个未订阅的隐藏文件夹,并将子目录放入该文件夹中。

如果您创build了一个文件夹,如您定义为取消订阅(手动或使用doveadm )的Hidden-Folder ,则操作fileinto :create "Hidden-Folder.Foo" will create the folder inside Hidden-Folder中fileinto :create "Hidden-Folder.Foo" will create the folder foo,但不会自动订阅。

您当然也可以使用vnd.dovecot.execute并运行doveadm mailbox unsubscribe以在运行fileinto之后doveadm mailbox unsubscribe订阅邮箱,甚至在提交邮件之前创build邮箱(不订阅邮箱)。 尽pipe如此,我并没有通过Sieve执行系统命令的感觉。 即使它只是一个预定义的命令,并具有良好的检查参数。

经过一些testing,我已经得到了所需的function,通过pipe道到外部脚本。

筛号代码如下所示:

 if envelope :matches "To" "*@*" { set "recipient" "${0}"; } if header :contains "subject" ["TOP-SECRET"] { setflag "\\Seen"; fileinto :create "Hidden-Folder"; pipe "my-script" ["${recipient}"]; stop; } 

然后筛pipemy-script代码看起来像

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

附注 – 确保/mnt/var/mailboxes中所有邮箱的所有者都是Dovecot。