How to create default filtering rules for Ingo when using dovecot with sieve

Aus crazylinux.de
Wechseln zu: Navigation, Suche

There are situations when you want so ship a set of new rules for your users. This document aims to tell you how to do this.

I've set up a Debian Lenny system with dovecot / sieve and decided to use horde & ingo to manage my filtering rules. I took advantage of the sieve_global_path option of dovecot to create a global filtering rule. In my case it took care on spam. This rule did what it was supposed to do. But only until the user created his own rules. If the user has it's own filter, the global one is ignored and the user starts to wonder by spam is now delivered to his INBOX.

So what is the task? Define a default rule for ingo that is activated when the user creates his own filtering rules. Together with the global rule in dovecot it will make sure the user is not confused.

First we like to open the file ingo/config/prefs.php. In this file the default rules are defined. We like to create a rule that moved spam to folder spam. So we need to modify $_prefs['rules'] and $_prefs['spam']. For me the two arrays look like this:


$_prefs['rules'] = array(
    'value' => 'a:1:{i:0;a:8:{s:4:"name";s:11:"Spam Filter";s:7:"combine";i:1;s:10:"conditions";a:0:{}s:6:"action";i:14;s:12:"action-value";s:0:"";s:4:"stop";b:1;s:5:"flags";i:0;s:7:"disable";b:0;}}',
    'locked' => false,
    'shared' => false,
    'type' => 'implicit'
);

$_prefs['spam'] = array(
    'value' => 'a:2:{s:6:"folder";s:4:"spam";s:5:"level";s:1:"6";}',
    'locked' => false,
    'shared' => false,
    'type' => 'implicit'
);


mehr/more