Hi,
I have a problem with storing messages into a Spam folder by dovecot. Log says that message was stored into Spam mailbox but when I check there is no message in users's Spam mailbox.
cat /var/log/mail.log | grep sieve | grep Spam :
Feb 17 05:09:11 mailserver dovecot: lda(user@domain): sieve:
        msgid=<b599df639ffa4d20f6e8d2bcff791286@somedomain.pl>:
        stored mail into mailbox 'Spam'
    
 
    
Where are these messages if not in the Spam folder where they should be? /var/vmail/domain/user/Maildir/.Spam/cur/
    
    
    
 dovecot -n
      # 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
      # Pigeonhole version 0.4.13 (7b14904)
      # OS: Linux 4.4.0-104-generic x86_64 Ubuntu 16.04.3 LTS ext4
      auth_gssapi_hostname = mailserver.belpol.local
      auth_krb5_keytab = /etc/dovecot/dovecot.keytab
      auth_mechanisms = gssapi plain
      first_valid_gid = 117
      first_valid_uid = 111
      listen = *
      log_timestamp = "%Y-%m-%d %H:%M:%S "
      mail_gid = ebox
      mail_home = /var/vmail/%d/%u
      mail_location = maildir:/var/vmail/%d/%u/Maildir
      mail_uid = ebox
      managesieve_notify_capability = mailto
      managesieve_sieve_capability = fileinto reject envelope
      encoded-character vacation subaddress comparator-i;ascii-numeric
      relational regex imap4flags copy include variables body enotify
      environment mailbox date index ihave duplicate mime foreverypart
      extracttext
      namespace inbox {
        inbox = yes
        location =
        mailbox Drafts {
          auto = subscribe
          special_use = \Drafts
        }
        mailbox Sent {
          auto = subscribe
          special_use = \Sent
        }
        mailbox "Sent Messages" {
          auto = no
          special_use = \Sent
        }
        mailbox Spam {
          auto = create
          special_use = \Junk
        }
        mailbox Trash {
          auto = subscribe
          special_use = \Trash
        }
        prefix =
        separator = /
        subscriptions = yes
      }
      passdb {
        args = /etc/dovecot/dovecot-ldap.conf
        driver = ldap
      }
      plugin {
        quota = maildir:User quota
        quota_rule = *:storage=0
        sieve = /var/vmail/%Ld/%Ln/sieve-script
        sieve_before = /var/vmail/sieve/default.sieve
        sieve_default = /var/vmail/sieve/default.sieve
        sieve_dir = /var/vmail/%Ld/%Ln
        sieve_global_path = /var/vmail/sieve/default.sieve
        sieve_storage = /var/vmail/%Ld/%Ln
      }
      protocols = pop3 imap sieve
      service auth {
        executable = /usr/lib/dovecot/auth
        unix_listener /var/spool/postfix/private/auth {
          group = postfix
          mode = 0660
          user = postfix
        }
        unix_listener auth-master {
          group = ebox
          mode = 0600
          user = ebox
        }
      }
      service imap-login {
        inet_listener imap {
          address = *
          port = 143
        }
        inet_listener imaps {
          address = *
          port = 993
        }
      }
      service lmtp {
        unix_listener /var/spool/postfix/private/dovecot-lmtp {
          group = postfix
          mode = 0666
          user = postfix
        }
      }
      service managesieve-login {
        inet_listener sieve {
          port = 4190
        }
      }
      service pop3-login {
        inet_listener pop3 {
          port = 110
        }
        inet_listener pop3s {
          port = 995
        }
      }
      ssl_cert = </etc/dovecot/private/dovecot.pem
      ssl_key = </etc/dovecot/private/dovecot.pem
      userdb {
        args = /etc/dovecot/dovecot-ldap.conf
        default_fields = uid=111 gid=117
        driver = ldap
      }
      protocol imap {
        mail_max_userip_connections = 20
        mail_plugins = quota imap_quota
      }
      protocol pop3 {
        mail_plugins = quota
      }
      protocol lda {
        auth_socket_path = /var/run/dovecot/auth-master
        mail_plugins = sieve quota
        postmaster_address = postmaster
      }
    
    
    
default.sieve:
require ["fileinto"];
      # rule:[SPAM]
      if header :contains "X-Spam-Flag" "YES" {
       fileinto "Spam";
      }
      if header :contains "subject" ["***UNCHECKED***", "SPAM"] {
       fileinto "Spam";
      }