how to configure imapsieve to be used per user

Sebastian Bachmann hello at reox.at
Fri Oct 28 06:13:18 UTC 2022


Okay, I could have enabled debug log earlier, than that would have been 
easy... Thanks for the hint.

The key is to specify the sieve script inside the sieve directory 
without the .sieve suffix, i.e.:

a SETMETADATA test (/shared/imapsieve/script "imap")

which points to sieve/imap.sieve in the user's homedir.

Now it loads the script:

Debug: Mailbox test: Mailbox opened because: UID move
Debug: imapsieve: mailbox test: MOVE event
Debug: imapsieve: mailbox test: Mailbox attribute 
/shared/imapsieve/script points to Sieve script `imap'
Debug: sieve: file script: Opened script `imap' from 
`/srv/vmail/username/sieve/imap.sieve'
Debug: sieve: Opening script 1 of 1 from 
`/srv/vmail/username/sieve/imap.sieve'
Debug: sieve: Loading script /srv/vmail/username/sieve/imap.sieve
Debug: sieve: Script `imap' from /srv/vmail/username/sieve/imap.sieve 
successfully compiled
Debug: sieve: Executing script from `/srv/vmail/username/sieve/imap.sieve'


On 27.10.2022 23:33, Paul Kudla wrote:
> 
> ok fair enuff
> 
> are you using a db to set the dir's
> 
> there is a master sieve (all) directory that handles the entire server 
> (message duplicate supression etc)
> 
> mine is in
> 
> [17:26:12] mail18.scom.ca [root:0] /usr/local/etc/dovecot/sieve
> # ll
> total 38
> drwxr-xr-x  2 vmail  vmail  uarch    4B Apr  2  2022 .
> drwxr-xr-x  5 root   wheel  uarch   29B Oct 27 07:41 ..
> -rw-r--r--  1 vmail  vmail  uarch   97B Apr  2  2022 duplicates.sieve
> -rw-r--r--  1 vmail  vmail  uarch  227B Apr  2  2022 duplicates.svbin
> 
> [17:26:17] mail18.scom.ca [root:0] /usr/local/etc/dovecot/sieve
> 
> 
> 
> from there each user (assuming dovecot config is correct will have it's 
> own sieve folder under the maildir
> 
> example :
> 
> # mbox abuse at scom.ca
> 
> [17:27:24] mail18.scom.ca [root:0] 
> /data/dovecot/users/scom.ca/abuse at scom.ca
> # ll
> total 293
> drwx------   11 vmail  vmail  uarch   25B Oct 27 16:48 .
> drwx------  164 vmail  vmail  uarch  164B Oct 27 06:52 ..
> drwx------    5 vmail  vmail  uarch    8B Oct 27 16:48 .Drafts
> drwx------    5 vmail  vmail  uarch    8B Oct 27 16:48 .Sent
> drwx------    5 vmail  vmail  uarch    8B Oct 27 16:48 .Trash
> -rw-------    1 vmail  vmail  uarch  1.4K Oct 26 16:49 .dovecot.lda-dupes
> drwx------    5 vmail  vmail  uarch    7B Oct 27 16:48 
> .dovecot.lda-dupes.locks
> drwx------    2 vmail  vmail  uarch    2B Oct 26 16:48 cur
> -rw-------    1 vmail  vmail  uarch  8.3K Oct 26 16:49 dovecot-uidlist
> -rw-------    1 vmail  vmail  uarch    8B Oct 26 16:49 dovecot-uidvalidity
> -r--r--r--    1 vmail  vmail  uarch    0B Oct 26 16:48 
> dovecot-uidvalidity.63599d11
> -rw-------    1 vmail  vmail  uarch  3.7K Oct 27 16:48 dovecot.index
> -rw-------    1 vmail  vmail  uarch   34K Oct 27 16:48 dovecot.index.cache
> -rw-------    1 vmail  vmail  uarch  644B Oct 27 16:48 dovecot.index.log
> -rw-------    1 vmail  vmail  uarch   40K Oct 27 16:48 dovecot.index.log.2
> -rw-------    1 vmail  vmail  uarch  968B Oct 27 16:48 dovecot.list.index
> -rw-------    1 vmail  vmail  uarch  1.7K Oct 27 16:48 
> dovecot.list.index.log
> -rw-------    1 vmail  vmail  uarch  8.2K Oct 27 16:48 
> dovecot.list.index.log.2
> -rw-------    1 vmail  vmail  uarch   96B Oct 26 16:48 dovecot.mailbox.log
> drwx------    2 vmail  vmail  uarch    9B Oct 26 16:49 lucene-indexes
> -rw-------    1 vmail  vmail  uarch    0B Oct 26 16:48 maildirfolder
> drwx------    2 vmail  vmail  uarch  142B Oct 26 16:49 new
> drwx------    3 vmail  vmail  uarch    6B Oct 26 16:49 sieve
> -rw-------    1 vmail  vmail  uarch   29B Oct 26 16:48 subscriptions
> drwx------    2 vmail  vmail  uarch    2B Oct 26 16:49 tmp
> 
> 
> and then :
> 
> [17:27:42] mail18.scom.ca [root:0] 
> /data/dovecot/users/scom.ca/abuse at scom.ca/sieve
> # ll
> total 67
> drwx------   3 vmail  vmail  uarch    6B Oct 26 16:49 .
> drwx------  11 vmail  vmail  uarch   25B Oct 27 16:48 ..
> lrwx------   1 vmail  vmail  uarch   13B Oct 27 16:48 .dovecot.sieve -> 
> forward.sieve
> -rw-------   1 vmail  vmail  uarch  239B Oct 26 16:49 .dovecot.svbin
> -rw-------   1 vmail  vmail  uarch   31B Oct 26 16:48 forward.sieve
> drwx------   2 vmail  vmail  uarch    2B Oct 26 16:48 tmp
> 
> [17:27:44] mail18.scom.ca [root:0] 
> /data/dovecot/users/scom.ca/abuse at scom.ca/sieve
> 
> for a user script to be active you need to set the script active (after 
> uploading etc?) which creates a link from dovecot.sieve to the script 
> and a .svbin file (i believe, this is an observation on my side)
> 
> if all this is setup properly then the script should execute?
> 
> please note my system is db driven and i am using virtual maildir's
> 
> if you are doing this manually then make sure the dovecot's user right's 
> are correct
> 
> you are probably far enough along the set
> 
> mail_debug = yes
> 
> in dovecot.conf (remember to restart the server)
> 
> this should dump a wack of logging somewhere (file or syslog)
> 
> sieve or pigeonhole will be in there when you try to do something
> 
> fyi
> 
> 
> 
> fyi
> 
> 
> 
> 
> 
> Happy Thursday !!!
> Thanks - paul
> 
> Paul Kudla
> 
> 
> Scom.ca Internet Services <http://www.scom.ca>
> 004-1009 Byron Street South
> Whitby, Ontario - Canada
> L1N 4S3
> 
> Toronto 416.642.7266
> Main 1.866.411.7266
> Fax 1.888.892.7266
> Email paul at scom.ca
> 
> On 10/27/2022 4:06 PM, Sebastian Bachmann wrote:
>>
>>
>>
>> On 27.10.2022 13:54, Paul Kudla wrote:
>>> again may (probably not) what you are looking for but it at least 
>>> gives another example(s)
>>
>> No, actually I was looking for something different. The TO and me were 
>> looking for imapsieve examples and how they can be configured on a per 
>> user & per mailbox basis.
>>
>> I tried now some things, and I'm at least one step further. The 
>> important parts seemed to be:
>>
>> * Enable IMAP METADATA
>> * Set `imapsieve_url = sieve://server:4190` (is that correct?)
>>
>> Now you can add the metadata, for example to the mailbox "test":
>> a SETMETADATA test (/shared/imapsieve/script "sieve/imap.sieve")
>>
>> However, from this point on it does not work. I created a very simple 
>> example, which should simple copy any mail that is moved into the 
>> folder (right?):
>>
>> require ["copy"];
>> redirect :copy "some_other_email_address";
>>
>> but it looks like the script is never started.
>> Is this because I mis-configured the path? Or something else? It is in 
>> the same folder as I store the other scripts, i.e., ~/sieve (the 
>> normal sieve scripts work fine)
>>
>> -Sebastian
>>


More information about the dovecot mailing list