Bootstrap FreeKB - Dovecot (Email) - Install Dovecot on Linux
Dovecot (Email) - Install Dovecot on Linux

Updated:   |  Dovecot (Email) articles

At a very simple high level, Postfix is the Mail Transfer Agent (MTA) sends email to a users inbox (Mail User Agent) via SMTP (port 25 or 465 or 587) and Dovecot is the Mail Delivery Agent (MDA) that retrieves email from a users inbox via POP3 (port 110 or 995) or IMAP (port 143 or 993).

 

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/

 

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable dovecot.

systemctl enable dovecot
systemctl start dovecot
systemctl status dovecot

 

If your system is using init, use the chkconfig and service commands to start and enable dovecot.

chkconfig dovecot on
service dovecot start
service dovecot status

 

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.

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.

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.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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