This website content is no longer under development.
Setting up the email server on my home server was probably the most difficult task. As noted in the various recipes herein, email server setup is intricate, risky and involves significant commitment and effort to setup reliably and maintain.
My first email server was setup on an Ubuntu 14.04 virtual machine on my home server. It was based upon the setup recipe given in the blog "Beware Here Be Musings", Installing a Mailserver on Ubuntu 14.04 LTS, Part 1 and Part 2. I got the mailserver to run well after a couple of attempts. It is simple and performs well and a good starting point to learn from. Limitations include: the database is a semi-manual setup, and addition of virtual mail users must be performed manually. There is also no webmail setup instructions which generally requires integration with a web server and the associated setup.
Most recipes I found are limited in some ways. They assume use of a commercial remote server, whereas I have setup on a homeserver on a virtual machine. Few note the external setup requirements, DNS, MX, SPF and reverse DNS, which must be performed to get operating, and ensure best operating practices, a notable exception being Linode's Running a Mail Server.
A more comprehensive recipe I found was from Ex Ratione - A Mailserver on Ubuntu 16.04: Postfix, Dovecot, MySQL, Postfixadmin, Roundcube. An Apache webserver is installed for webmail and Postfix admin. A Mailserver on Ubuntu 12.04: Postfix, Dovecot, MySQL is for an earlier version recipe, but uses Horde instead of Roundcube for the web mail access. The Horde project is a groupware webmail, and has more groupware functions than Roundcube.
Basically follow the setup given in A Mailserver on Ubuntu 18.04: Postfix, Dovecot, MySQL, Postfixadmin, Roundcube, with the following comments:
sudo mysql -u root -p
SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE;
A quick and dirty description to help with the email client setup, SMTP and IMAP or POP3.
IMAP Client Settings
Email address: admin@example.com
Server Type: IMAP
Server: mail.example.com
Port: 993
Username: admin@example.com
Encryption method: SSL (on dedicated port)
Authentication: Password
POP3 Client Settings
Email address: admin@example.com
Server Type: POP3
Server: mail.example.com
Port: 995
Username: admin@example.com
Encryption method: SSL (on dedicated port)
Authentication: Password
SMTP Client Settings
Server: mail.example.com
Port: 25
TICK, Server requires authentication
Encryption Method: TLS (start after connecting)
Username: admin@example.com
Auth Type: Login
A quick and dirty description to help with the email client setup, SMTP and IMAP or POP3 for Gmail and MSOutlook (Hotmail).
Gmail
IMAP Client Settings
server address: imap.gmail.com
user name: Your full Gmail address (e.g. me@gmail.com)
password: Your Gmail password
With Gmail 2-step authentication enabled, use an application-specific Gmail password.
IMAP port : 993
IMAP TLS/SSL required: yes
POP3 Client Settings
server address: pop.gmail.com
user name: Your full Gmail address (e.g. me@gmail.com)
password: Your Gmail password
With Gmail 2-step authentication enabled, use an application-specific Gmail password.
IMAP port : 995
IMAP TLS/SSL required: yes
SMTP Client Settings
server address: smtp.gmail.com
user name: Your full Gmail address (e.g. me@gmail.com)
password: Your Gmail password
With Gmail 2-step authentication enabled, use an application-specific Gmail password.
SMTP port (TLS): 587
SMTP TLS/SSL required: yes
MSOutlook / Hotmail
IMAP Client Settings
server address: imap-mail.outlook.com
user name: Your full email address (e.g. me@hotmail.com)
password: Your hotmail password
IMAP port : 993
IMAP TLS/SSL required: yes
POP3 Client Settings
server address: pop-mail.outlook.com
user name: Your full email address (e.g. me@hotmail.com)
password: Your hotmail password
IMAP port : 995
IMAP TLS/SSL required: yes
SMTP Client Settings
server address: smtp-mail.outlook.com
user name: Your full email address (e.g. me@hotmail.com)
password: Your hotmail password
SMTP port (TLS): 587
SMTP port (SSL): 465
SMTP TLS/SSL required: yes (STARTTLS)
I attempted to use the instructions from Exratione A Mailserver on Ubuntu 18.04: Postfix, Dovecot, MySQL, Postfixadmin, Roundcube to install Roundcube. However the package database configuration failed. So I instead followed the instructions given in LinOxide How to Install Roundcube Webmail on Ubuntu 18.04. These instructions assume an already working LAMP stack and running email server and down load the latest install files directly from RoundCube, i.e. do not use the Unbuntu apt package system.
Some tips on the LinOxide instructions:
create new file: "/etc/apache2/sites-available/roundcube.conf" and add following:
<Directory /var/www/html/webmail>
Options +FollowSymLinks
AllowOverride All
AllowOverrideList None
<RequireAll>
Require all granted
</RequireAll>
</Directory>
<Directory /var/www/html/webmail/installer>
Options +FollowSymLinks
AllowOverride None
AllowOverrideList None
<RequireAll>
Require all denied
</RequireAll>
</Directory>
To enable site configuration: "sudo a2ensite roundcube.conf"
Some additional followups:
In order to direct default traffic to the webmail page I added directive "Redirectmatch ^/$ https://mail.kptree.net/webmail" to the apaches site configuration file /etc/apache2/sites-available/sub1.example.com-ssl.conf.
Attempt to follow ExRatione - A Mailserver on Ubuntu 12.04: Postfix, Dovecot, MySQL 19) Install Horde 5 for Webmail, full copy with update to get working on current Ubuntu 16.04 install. However upon following this procedure it look like it is quite outdated in many ways. Upon further investigation I found this installation description that looks more up to date and functional, Howtoforge Install Horde 5 Webmail For ISPConfig On Debian Wheezy Through PEAR. The Horde site instructions Installing Horde Framework 5 and Installing Horde Groupware Webmail Edition 5 states "These are very terse instructions how to install Horde Groupware Webmail Edition and its prerequisites on a LAMP system. They are addressed to experienced administrators who know exactly what they are doing.". A last key reference is the Horde Horde Administrator's FAQ.
To summarise my feeling on Horde, basically it is too complicated to setup and use. It looks to be beyond the needs of a simple home server. At the time of writing (2017-01-03) the current version of Horde is not optimised for PHP7, which is standard with Ubuntu 16.04, which leads to further complications with the install. Exratione in subsequent later version of its installations instructions went with Roundcube for webmail interface. Furthermore some of the key features I was looking for, such as shared calendar and contact resources are included in Nextcloud. Whilst I managed to get Horde webmail running, there are still a number of issues with it that I have not been able to resolve. At this time I have decided not to proceed with using Horde. These instructions are therefore incomplete.
"sudo apt update"
"sudo apt install php7.0-dev php-pear php7.0-tidy php-imagick" (no php5-sasl, php-auth-sasl?)
"sudo apt install php-geoip geoip-bin" (packages geoip-database and libgeoip1 included in php-geoip install)
"sudo apt install php-xml-serializer php-memcache php7.0-soap php7.0-intl"
"sudo apt install libidn11-dev libmagickwand-dev imagemagick" (libmagick++4?)
"sudo apt install libsasl2-dev php-ssh2 php-http-webdav-server" (no libssh2-php, php-ssh2?, no libphp-jpgraph)
sudo pecl channel-update pear.php.net
sudo pear channel-update pear.php.net
sudo pecl install lzf - with messages:
Check the Pear website for latest package versions and versions that suit you at pear Packages
sudo pear install --alldeps channel://pear.php.net/Date_Holidays-0.21.8
sudo pear install --alldeps channel://pear.php.net/Date_Holidays_UNO-0.1.3
sudo pear install --alldeps channel://pear.php.net/Date_Holidays_Australia-0.2.2
sudo pear install --alldeps channel://pear.php.net/Numbers_Words-0.18.1
sudo pear install --alldeps channel://pear.php.net/Text_CAPTCHA-1.0.2
sudo pear install --alldeps channel://pear.php.net/Console_GetoptPlus
sudo pear install --alldeps channel://pear.php.net/HTTP_Request2
sudo pear install --nodeps channel://pear.php.net/MDB2_Driver_mysql
sudo pear channel-discover pear.horde.org
sudo pear install horde/Horde_role
sudo pear run-scripts horde/Horde_role
sudo pear install -a -B --force horde/webmail
The --force is required to allow the use of php7, otherwise this will error out the install.
Use "pear config-show -c horde" to show where the key Horde php related files are on the system.