Use Roundube instead of ISPConfig for SIEVE rules

Discussion in 'Tips/Tricks/Mods' started by monkfish, May 25, 2013.

  1. monkfish

    monkfish Member

    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: May 26, 2013
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you considered to use the roundcube ispconfig plugin instead? It allows to add filter rules as well from within roundcube but its compatible with ispconfig and offers even more functions for ispconfig mailboxes from within roundcube:
  3. Horfic

    Horfic Member

    beside of using my plugins, you can also create a backend for one of the available sieve plugins for roundcube.
  4. monkfish

    monkfish Member

    Ta for that, will check it out.
  5. DylanPedro

    DylanPedro Member HowtoForge Supporter

    Does anyone know if it is possible to add multiple search criteria to the ispconfig roundcube plugin when setting up filters as I can only see one rule per filter?

Share This Page