Menu Close

How to set filters in roundcube with Sieve

Ok, You have your fantastic mail server with roundcube as web client.

All work great but hey, wait a moment… how can i set a filter in roundcube?

Filtering emails in webclient (gmail, outlook etc) its a normal thing but in your mail server it’s not automatic, and you have to do a bit of work for have it in your roundcube.

This is a quick tutorial on how to configure all on Ubuntu 12.04 with postfix+dovecot+roundcube (I assume that you already installed them).

Let’s start:

  • First of all, we install Sieve with:
    apt-get install dovecot-sieve dovecot-managesieved

    (Sieve is a tool that allow to set custom script for filter emails)

  • in /etc/dovecot/conf.d/20-lmtp.conf we add this:
    protocol lmtp {
      postmaster_address = postmaster@YOUR-DOMAIN.com
      mail_plugins = $mail_plugins sieve
    }
    

    (comment existing protocol lmtp configuration)

  • edit /etc/dovecot/conf.d/90-sieve.conf and inside “plugin” configuration add:
       sieve = ~/.dovecot.sieve
       sieve_global_path = /var/lib/dovecot/sieve/default.sieve
       sieve_dir = ~/sieve
       sieve_global_dir = /var/lib/dovecot/sieve/
    
  • edit /etc/dovecot/conf.d/20-managesieve.conf for enable listing on port 4190, this should be the top of config file:
    ##
    ## ManageSieve specific settings
    ##
    
    protocols = $protocols sieve
    
    # Service definitions
    
    service managesieve-login {
      inet_listener sieve {
        port = 4190
      }
    .........
  • now restart dovecot with:
    service dovecot restart
  • If you try to telnet 4190 it should answer as follow:
    root@server:/# telnet 127.0.0.1 4190
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.
    "IMPLEMENTATION" "Dovecot Pigeonhole"
    "SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave"
    "NOTIFY" "mailto"
    "SASL" "PLAIN LOGIN"
    "STARTTLS"
    "VERSION" "1.0"
    OK "Dovecot ready."
    
    
  • if all is working, now you can download filter plugin for roundube from:
     https://github.com/JohnDoh/Roundcube-Plugin-SieveRules-Managesieve

    and copy the content in:

     roundcube_folder/plugins/sieverules/
  • Activate the plugin in roundcube config file roundcube_folder/config/config.inc.php:
     $rcmail_config['plugins'] = array(......, 'sieverules');

 

And this is the result!
roundcube_filter

Posted in Domotica e Cloud, Linux, News

1 Comment

  1. Pingback:Enabling Filtering with Dovecot and Roundcube | Warren Argus

Leave a Reply

Your email address will not be published. Required fields are marked *