From (adapted to CWP):
https://support.tigertech.net/sieve#sieve-filtering-for-jmp-2Sieve 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:
/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:
/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”.