To set up IMAP and POP3 on redhat variant, install the Dovecot package via the DNF package manager, configure the protocols in /etc/dovecot/dovecot.conf, enable SSL/TLS, open firewall ports, and start the service.
1. Install Dovecot
Install the required Dovecot packages for IMAP/POP3 services:
bash
sudo dnf install dovecot dovecot-imapd dovecot-pop3d -y
Use code with caution.
2. Configure Dovecot Protocols
Open the main configuration file and ensure the imap and pop3 protocols are enabled. You also need to define the local mailbox location.
Open /etc/dovecot/dovecot.conf in your text editor:
bash
sudo nano /etc/dovecot/dovecot.conf
Use code with caution.
Uncomment or add the following lines:
text
protocols = imap pop3
mail_location = maildir:~/Maildir
Use code with caution.
3. Configure SSL/TLS (Highly Recommended)
It is highly recommended to enforce encryption to prevent plaintext credential leaks. Edit /etc/dovecot/conf.d/10-ssl.conf to set up your SSL certificates:
text
ssl = required
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
Use code with caution.
(Note: Replace the default self-signed paths with your actual Let’s Encrypt or commercial SSL certificate paths for production).
4. Adjust the Firewall
Open the necessary firewall ports for IMAP (993 for secure, 143 for non-secure) and POP3 (995 for secure, 110 for non-secure) using firewalld:
bash
sudo firewall-cmd --permanent --add-service=imap --add-service=imaps --add-service=pop3 --add-service=pop3s
sudo firewall-cmd --reload
Use code with caution.
5. Enable and Start the Service
Configure Dovecot to run on boot and start the daemon immediately:
bash
sudo systemctl enable --now dovecot
Use code with caution.
6. Connect Using Your Email Client
When configuring your email client (e.g., Outlook, Thunderbird), use the following settings:
- Incoming Server Type: IMAP or POP3
- Incoming Port:
993(IMAP over SSL/TLS) or995(POP3 over SSL/TLS) - Authentication: Normal Password (PLAIN/LOGIN) over TLS