14

I am new to setting up a mail server, and everywhere I look I get either outdated or really complex instructions on setting up a mail server.

Is there any simple methods on installing an IMAP mail server?

1 Answers1

27

You can use Dovecot for mail server

  1. Install the packages

    sudo apt-get install dovecot-imapd dovecot-pop3d

  2. Configure the protocol you need to be used by appending the protocol in the file /etc/dovecot/dovecot.conf:

    protocols = pop3 pop3s imap imaps

  3. Choose the mailbox you would like to use. Dovecot supports maildir and mbox formats. Edit the file /etc/dovecot/dovecot.conf and change the line

    mail_location = maildir:~/Maildir # (for maildir)

    or

    mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u # (for mbox)

  4. Restart the service

    sudo /etc/init.d/dovecot restart

  5. Use telnet to check that dovecot is working properly.

    telnet localhost imap

That's it.

PS. Also make sure your firewall is configured properly to accept connections on the appropriate ports.

Source : Official Dovecot Server Documentation

Tarun
  • 4,245
  • 13
  • 50
  • 74
  • 1
    Great answer. However, you might want to enhance this a little by explaining how to tell if one is using mbox or maildir formats, as well as the fact that on Ubuntu 14.04 Server, it uses Upstart for Dovecot now and so you have to do "start/stop/restart/status dovecot" type commands. – Volomike Mar 20 '15 at 17:31
  • 1
    Also, I found that if you get a prompt for SSL, skipping it will cause dovecot not to load. You'll have to do a self-signed SSL on the mail until you can replace with a real cert. Also, dpkg-reconfigure dovecot-imap doesn't work -- you'll have to do apt-get --purge remove dovecot-core dovecot-imapd dovecot-pop3d to remove and start over. – Volomike Mar 20 '15 at 19:57
  • 1
    Current dovecot version uses a /etc/dovecot/conf.d where it stores different configuration files, so protocol selection is made placing files there. Anyway, there's no need to modify anythin, default installation already sets everything right. – jesjimher Aug 04 '17 at 13:02
  • 1
    Docs can now be found at https://help.ubuntu.com/18.04/serverguide/dovecot-server.html, but I don't know if the rest of the answer needs reviewing since 2013... – mwfearnley Dec 24 '19 at 15:16