User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
email:configure-dovecot [2025/03/04 10:01] – [Main changes] willyemail:configure-dovecot [2026/04/07 06:49] (current) willy
Line 1: Line 1:
-====== Configuring Dovecot ======+====== G) Configuring Dovecot ======
  
 Dovecot configuation is stored in **/etc/dovecot**. There is a master file called **dovecot.conf** but most of the changes need to be applied to the files under **/etc/dovecot/conf.d**.  Dovecot configuation is stored in **/etc/dovecot**. There is a master file called **dovecot.conf** but most of the changes need to be applied to the files under **/etc/dovecot/conf.d**. 
  
 For each file, i will show you the changes from the defaults that you need to apply. For each file, i will show you the changes from the defaults that you need to apply.
 +
 +**NOTE:** Dovecot 2.4 introduced some changes to the config file. The following has been adapted to this new format.
  
 ===== Main changes ===== ===== Main changes =====
Line 11: Line 13:
 Edit **doveconf.conf**: Edit **doveconf.conf**:
 <code> <code>
-protocols imap lmtp sieve managesieve +dovecot_config_version 2.4.2 
-login_greeting IMAP server ready+dovecot_storage_version 2.4.2 
-# Optional DEBUG stuff to enable if things don't work: + 
-#auth_verbose = yes +!include_try conf.d/*.conf 
-#auth_verbose_passwords no + 
-#auth_debug = yes +protocols { 
-#auth_debug_passwords yes +  imap = yes 
-#mail_debug yes +  lmtp yes 
-#verbose_ssl = yes+  sieve = yes 
 +
 + 
 +mail_home /home/vmail/storage/%{user | domain}/%{user | username} 
 +mail_driver maildir 
 +mail_path = ~/maildir 
 + 
 +mail_uid = vmail 
 +mail_gid = vmail 
 + 
 +namespace inbox { 
 +  inbox = yes 
 +  separator = / 
 +
 + 
 +sql_driver = sqlite 
 +sqlite_path = /home/vmail/database/vmail.sqlite3 
 + 
 +passdb sql { 
 +  query = SELECT username, domain, password FROM mailbox WHERE username = '%{user}' AND active = 1 
 +
 + 
 +userdb sql { 
 +  query = SELECT CONCAT('/home/vmail/storage/', maildir) AS home, CONCAT('maildir:storage=', quota) AS quota FROM mailbox WHERE username = '%{user}' AND active = 1 
 +  iterate_query = SELECT username AS user FROM mailbox 
 +}
 </code> </code>
  
Line 44: Line 71:
 This is required because postfix will use dovecot to deliver mail to mailboxes internally and to perform SASL authentication as well. This is required because postfix will use dovecot to deliver mail to mailboxes internally and to perform SASL authentication as well.
  
-===== Setup authentication =====+===== Setup Sieve =====
  
-Changes in **conf.d/10-auth.conf**:+Sieve let's you create custom filters that will filter your inbound emails. 
 + 
 +Changes in **conf.d/90-sieve.conf**:
 <code> <code>
-auth_mechanisms plain login +sieve_script personal { 
-#auth_default_realm mydomain.com # is this needed? +  driver file 
-#auth_realms mydomain.com # is this needed? +  path /home/vmail/storage/%{user | domain}/%{user | username}/sieve 
-#!include auth-system.conf.ext +  active_path /home/vmail/storage/%{user | domain}/%{user | username}/.dovecot.sieve 
-!include auth-sql.conf.ext+}
 </code> </code>
  
-===== Setup SQL backend =====+And enable sieve for lmtp (local delivery), edit **conf.d/20-lmtp.conf**: 
 +<code> 
 +protocol lmtp { 
 +    mail_plugins { 
 +    sieve yes 
 +  } 
 +</code>
  
-Changes in **dovecot-sql.conf.ext**:+ 
 +===== Setup authentication ===== 
 + 
 +Changes in **conf.d/10-auth.conf**:
 <code> <code>
-driver sqlite +auth_mechanisms plain login
-connect = /home/vmail/database/vmail.sqlite3 +
-password_query = SELECT username, domain, password FROM mailbox WHERE username = '%u' AND active = 1 +
-user_query = SELECT CONCAT('/home/vmail/storage/', maildir) AS home, CONCAT('maildir:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = 1 +
-iterate_query = SELECT username AS user FROM mailbox+
 </code> </code>
  
Line 70: Line 104:
 Changes in **conf.d/10-mail.conf**: Changes in **conf.d/10-mail.conf**:
 <code> <code>
-mail_location maildir:/home/vmail/storage/%d/%n/maildir +mail_home = /home/vmail/storage/%{user | domain}/%{user | username} 
-mail_uid = 5000 +mail_driver = maildir 
-mail_gid = 5000+mail_path = ~/maildir 
 + 
 +mail_uid = vmail 
 +mail_gid = vmail
 </code> </code>
  
Line 81: Line 118:
 Changes in **conf.d/10-ssl.conf**: Changes in **conf.d/10-ssl.conf**:
 <code> <code>
-ssl_cert </etc/letsencrypt/live/mail.mydomain.com/fullchain.pem +ssl = yes 
-ssl_key </etc/letsencrypt/live/mail.mydomain.com/privkey.pem+ssl_server { 
 +  cert_file = /etc/letsencrypt/live/... domain ... ]/fullchain.pem 
 +  key_file = /etc/letsencrypt/live/... domain ... ]/privkey.pem 
 +}
 </code> </code>
- 
-===== Setup Sieve and ManageSieve ===== 
- 
-TBD 
- 
-<code> 
-# Sieve 
-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 
-</code> 
- 
  
 ===== Testing ===== ===== Testing =====