Open Source Webmail for your mail server (in PHP) – Roundcube is very good about free software (Free as free speech), is the large choice of alternatives. But when several of them are mature enough to be used everyday, especially such as a Webmail….the choice is tough! Roundcube? Xuhek? Horde? SquirrelMail? hastymail? Mailr? AfterLogic? RainLoop? Atmail? or the promissing MailPile (Currently in Alpha) and so many others….

Each of them with their strengths and weaknesses…I do have some preferences like recent design style (Exit Xuhek, Horde, SquirrelMail, hastymail, Mailr,…), without taking too much resources or overkill features (exit Zimbra,…) and of course with recent updates (Exit Atmail, Claros, …) but stable (Exit Mailpile for now)….well still a lot of choice to choose from (Roundcube? AfterLogic Lite? RainLoop? and most probably others good alternatives I’m missing)

But most probably Roundcube is the most popular one of this Webmail set and shouldn’t go wrong about it. But the best will be to test at least the last 3 mentioned (Which I will in different article, but won’t go into the details of the features and comparison as I will need weeks to try them)

Roundcube is a browser based IMAP client (Webmail). It has all of what we will expect from a mail client, such as MIME support, address book, folder manipulation, message searching, spell checking and much more

Screenshow #01

As you may know, few days ago, Roundcube announced finally after 8 years their stableversion 1!!

So it’s time to test it out and write this tutorial!


Obviously you need to have your mail server working on top of your web server (Apache, Nginx, …). If it’s not the case, I suggest you to have a look to my previous tutorial on setting up a mail server.

You can download the latest version from sourceforge here or directly install it from the repo (Might not be the latest).

If you are installing the latest version from Sourceforge, you will need to:

1) Create a dedicated folder.

In root, type:

 mkdir /var/www/roundcube

2) Download the latest version, extract the content inside the folder and change few permissions

cd /var/www/roundcube
wget -O roundcube-latest.tar.gz
tar xfz roundcube-latest.tar.gz
mv roundcubemail-1.0.0/* .
mv roundcubemail-1.0.0/.* .
rm -R roundcube*
chown -R www-data:www-data /var/www/roundcube/temp/
chown -R www-data:www-data /var/www/roundcube/logs/

3) Create a SQL database

The most common database is MySQL but others such as PostgreSQL and SQLite are also supported.

In my case, I’ll use MySQL with PhpMyAdmin to do so.

I’ll create a database called roundcube and a dedicated user call roundcube with all privileges on this database (And only this). If you don’t know how to do it, I suggest you to install phpmyadmin if not done yet. You will only need few clicks to do that.

4) Point with your Web Browser to the installer and follow the easy steps


Most probably you will want to modify only the Database configuration and the IMAP settings like the username domain ( in my case) and the SMTP settings (smtp_server with smtp_user/smtp_pass or simply tick the option “Use the current IMAP username and password for SMTP authentication”).

It will generate a config file

5) Copy/paste or download/upload the config file

nano /var/www/roundcube/config/

If you have installed the Webmail on the same machine than IMAP server, you don’t need to indicate the username_domain

$config['username_domain'] = '';

When done, click on Continue

You will probably have to initialize the database and you could test SMTP and IMAP config.

6) Disable and Remove installer

rm -R installer/

You should now have a working Roundcube and should be able to login using your username directly. (If installed in localhost with real user, you don’t need to add

Virtualhost configuration

Now you got your webmail working and you want to access it from rc.domain.tld or directly from mywebmail.tld, instead of using the IP/roundcube link, you will need to set up a virtualhost. And obviously you want to force HTTPS connection.

You will need to:

1) Create a A redirection in your DNS server/registrar

2) Have SSL certificate ready. If not you can read this tutorial.

3) Create your virtualhost as following:

In /etc/apache2/sites-enabled/, create a file called roundcube (In root):

nano /etc/apache2/sites-enabled/roundcube

and paste the following content:

<VirtualHost *:80>
        ServerAdmin webmaster@domain.tld
        ServerName rc.domain.tld
        Redirect / https://rc.domain.tld


<IfModule mod_ssl.c>
<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/freedif.pem
        SSLCertificateKeyFile /etc/ssl/private/freedif.key

        ServerAdmin webmaster@domain.tld
        ServerName rc.domain.tld

        DocumentRoot /var/www/roundcube
        <Directory />
                Options FollowSymLinks
                AllowOverride All

                php_value memory_limit 10M
                php_value post_max_size 10M
                php_value upload_max_filesize 10M

        <Directory /var/www/roundcube>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

Adapt the content (Servername, webmaster, SSL certificate and directory, …). Note that I’ve added 3 lines for PHP configuration to allow to send large attachment (10Mb)

When done, save the file (CTRL+X then Yes) and reload apache: (In root)

/etc/init.d/apache2 reload

Loves to discover web-based apps to install on his own server@home and write articles about it


Add a comment