Author Topic: Need Domain specific sieve script instead of system global  (Read 1648 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Need Domain specific sieve script instead of system global
« on: December 18, 2020, 08:46:58 PM »
Let me ask this a better way.  Reading this file:
/etc/dovecot/conf.d/90-sieve.conf

 # The default Sieve script when the user has none. This is a path to a global
 # sieve script file, which gets executed ONLY if user's private Sieve script
 # doesn't exist. Be sure to pre-compile this script manually using the sievec
 # command line tool.
 # --> See sieve_before fore executing scripts before the user's personal
 #     script.
 #sieve_default = /var/lib/dovecot/sieve/default.sieve

It sounds like there's no way for a mail server to have a virtual domains specific sieve script.   It's either each virtual user has to have their own sieve script OR ELSE the global /var/lib/dovecot/sieve/default.sieve takes over.  This isn't very useful when you are running multiple email domains.   

I'm trying to come from a procmail environment where I can do user, domain and system-wide rules however I want.  Any ideas?

Offline
*
Re: Need Domain specific sieve script instead of system global
« Reply #1 on: December 19, 2020, 06:02:37 AM »
email filters per mailbox can be generated from the user panel using email filters or from the roundcube.
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
***
Re: Need Domain specific sieve script instead of system global
« Reply #2 on: July 20, 2021, 12:04:10 AM »
From (adapted to CWP):
https://support.tigertech.net/sieve#sieve-filtering-for-jmp-2

Sieve filtering for an entire domain name

In addition to filters for each mailbox, it’s possible to create filters that apply to all addresses at your domain name. This is done by placing script files named “domain-before.sieve” and/or “domain-after.sieve” in your domain’s home directory:
Code: [Select]
/var/vmail/example.com/domain-before.sieve
/var/vmail/example.com/domain-after.sieve

You can put these on the server using an FTP connection to your home directory, or by using SFTP or a shell connection (both of which always have access to your home directory).

A “domain-before.sieve” script (if one exists) runs before any per-mailbox “mailbox.sieve” script, and a “domain-after.sieve” script (if one exists) runs after. So when a message arrives, three different Sieve script files will be searched for and used if present, in this order:
Code: [Select]
/var/vmail/example.com/domain-before.sieve
/var/vmail/example.com/mailboxuser/mailbox.sieve
/var/vmail/example.com/domain-after.sieve

Each script is used only if a previous script didn’t discard the message or file it into a folder, so the order matters. If you want to create domain-wide rules that override “mailbox.sieve” scripts, you’d put them in the “domain-before.sieve” script. To create domain-wide rules that are used only if “mailbox.sieve” doesn’t do anything, you’d put them in “domain-after.sieve”.