Part Four: Configuring Dovecot for IMAP connections

This is the fourth part of the tutorial on installing a mail server, refer the overview, or hit the tutorials menu at the top, and look at the mail server tutorial category.

In this section I explain how to install Dovecot to expose your mail directory to your various client applications (iPhones, iPads, laptops and PCs), and have that mail kept in synch across all those devices.  To do this, we use Dovecot as an IMAP server, IMAP being a protocol that allows mail clients to add folders, move around mail messages and do the usual mail stuff, all working against a shared server mailbox.

This tutorial assumes you’ve completed parts two and three, so you have a virtualised mail server that has Exim running on it to deliver mail into a mail box that is in Maildir format in /home/<user>.  So, let’s get on with installing dovecot.

First, install dovecot itself

  aptitude install dovecot-imapd

Configure dovecot to expect mail to be in maildir format in user’s home directories, by editing /etc/dovecot/conf.d/10-mail.conf, changing the mail location as follows:

  mail_location = maildir:~/Maildir

Then restart dovecot:

  /etc/init.d/dovecot restart

Now, try sending mail to yourself, and verify that it gets delivered. To do this, log on as your base user that you created when setting up your server. Start the mail program:


In the address field, enter your username. In the subject enter whatever you want, press enter. Type in a test message, and press ctrl+d to exit. Now look in your user’s home directory, you should see a Maildir has been created, and a mail message is in ~/Maildir/new.
Dovecot has very useful defaults, so there is not much else to configure. Next, configure your mail client to connect to this server. This should be pretty easy, other than needing to accept the security exception for the self-signed certificate.
All going well, you now have an IMAP server and an SMTP server, so you can send and receive e-mail from your various devices.


3 thoughts on “Part Four: Configuring Dovecot for IMAP connections

  1. Pingback: Part One: Install a secure Debian Wheezy imap mail server into a virtual using Exim, Dovecot, Fetchmail | technpol

  2. If you connect directly to dovecot you will get a self signed dovecot ceritficate.
    If you want to use your own certificates, just edit /etc/dovecot/conf.d/10-ssl.conf and set certificate paths or just overwrite the default certificate files.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s