What am I doing wrong?

Ron Garret ron at flownet.com
Wed May 26 04:50:49 EEST 2021


I’m trying to run an imapsieve script when a user sends a message (this is part of a spam filter and I want to use outgoing messages to train the filter on good content).  This is my config:

plugin {

  sieve_plugins = sieve_imapsieve sieve_extprograms

  sieve = file:/var/mail/sieve/incoming.sieve

  # From elsewhere to Junk                                                      
  imapsieve_mailbox1_name = Junk
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_before = file:/var/mail/sieve/spam.sieve

  # From Junk to elsewhere                                                      
  imapsieve_mailbox2_name = *
  imapsieve_mailbox2_from = Junk
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/var/mail/sieve/ham.sieve              

  # Sent                                                                        
  imapsieve_mailbox3_name = 'Sent Messages'
  imapsieve_mailbox3_causes = APPEND
  imapsieve_mailbox3_before = file:/var/mail/sieve/sent.sieve

  sieve_pipe_bin_dir = /var/mail/sieve

  sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}

The first two scripts (for training spam and ham respectively) both work.  Once upon a time I had the third one working as well, but apparently I changed something that made it break and I have no idea what that could be.  (Yes, I need to get my code into revision control.  I’ve already beaten myself up over that more than once.)

The problem appears to be in the config, not the sieve script, because the script is never compiled into a .svbin while the other scripts in the same directory are compiled.  But just for the record, this is the sieve script:

> ➔ cat /var/mail/sieve/sent.sieve 
> require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
> 
> if environment :matches "imap.user" "*" {
>   set "username" "${1}";
> }
> 
> pipe :copy "train.py" [ "sent", "${username}" ];


Does anyone here see the problem that I’m missing?

Thanks,
rg



More information about the dovecot mailing list