How To Enable IMAP and POP3 with Dovecot on Ubuntu Server 20.04

Follow these steps to enable IMAP and POP3 with Dovecot

Step 1 : First, install the Dovecot binaries from the Ubuntu main repository:

sudo apt-get update
sudo apt-get install dovecot-imapd dovecot-pop3d

Step 2 : Next, proceed with configuring Dovecot. Open the file /etc/dovecot/dovecot.conf. By default Dovecot has enabled POP3 and IMAP protocols in main configuration file.

sudo nano /etc/dovecot/dovecot.conf

Step 3 : Open /etc/dovecot/conf.d/10-mail.conf and set the mailbox to be used. Dovecot supports mbox as well as Maildir. Make sure you set the correct path of your mail directory:

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

Step 4 : Open /etc/dovecot/conf.d/10-ssl.conf and uncomment or change the following lines to enable SSL authentication.

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

Step 5 : Restart the Dovecot daemon

sudo service dovecot restart

Step 6 : Test Dovecot by creating a telnet connection. You should see an output similar to the following:

telnet localhost pop3