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:
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.