POP3 (Post Office Protocol 3) and IMAP (Internet Message Access Protocol) both are protocols works as message accessing agent. These protocols are used to fetch email messages from user inboxes on mail servers. In simple words, POP3 and IMAP are responsible to fetch messages from mailboxes and show them on your mobile device or web interface. This tutorial will help you to install and configure the Dovecot service on Ubuntu 20.04 system.


A running Ubuntu 20.04 system Pre-configured mail server and user Mailboxes Shell access with root or sudo privileged account

Step 1 – Install Dovecot on Ubuntu

Debian-based systems have separate packages of Dovecot for IMAP and POP3 protocols. To install Dovecot server with the POP3 and IMAP functions support, run the following command: You can also install various Dovecot modules like MySQL and PostgreSQL database support, mail filtering, full-text search, spam filter training, and LDAP directory. To install additional modules run:

Step 2 – Dovecot Configuration

Once the installation is finished, configure the Dovecot server as per your requirements. Here is the quick and useful configuration of Dovecot to work on your system.

Step 3 - Manage Dovecot Service

We can manage dovecot using the systemctl command-line tool. Use the following command to enable the Dovecot service. Use the following commands to start/stop or restart Dovecot service: Use the below command to view the current status of the service

Step 4 - Test Configuration

To test this setup, I have created an account with name “rahul” on Ubuntu system. The mbox setting on Postfix server is configured to ~/Maildir directory. Next, you need a mutt command-line utility to connect the mailbox using IMAP protocol. Then connect to mailbox using below command: This will prompt to accept certificate (Press a for accept always). After that, it will prompt for the password. Enter user password and press enter. You will see the emails of your account.

Step 5 - Open Ports with FirewallD

For the systems running with firewalld need to allow following ports to allow access from network. Below is the list of port used by the POP3 and IMAP protocols:

IMAP - 143 IMAPS - 993 POP3 - 110 POP3S - 995

To add the firewall rules, execute the following commands: Then reload the changes.


In this tutorial, you have learned to install and configure the Dovecot server on the Ubuntu system. You have configured your server to access the user mailbox via POP3 or IMAP protocols.

How to Install Dovecot on Ubuntu 20 04   TecAdmin - 32