auth_mechanisms = plain login
disable_plaintext_auth = no
first_valid_uid = 100
mail_gid = dovecot
mail_max_userip_connections = 20
mail_plugins = notify mail_log
mail_uid = dovecot
protocols = imap pop3 sieve
ssl = required
ssl_cert = </etc/ssl/certs/services.pem
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA
ssl_key = </etc/ssl/private/services.key
ssl_min_protocol = TLSv1.2

namespace inbox {
  inbox = yes
  separator = /

  mailbox "Nevyžádaná pošta" {
    auto = subscribe
    special_use = \Junk
    autoexpunge = 30d
  }

  mailbox "Odstraněná pošta" {
    auto = subscribe
    special_use = \Trash
    autoexpunge = 30d
  }

  mailbox Koncepty {
    auto = subscribe
    special_use = \Drafts
  }

  mailbox "Odeslaná pošta" {
    auto = subscribe
    special_use = \Sent
  }
}

plugin {
  imapsieve_mailbox1_name = "Nevyžádaná pošta"
  imapsieve_mailbox1_causes = COPY APPEND
  imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/learn-spam.sieve

  imapsieve_mailbox2_name = *
  imapsieve_mailbox2_from = "Nevyžádaná pošta"
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/learn-ham.sieve

  mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename
  mail_log_fields = uid box msgid size from

  sieve_before = /usr/lib/dovecot/sieve/spam-global.sieve
  sieve_global_extensions = +vnd.dovecot.pipe
  sieve_pipe_bin_dir = /usr/lib/dovecot/sieve
  sieve_plugins = sieve_imapsieve sieve_extprograms
}

protocol imap {
  imap_capability = +SPECIAL-USE
  mail_plugins = $mail_plugins imap_sieve
}

protocol pop3 {
  pop3_client_workarounds = outlook-no-nuls
  pop3_uidl_format = %08Xu%08Xv
}

protocol lda {
  mail_plugins = $mail_plugins sieve
}

service auth {
  unix_listener /var/spool/postfix/private/dovecot-auth {
    user = postfix
    group = postfix
    mode = 0660
  }
}

service imap-login {
  service_count = 0
  process_min_avail = 2
}

service pop3-login {
  service_count = 0
  process_min_avail = 2
}

service managesieve-login {
  service_count = 0
  process_min_avail = 1
}

userdb {
  args = /etc/dovecot/dovecot-pgsql.conf
  driver = sql
}

passdb {
  args = /etc/dovecot/dovecot-pgsql.conf
  driver = sql
}
