Upload a Sieve script via ManageSieve and expect.
Pairs nicely with Stalwart. GitOps your email filters.
Install the dependencies:
apt install bash expect openssl coreutils
dnf install bash expect openssl coreutils
pacman -S bash expect openssl coreutils
apk add bash expect openssl coreutilsThen just specify the filename to upload and putsieve.sh will prompt for everything else:
putsieve.sh my_sieve_script.txtThe script will be named my_sieve_script on the server and will be set to active.
It's far nicer to drive all the configuration via environment variables:
SIEVE_FILENAME=foo.sieve \
SIEVE_HOSTNAME=mail.yay.wow \
SIEVE_PORT=4190 \
SIEVE_USERNAME=foo \
SIEVE_PASSWORD=$(op read "op://Private/abcefg/password") \
putsieve.sh