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/13 14:05] – [Configuring Dovecot] willyemail:configure-dovecot [2026/04/07 06:49] (current) willy
Line 4: Line 4:
  
 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 +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 48: Line 75:
 Sieve let's you create custom filters that will filter your inbound emails. Sieve let's you create custom filters that will filter your inbound emails.
  
-Changes in **conf.d/20-lmtp.conf**:+Changes in **conf.d/90-sieve.conf**:
 <code> <code>
-protocol lmtp +sieve_script personal 
-  mail_plugins $mail_plugins sieve+  driver file 
 +  path = /home/vmail/storage/%{user | domain}/%{user | username}/sieve 
 +  active_path = /home/vmail/storage/%{user | domain}/%{user | username}/.dovecot.sieve
 } }
 </code> </code>
  
-And specify which folder should store the filters. +And enable sieve for lmtp (local delivery), edit **conf.d/20-lmtp.conf**:
- +
-Changes in **conf.d/90-sieve.conf**:+
 <code> <code>
-plugin +protocol lmtp 
-  sieve = file:/home/vmail/storage/%d/%n/sieve;active=/home/vmail/storage/%d/%n/.dovecot.sieve+    mail_plugins { 
 +    sieve = yes 
 +  }
 </code> </code>
 +
  
 ===== Setup authentication ===== ===== Setup authentication =====
Line 68: Line 98:
 <code> <code>
 auth_mechanisms = plain login auth_mechanisms = plain login
-#auth_default_realm = mydomain.com # is this needed? 
-#auth_realms = mydomain.com # is this needed? 
-#!include auth-system.conf.ext 
-!include auth-sql.conf.ext 
-</code> 
- 
-===== Setup SQL backend ===== 
- 
-Changes in **dovecot-sql.conf.ext**: 
-<code> 
-driver = sqlite 
-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 89: 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 100: 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 =====