View Single Post
Old 25th May 2013, 23:54
monkfish monkfish is offline
HowtoForge Supporter
Join Date: Mar 2013
Posts: 106
Thanks: 9
Thanked 15 Times in 14 Posts
Default Use Roundube instead of ISPConfig for SIEVE rules

I have put some notes together on what works for me. Userbase aren't really that taken with mailbox filter functionality inside ISPConfig (no disrespect intended, I think ISPConfig is awesome!) and I've tried to make my day a bit quieter by doing this! Here goes...

To disable ispconfig from managing SIEVE filters and use Roundcube functionality instead

- better support for multiple statements, eg "match1 AND match2", "match1 OR match2"
- support for filtering on size of email as well as subject, sender, content
- support for multiple actions, eg forward a copy AND move to folder
- users see folder list directly to choose where to filter mail

- Initial user education/familiarity of using roundcube to manage rules
- haven't found out where to disable mail filter screen for mailboxes inside ISPConfig yet. However, if users do enter rules there they WONT be actioned.
- watch out for subsequent ISPConfig upgrades as a small part of the core code is modified and will have to be reapplied on each update.

- ISPConfig 3 server running DOVECOT and SIEVE for filter processing
- Roundcube accessible for mailbox users
- Created / tested on CentOS 6.4 x64 (YMMV!)

Changes to dovecot

Install sieve support for dovecot:
yum install dovecot-pigeonhole
Edit /etc/dovecot/dovecot.conf and add sieve support to protocols:
protocols = imap pop3 sieve
Restart dovecot:
service dovecot restart
Changes to ispconfig code

Rewrite ispconfig to NOT write to users .sieve file (Roundcube has multiple rulesets and turns original .sieve filename into a symlink to active ruleset inside a new folder called sieve. We need to stop the filename from being overwritten)

Edit /usr/local/ispconfig/server/plugins-available/ Find lines that start "$sieve_file, (currently 100 and 217 could change in later versions of ISPConfig) and change ".sieve" to a different filename. Save the php file.

$sieve_file = $data["new"]["maildir"].'/.sieveispconfig';
$sieve_file = $data["old"]["maildir"].'/.sieveispconfig';
Changes to Roundcube

The sieve plugin is included by default in Roundcube, we just have to enable it. Edit config/ and enable plugin by adding to the array:

$rcmail_config['plugins'] = array('managesieve');
Log into roundcube as one of the mailbox users and under "settings" you should see a new tab called "filters".
Roundcube uses filter sets - you can have more than one set per user but only one is active at any one time.
You will see an empty filter set called "roundcube" which is now the default. Any previous sets will be greyed out.

NOTE: The syntax created by roundcube seems to be different than the syntax created by ispconfig (both work) so you may not be able to view the old ruleset correctly inside roundcube. It might be trivial for somebody to write a conversion script accordingly.

When creating filters you can choose a variety of attributes and actions for the ruleset. Changes are saved each time the ruleset is saved. Users can also start creating a filter direct from their mailbox - opening an email, selecting the gear icon at the top and "create filter" then following the wizard.

I hope this helps somebody else, please let me know if somethings not clear.

Last edited by monkfish; 26th May 2013 at 00:12.
Reply With Quote
Sponsored Links