On 28/07/2025 20:46 EEST John via dovecot <dovecot@dovecot.org> wrote:
The developers are probably going to chuckle at me when they read this. :)
You are correct. " sieve_script before { ... }" should be enough according to my late night first read of the docs. I tried it, and it never called my script.
I tried to migrate my dovecot 2.3 to 2.4.1. I have a script_before line to be converted. I finally arrived at syntax that worked.
After reading the 2.4.1 docs again, I think my problem is the script name. My before script is named spam.sieve. Maybe what the docs are saying is this should work:
sieve_script before { # script needs to be called /etc/dovecot/before.sieve with before.svbin also at this location path = /etc/dovecot }
[My problem 1] Since spam.sieve was not called before.sieve, the script could not be found. Someone should test this idea.
There is sieve_script_name, sieve_script_type, and sieve_script_storage. Seems more involved than dovecot 2.3 and there is some auto sensing happening. It would be nice if the docs just say you must call your script before.sieve and it will work as a "before" script.
My problem 2: I wanted to remove the /etc/dovecot/sieve directory and run my before script from /etc/dovecot/spam.sieve. I placed spam.sieve and spam.svbin under /etc/dovecot. When I sent an email and it called spam.sieve, I received this error:
lmtp(john)<18431><WU7WN/9zhWj/RwAAfYjuOg>: Error: sieve: binary /etc/dovecot/spam.svbin: save: failed to create temporary file: open(/etc/dovecot/spam.svbin.) failed: Read-only file system
sieve looks at mtime when determining if a script needs to be recompiled or not. If you move/copy the files, the script mtime might end up newer than the svbin's, causing recompile.
Aki