club-1 / hosting

Hosting on CLUB1
https://club1.fr
6 stars 1 forks source link

Add sieve server to dovecot #51

Closed n-peugnet closed 2 years ago

n-peugnet commented 2 years ago

To add spam filtering, and also allow users to define filters. This is what is used for instance by Roundcube and Sogo.

n-peugnet commented 2 years ago

Done !

It was even super easy to install:

sudo apt install dovecot-sieve dovecot-managesieved

and configure:

commit 94e0455730dad2af009770aa12123e1c531df6b2 (HEAD -> master)
Author: n-peugnet <n.peugnet@free.fr>
Date:   Fri Sep 2 15:06:40 2022 +0200

    email: configure sieve filtering and managesieve

    For now only roundcube is allowed to edit the filters.
    Editing them with a native client would have anyway be a suboptimal experience.
    For instance, a plugin has to be added to thunderbird to be able to do it.

diff --git a/dovecot/conf.d/99-club1.conf b/dovecot/conf.d/99-club1.conf
index 76334c8..fcdaee9 100644
--- a/dovecot/conf.d/99-club1.conf
+++ b/dovecot/conf.d/99-club1.conf
@@ -7,13 +7,18 @@ protocol imap {
   mail_plugins = $mail_plugins imap_quota
 }

+protocol lmtp {
+  # Enable Sieve filtering on LMTP to filter incoming emails.
+  mail_plugins = $mail_plugins sieve
+}
+
 # Mailbox list indexes can be used to optimize IMAP STATUS commands. They are
 # also required for IMAP NOTIFY extension to be enabled and for better quota
 # performances using the count backend.
 mailbox_list_index = yes

 # enable imap protocol
-protocols = imap lmtp
+protocols = imap lmtp sieve

 # enable Maildir storage format
 mail_location = maildir:~/mail
diff --git a/roundcube/config.inc.php b/roundcube/config.inc.php
index afe144a..6f9944a 100644
--- a/roundcube/config.inc.php
+++ b/roundcube/config.inc.php
@@ -112,6 +112,7 @@ $config['plugins'] = [
        'archive',
        'attachment_reminder',
        'hide_blockquote',
+       'managesieve',
        'newmail_notifier',
        'vcard_attachments',
        'zipdownload',