imap_sieve to learn spam and ham not working

Discussion in 'Installation/Configuration' started by m4xx, Jul 20, 2022.

  1. m4xx

    m4xx New Member

    I see no errors in my logs or any evidence that anything at all is happening when moving items to/from my imap inbox/junk folders.

    My configs are as follows

    99-ispconfig-custom-config.conf
    Code:
    protocol imap {
      mail_plugins = $mail_plugins imap_sieve
    }
    
    plugin {
      sieve_plugins = sieve_imapsieve sieve_extprograms
      sieve_pipe_bin_dir = /etc/dovecot/sieve
      sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
      sieve_execute_bin_dir = /etc/dovecot/sieve/bin
    
      # From elsewhere to Spam folder
      imapsieve_mailbox1_name = Junk
      imapsieve_mailbox1_causes = COPY
      imapsieve_mailbox1_before = file:/etc/dovecot/sieve/report-spam.sieve
    
      # From Spam folder to elsewhere
      imapsieve_mailbox2_name = *
      imapsieve_mailbox2_from = Junk
      imapsieve_mailbox2_causes = COPY
      imapsieve_mailbox2_before = file:/etc/dovecot/sieve/report-ham.sieve
    }
    /etc/dovecot/sieve/rspamd-learn-ham.sieve
    Code:
    require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
    if environment :matches "imap.mailbox" "*" {
        set "mailbox" "${1}";
    }
    
    if string "${mailbox}" "Trash" {
        stop;
    }
    
    pipe :copy "rspamc" ["learn_ham"];
    /etc/dovecot/sieve/rspamd-learn-spam.sieve
    Code:
    require ["vnd.dovecot.pipe", "copy", "imapsieve"];
    
    pipe :copy "rspamc" ["learn_spam"];
     

Share This Page