Set up per user sieve rules
Hello!
I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server.
I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great.
My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need?
Thanks in advance for your help!
Austin Witmer
On 4/9/2022 6:00 PM, Austin Witmer wrote:
I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server.
I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great.
My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need?
Thanks in advance for your help!
I've got the user database for dovecot in a MySQL database managed by phpmyadmin.
This is what can be found as far as files and permissions for my email user's sieve setup:
https://paste.elyograg.org/view/8442b4d0
I use the managesieve plugin for roundcube to handle changes to my sieve script. At least I think that's what the plugin is called. I set it up a LONG time ago. Most of the time I access mail with Thunderbird. This is my doveconf -n output:
https://paste.elyograg.org/view/08536e83
If somebody sees something I should change in my config, please tell me. I am not an expert.
Thanks, Shawn
Thanks Shawn for your reply. I am a novice at this as well!
I should clarify that I have my user database in PostgreSQL.
The maildirs are at /mnt/volume1/mailserver/plain/maildir/austin
See below. What am I doing wrong?
austin@mail:/mnt/volume1/mailserver/plain/maildir/austin$ ls -la total 176 drwx------ 11 austin austin 4096 Apr 10 03:13 . drwx------ 6 austin austin 4096 Apr 9 03:03 .. drwx------ 5 austin austin 4096 Apr 10 00:07 .Codeblocks drwx------ 5 austin austin 4096 Apr 9 16:52 .Drafts drwx------ 5 austin austin 4096 Apr 10 00:41 .Sent drwx------ 5 austin austin 4096 Apr 9 22:18 .Trash lrwxrwxrwx 1 austin austin 18 Apr 10 03:13 .dovecot.sieve -> sieve/austin.sieve drwx------ 5 austin austin 4096 Apr 9 23:56 .test drwx------ 2 austin austin 4096 Apr 10 03:09 cur -rw------- 1 austin austin 31 Apr 5 17:35 dovecot-keywords -rw------- 1 austin austin 1631 Apr 10 03:08 dovecot-uidlist -rw------- 1 austin austin 8 Apr 9 23:03 dovecot-uidvalidity -r--r--r-- 1 austin austin 0 Apr 3 23:14 dovecot-uidvalidity.624a2a76 -rw------- 1 austin austin 1040 Apr 10 03:03 dovecot.index -rw------- 1 austin austin 25860 Apr 10 03:08 dovecot.index.cache -rw------- 1 austin austin 10804 Apr 10 03:09 dovecot.index.log -rw------- 1 austin austin 32852 Apr 10 00:05 dovecot.index.log.2 -rw------- 1 austin austin 888 Apr 10 00:04 dovecot.list.index -rw------- 1 austin austin 1340 Apr 10 03:03 dovecot.list.index.log -rw------- 1 austin austin 8292 Apr 9 23:56 dovecot.list.index.log.2 -rw------- 1 austin austin 120 Apr 9 23:03 dovecot.mailbox.log -rw------- 1 austin austin 0 Apr 3 23:14 maildirfolder drwx------ 2 austin austin 4096 Apr 10 03:09 new drwxrwxr-x 2 austin austin 4096 Apr 10 03:13 sieve -rw------- 1 austin austin 39 Apr 9 23:03 subscriptions drwx------ 2 austin austin 4096 Apr 10 03:08 tmp
Can anyone else chip in here to help me out?
Thanks so much!
Austin Witmer
On Apr 9, 2022, at 8:16 PM, Shawn Heisey elyograg@elyograg.org wrote:
On 4/9/2022 6:00 PM, Austin Witmer wrote:
I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server.
I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great.
My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need?
Thanks in advance for your help!
I've got the user database for dovecot in a MySQL database managed by phpmyadmin.
This is what can be found as far as files and permissions for my email user's sieve setup:
https://paste.elyograg.org/view/8442b4d0
I use the managesieve plugin for roundcube to handle changes to my sieve script. At least I think that's what the plugin is called. I set it up a LONG time ago. Most of the time I access mail with Thunderbird. This is my doveconf -n output:
https://paste.elyograg.org/view/08536e83
If somebody sees something I should change in my config, please tell me. I am not an expert.
Thanks, Shawn
This is the contents of /etc/dovecot/conf.d/90-sieve.conf
plugin { sieve = ~/.dovecot.sieve sieve_global_path = /var/lib/dovecot/sieve/default.sieve sieve_dir = ~/sieve sieve_global_dir = /var/lib/dovecot/sieve/ }
Does that give any further insights? The contents of that file make me think that would work if I was using unix users in my mail server instead of virtual users. Is there something that I need change to make this work with virtual users?
I am curious Shawn, what the contents of your /etc/dovecot/conf.d/90-sieve.conf file is?
Thanks,
Austin Witmer
On Apr 9, 2022, at 8:16 PM, Shawn Heisey elyograg@elyograg.org wrote:
On 4/9/2022 6:00 PM, Austin Witmer wrote:
I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server.
I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great.
My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need?
Thanks in advance for your help!
I've got the user database for dovecot in a MySQL database managed by phpmyadmin.
This is what can be found as far as files and permissions for my email user's sieve setup:
https://paste.elyograg.org/view/8442b4d0
I use the managesieve plugin for roundcube to handle changes to my sieve script. At least I think that's what the plugin is called. I set it up a LONG time ago. Most of the time I access mail with Thunderbird. This is my doveconf -n output:
https://paste.elyograg.org/view/08536e83
If somebody sees something I should change in my config, please tell me. I am not an expert.
Thanks, Shawn
On 4/9/2022 9:29 PM, Austin Witmer wrote:
I am curious Shawn, what the contents of your /etc/dovecot/conf.d/90-sieve.conf file is?
It's almost all comments. A LOT of detailed comments. Stripping those out:
root@bilbo:~# cat /etc/dovecot/conf.d/90-sieve.conf | egrep -v "^#|^\s+#|^$" plugin { sieve = file:/var/vmail/sieve/%d/%u/sieve;active=/var/vmail/sieve/%d/%u/.dovecot.sieve sieve_default = file:/var/vmail/global.sieve
}
I stole this from a website a long time ago about setting up a phpmyadmin/postfix/dovecot system.
Thanks, Shawn
On 10/04/2022 06:36 Shawn Heisey elyograg@elyograg.org wrote:
On 4/9/2022 9:29 PM, Austin Witmer wrote:
I am curious Shawn, what the contents of your /etc/dovecot/conf.d/90-sieve.conf file is?
It's almost all comments. A LOT of detailed comments. Stripping those out:
root@bilbo:~# cat /etc/dovecot/conf.d/90-sieve.conf | egrep -v "^#|^\s+#|^$" plugin { sieve = file:/var/vmail/sieve/%d/%u/sieve;active=/var/vmail/sieve/%d/%u/.dovecot.sieve sieve_default = file:/var/vmail/global.sieve
}
I stole this from a website a long time ago about setting up a phpmyadmin/postfix/dovecot system.
Thanks, Shawn
And to simplify this a lot:
sieve = ~/sieve;active=~/.dovecot.sieve
~/ expands to mail_home / home.
Aki
On 4/9/2022 9:36 PM, Shawn Heisey wrote:
sieve_default = file:/var/vmail/global.sieve
And in case it matters, here are the contents of the global.sieve file:
require ["envelope", "fileinto", "reject", "vacation", "regex", "relational", "comparator-i;ascii-numeric"];
#if header :contains "X-Spam-Flag" "YES" { # fileinto "Spam"; #}
# discard all mail with a spam score 25 or higher #if not header :contains "X-Spam-Score" "-" { # if header :value "ge" :comparator "i;ascii-numeric" # ["X-Spam-Score"] ["25"] { # discard; # stop; # } #}
I should probably uncomment at least the last block. For the other one, I don't know if that's safe to uncomment. If a destination folder does not exist, will sieve create it? If so, will it also auto-subscribe that folder? Based on errors I've gotten in my own sieve log, I don't think sieve will create it.
Thanks, Shawn
On 2022-04-10 00:00, Austin Witmer wrote:
Hello!
I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server.
I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great.
My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need?
Thanks in advance for your help!
Austin Witmer
Hi there,
You will need to configure ManageSieve in your 15-lda and 20-lmtp and create a service in 10-master and set sieve in dovecot.conf protocols.
In 90-plugin make sure to use sieve_before and compile its file using sievec if you want default sieve for every user and test on it,
If it worked then make sure there is personal modifiable one perhaps with User.sieve name and set with proper ownership settings given to LDA/LMTP user since its compiled when user receives an email, therefore refer to dovecot status or logs if there is permission issues. Lastly, you will have to create for it a symbolic link with .dovecot.sieve name referencing user.sieve personal file e.g. like the following:-
ln -s .../%u/User.sieve .../%u/.dovecot.sieve.
Refer to for more info https://wiki.dovecot.org/Pigeonhole/ManageSieve/Configuration
Zakaria.
Thanks to all of you for your tips. I am still struggling to process all of this, but will keep working at it.
Do you any of you know of a detailed tutorial on the net somewhere that would explain how to set this up from a-z?
Thanks again!
Austin Witmer
On Apr 10, 2022, at 12:00 PM, hi@zakaria.website wrote:
On 2022-04-10 00:00, Austin Witmer wrote:
Hello! I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server. I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great. My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need? Thanks in advance for your help! Austin Witmer
Hi there,
You will need to configure ManageSieve in your 15-lda and 20-lmtp and create a service in 10-master and set sieve in dovecot.conf protocols.
In 90-plugin make sure to use sieve_before and compile its file using sievec if you want default sieve for every user and test on it,
If it worked then make sure there is personal modifiable one perhaps with User.sieve name and set with proper ownership settings given to LDA/LMTP user since its compiled when user receives an email, therefore refer to dovecot status or logs if there is permission issues. Lastly, you will have to create for it a symbolic link with .dovecot.sieve name referencing user.sieve personal file e.g. like the following:-
ln -s .../%u/User.sieve .../%u/.dovecot.sieve.
Refer to for more info https://wiki.dovecot.org/Pigeonhole/ManageSieve/Configuration
Zakaria.
Thanks to all of you for your help!
I finally was able to get this figured out. My per user sieve rules are now working.
Austin Witmer
On Apr 10, 2022, at 10:20 PM, Austin Witmer austin96@emypeople.net wrote:
Thanks to all of you for your tips. I am still struggling to process all of this, but will keep working at it.
Do you any of you know of a detailed tutorial on the net somewhere that would explain how to set this up from a-z?
Thanks again!
Austin Witmer
On Apr 10, 2022, at 12:00 PM, hi@zakaria.website wrote:
On 2022-04-10 00:00, Austin Witmer wrote:
Hello! I am struggling to wrap my mind around how to set up sieve rules for my individual users on my mail server. I set up a global sieve script file at "/var/lib/dovecot/sieve/default.sieve” and that works great. My users maildirs are located at /mnt/volume1/mailserver/maildir/user. Do I need to create a sieve script file inside of that folder for sieve scripts to work on an individual basis? If so, what permissions will that script file need? Thanks in advance for your help! Austin Witmer
Hi there,
You will need to configure ManageSieve in your 15-lda and 20-lmtp and create a service in 10-master and set sieve in dovecot.conf protocols.
In 90-plugin make sure to use sieve_before and compile its file using sievec if you want default sieve for every user and test on it,
If it worked then make sure there is personal modifiable one perhaps with User.sieve name and set with proper ownership settings given to LDA/LMTP user since its compiled when user receives an email, therefore refer to dovecot status or logs if there is permission issues. Lastly, you will have to create for it a symbolic link with .dovecot.sieve name referencing user.sieve personal file e.g. like the following:-
ln -s .../%u/User.sieve .../%u/.dovecot.sieve.
Refer to for more info https://wiki.dovecot.org/Pigeonhole/ManageSieve/Configuration
Zakaria.
participants (4)
-
Aki Tuomi
-
Austin Witmer
-
hi@zakaria.website
-
Shawn Heisey