## Dovecot configuration file

listen = *, ::

mail_plugin_dir = /usr/lib/dovecot
base_dir = /var/run/dovecot
instance_name = dovecot

protocols = imap lmtp pop3

# TLS stuff
ssl = yes
ssl_cert = </etc/letsencrypt/live/example.net/fullchain.pem
ssl_key = </etc/letsencrypt/live/example.net/privkey.pem

# Authentication
auth_mechanisms = plain login
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
auth_username_format = %n
disable_plaintext_auth = no

# Valid users
first_valid_uid = 143
last_valid_uid = 1003
first_valid_gid = 6
last_valid_gid = 1008

lda_mailbox_autocreate = yes
imap_capability = +SPECIAL-USE

# Hostname
hostname = example.net

protocol lmtp {
	mail_plugins = $mail_plugins sieve
}

passdb {
  driver = pam
}

userdb {
  driver = passwd
}

service auth {
	unix_listener auth-userdb {
		mode = 0660
		user = dovecot
		group = mail
	}
}
service lmtp {
        unix_listener lmtp {
                mode = 0660
                user = dovecot
                group = mail
        }
}


# Mailbox
mail_location = maildir:~/Maildir
mailbox_list_index = yes
mail_uid = dovecot
mail_gid = dovecot

namespace inbox {
	type = private
	inbox = yes
	mailbox Archive {
		special_use = \Archive
		auto = create
	}
	mailbox Drafts {
		special_use = \Drafts
		auto = create
	}
	mailbox Sent {
		special_use = \Sent
		auto = create
	}
	mailbox Junk {
		special_use = \Junk
		auto = create
		autoexpunge = 30d
	}
	mailbox Trash {
		special_use = \Trash
		auto = create
		autoexpunge = 7d
	}
}

plugin {
	sieve = yes
	sieve_after = /etc/dovecot/sieve
}
