Ubuntu 14.04 Mail Server

This tutorial uses Ubuntu 14.04, Dovecot IMAP, Postfix, and Squirrelmail to create a standalone webmail server.

Installation

We need to install the three main mail server components: MTA (postfix), MDA (dovecot), MUA (squirrelmail). Postfix is included within mailutils.

apt-get install dovecot-imapd mailutils squirrelmail bsdutils dialog nano

Postfix Configuration

In /etc/postfix/main.cf, edit the lines to appear like this:

inet_interfaces = localhost

home_mailbox = Maildir/

Dovecot Configuration

In /etc/dovecot/conf.d/10-auth.conf, edit the lines to appear like this:

disable_plaintext_auth = yes

auth_mechanisms = plain login

In /etc/dovecot/conf.d/10-mail.conf, edit the lines to appear like this:

mail_location = maildir:~/Maildir

In /etc/dovecot/conf.d/10-master.conf, edit the lines to appear like this:

# Postfix smtp-auth

unix_listener /var/spool/postfix/private/auth {

mode = 0666

user = postfix

group = postfix

}

Squirrelmail Configuration

From the prompt, run squirrelmail-configure. Choose 2 for server settings, change:

  • domain [1] - [change to your domain]
  • IMAP settings [A]
    • server software [8] - type "dovecot" without the quotes
    • delimiter [9] - type "." without the quotes
  • Folder Defaults [3]
    • Default Sub. of INBOX [12] - choose no
    • Show 'Contain Sub.' Option [13] - choose no

Copy the squirrelmail apache config: cp /etc/squirrelmail/apache.conf /etc/apache2/sites-available/squirrelmail.conf

Apache Configuration

a2enmod ssl

a2ensite squirrelmail.conf

a2ensite default-ssl.conf

Load SSL/TLS certificate if desired.

Redirect to https in 000-default.conf:

Redirect "/" "https://webmail.example.com/"

Reboot server