Dovecot is a secure, open-source IMAP and POP3 server. It allows email clients to retrieve messages stored on the server. Combined with Postfix, Dovecot completes a full mail server stack. This guide installs Dovecot on Ubuntu 26.04 LTS with TLS and Maildir storage.

Tested and valid on:

  • Ubuntu 26.04 LTS

Prerequisites

  • Ubuntu 26.04 LTS with Postfix installed and configured
  • A valid SSL certificate (Let’s Encrypt recommended)
  • A user with sudo privileges

Step 1 – Install Dovecot

sudo apt update
sudo apt install dovecot-core dovecot-imapd dovecot-pop3d -y
dovecot --version

Step 2 – Configure Mailbox Location

sudo nano /etc/dovecot/conf.d/10-mail.conf

Set:

mail_location = maildir:~/Maildir

Step 3 – Configure Authentication

sudo nano /etc/dovecot/conf.d/10-auth.conf

Set:

disable_plaintext_auth = yes
auth_mechanisms = plain login

Step 4 – Configure TLS

sudo nano /etc/dovecot/conf.d/10-ssl.conf

Set:

ssl = required
ssl_cert = </etc/letsencrypt/live/mail.example.com/fullchain.pem
ssl_key = </etc/letsencrypt/live/mail.example.com/privkey.pem
ssl_min_protocol = TLSv1.2

Step 5 – Configure Postfix to Use Dovecot SASL

sudo nano /etc/postfix/main.cf

Add:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
sudo nano /etc/dovecot/conf.d/10-master.conf

Add to the service auth section:

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

Step 6 – Start and Enable Dovecot

sudo systemctl restart dovecot
sudo systemctl enable dovecot
sudo systemctl status dovecot

Step 7 – Test IMAP Connection

# Test with openssl:
openssl s_client -connect mail.example.com:993 -quiet

Or configure your email client (Thunderbird, Outlook) to connect to mail.example.com on port 993 (IMAP/SSL) or 143 (IMAP/STARTTLS).

Conclusion

Dovecot IMAP is installed on Ubuntu 26.04 LTS. Users can now connect email clients to retrieve their mail securely. Add SpamAssassin and Postfix spam filtering, then configure Sieve for server-side mail filtering.