How to Install and Setup Dovecot on Linux

Home > Search > How-to
  by

Use apt-get or yum to install dovecot.

~]# yum install dovecot

 

In the /etc/dovecot/dovecot.conf file, configure the protocol you want Dovecot to use.

protocols = imap imaps pop3 pop3s

 

In the /etc/dovecot/dovecot.conf file, configure the interfaces you want Dovecot to use. * listens on all IPv4 interfaces, and :: listens on all IPv6 interfaces.

listen = *, ::

 

In the /etc/dovecot/dovecot.conf file, configure the base Dovecot directory.

base_dir = /var/run/dovecot/

 

Restart Dovecot, and ensure Dovecot is active and running.

~]# systemctl restart dovecot
~]# systemctl enable dovecot
~]# systemctl status dovecot

 

Open ports 110 and 143 in iptables or firewalld.

Telnet can be used to ensure you are able to connect to Dovecot on ports 110 and 143.  Replace "password" with User1 actual password.

[root@server1 ~]# telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user user1
+OK
pass password
+OK logged in.
list
1 439
2 318
.
retr 1
+OK 439 octets
Return-Path: <root@example.com>
X-Original-To: user1@example.com
Delivered-To: user1@example.com
Received: from localhost (localhost [IPv6:::1])
    by mail.example.com (Postfix) with ESMTP id DD8D385G83G
    for <user1@example.com>; Sun, 16 Aug 2015 00:30:08 -0500 (CDT)
Message-Id: <201607010182227.BFB1B1001D@mail.example.com>
Date: Sun, 10 Jul 2016 00:00:01 -0500 (CDT)
From: root@example.com

Hello World
.
quit
+OK Logging out.
Connection closed by foreign host.

 

IMAP (port 143) test.

[root@server1 ~]# telnet localhost 143
Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready.
a login user1 password
a OK [CAPABILITY IMPA4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORE SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in
a list "" "*"
* LIST (\HasNoChildren) "." INBOX
a OK list completed
a examine inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS ()] Read-only mailbox.
* 2 EXISTS
* 0 RECENT
* OK [UNSEEN 2] First unseen.
* OK [UIDVALIDITY 1468252124] UIDs valid
* OK [UIDNEXT 3] Predicted next UID
a OK [READ-ONLY] Examine completed (0.000 secs).
a fetch 1 body[]
* 1 FETCH <BODY[] {439}
Return-Path: <root@example.com>
X-Original-To: user1@example.com
Delivered-To: user1@example.com
Received: from localhost (localhost [IPv6:::1])
    by mail.example.com (Postfix) with ESMTP id DD8D385G83G
    for <user1@example.com>; Sun, 16 Aug 2015 00:30:08 -0500 (CDT)
Message-Id: <201607010182227.BFB1B1001D@mail.example.com>
Date: Sun, 10 Jul 2016 00:00:01 -0500 (CDT)
From: root@example.com

Hello World
)
a OK Fetch completed
a logout
* BYE Logging out
a OK Logout completed.
Connection closed by foreign host.

 

If the email is not showing in the list after entering the ls command, check the mail logs.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments