{{ ansible_managed | comment }}

# imap and sieve configuration

protocols = imap sieve

## fallback if clients failt after golive: enable imap
#service imap-login {
#  inet_listener imap {
#    address = *
#    port = 143
#  }

# enable imap-ssl:
service imap-login {
  # increase perfomance:
  process_limit = 2048
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}

# required for roundcube
service managesieve-login {
  inet_listener sieve {
    address = *
    port = 4190
  }
}

# IMAP configuration
protocol imap {
  # Mail plugins:
  # - fts fts_squat are for full text search indexing https://wiki1.dovecot.org/Plugins/FTS/Squat
  # - for public mailboxes (T211595, 16.04.2021, Kalinowski): required: acl + imap_acl
  mail_plugins = $mail_plugins imap_sieve fts fts_squat acl imap_acl
}

protocol lda {
  mail_plugins = $mail_plugins sieve
  log_path = /var/log/dovecot-lda.log
}

# do not change from old setting, or all folder will mode in clients under INBOX
# TODO: test if we need this at all or if we can just remove it
namespace {
  separator = .
  prefix = INBOX.
  inbox = no
  hidden = yes
  list = no
  alias_for =
}

# Plugins configuration
plugin {
  sieve_plugins = sieve_imapsieve sieve_extprograms
  sieve = file:/vol/mail/sieve/%d/%n/scripts;active=/vol/mail/sieve/%d/%n/active-script.sieve
  sieve_before = /vol/mail/sieve/global/spam-global.sieve

  ###
  ### Spam learning
  ###
  # From elsewhere to Junk folder
  imapsieve_mailbox1_name = Junk
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_before = file:/vol/mail/sieve/global/report-spam.sieve

  # From Junk folder to elsewhere
  imapsieve_mailbox2_name = *
  imapsieve_mailbox2_from = Junk
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/vol/mail/sieve/global/report-ham.sieve

  sieve_pipe_bin_dir = /usr/bin
  sieve_global_extensions = +vnd.dovecot.pipe
}
