Roundcube is a browser-based email client. It provides easy access to manage emails via a web interface.
Roundcube can be installed in two ways: either by deploying it with Docker Compose or by directly installing it on an Ubuntu server for a more hands-on approach.
Here are some of the key features that make Roundcube stand out as an email client:
To proceed with this tutorial, you’ll need:
sudo apt update
sudo apt install docker docker-compose
Docker containers encapsulate all the necessary dependencies to ease the overall setup process. Here’s a working docker-compose.yml
file to launch the Roundcube webmail with thunderbird_labels
, show_folder_size
, and tls_icon
plugins.
version: '3'
services:
roundcubemail:
image: roundcube/roundcubemail:latest
container_name: roundcubemail
volumes:
- ./www:/var/www/html
- ./db/sqlite:/var/roundcube/db
ports:
- 9002:80
environment:
ROUNDCUBEMAIL_DB_TYPE: sqlite
ROUNDCUBEMAIL_SKIN: elastic
ROUNDCUBEMAIL_DEFAULT_HOST: "ssl://imap.yandex.ru"
ROUNDCUBEMAIL_SMTP_SERVER: "ssl://smtp.yandex.ru"
ROUNDCUBEMAIL_DEFAULT_PORT: 993
ROUNDCUBEMAIL_SMTP_PORT: 465
ROUNDCUBEMAIL_COMPOSER_PLUGINS: "weird-birds/thunderbird_labels,jfcherng-roundcube/show-folder-size,germancoding/tls_icon:^1.2"
ROUNDCUBEMAIL_PLUGINS: thunderbird_labels, show_folder_size, tls_icon
Here’s an explanation of what each environment variable refers to:
ROUNDCUBEMAIL_SKIN
: It tells what theme to use for the interface. Elastic is the modern theme for Roundcube. Classic is an older, more basic theme.ROUNDCUBEMAIL_DEFAULT_HOST
: The default IMAP hosts that Roundcube will look at and try to connect. ROUNDCUBEMAIL_DEFAULT_PORT
: IMAP port number.ROUNDCUBEMAIL_SMTP_SERVER
: This SMTP server will be utilized to send emails. ROUNDCUBE_SMTP_PORT
: SMTP port number.ROUNDCUBEMAIL_COMPOSER_PLUGINS
: These add-ons can enhance the email experience, customizing appearances and features to Roundcube. These plugins further need to be enabled with the ROUNDCUBEMAIL_PLUGINS
variable.ROUNDCUBEMAIL_PLUGINS
: ROUNDCUBEMAIL_COMPOSER_PLUGINS
only installs the plugin while the ROUNDCUBEMAIL_PLUGINS
variable activates those plugins.Your email provider will provide details regarding the IMAP server, IMAP port, SMTP server, and SMTP settings. So, based on your email provider, you need to adjust these variables. Also, you need to note what encryption your email provider offers. It might be SSL/TLS.
To deploy this docker-compose file, ensure you have first set up docker and docker-compose.
docker --version && docker-compose --version
Start the docker
service:
systemctl start docker
Deploy the docker-compose.yml
file:
docker-compose up
It might take 2-3 minutes to get Roundcube running on <your-server-ip>:9092
. To start managing your emails, enter the login credentials provided by your email server.
If you’re using Gmail or Outlook, the username will be your email address along with @gmail
or @outlook
suffix.
After a successful login, you’ll get to see a similar interface.
Roundcube is a LAMP stack application. It’s written using PHP and supports multiple database backends, including MySQL, PostgreSQL, and SQLite.
Before installation, update the list of available packages and their versions.
sudo apt update
sudo apt install php apache2
You need to install and enable some PHP extensions as well.
sudo apt install php-mbstring php-xml php-imap php-sqlite3 php-json php-curl php-zip php-gd php-intl
Here’s a list of what each extension does:
php-mbstring
: Provides support for multi-byte character encodingsphp-xml
: Adds ability to work with XML documentsphp-imap
: Allows to establish connections with IMAP server php-sqlite3
: PHP adapter to talk to SQLite databasephp-json
: Handles JSON encoding and decodingphp-curl
: Allows sending HTTP requests via curl binaryphp-zip
: Handles reading and writing of zip filesphp-gd
: Provides image manipulation capabilitiesphp-intl
: Provides support for multiple languages, cultures, and regional preferencesYou can download the source code from https://roundcube.net/download/. To facilitate deployment, choose the Complete Stable Version.
Download the application in the /var/www
directory.
cd /var/www
sudo wget https://github.com/roundcube/roundcubemail/releases/download/1.6.10/roundcubemail-1.6.10-complete.tar.gz
One simple way to allow Apache to read from and write to the document root is to change ownership to www-data
user.
sudo tar xvf roundcubemail-1.6.10-complete.tar.gz
sudo chown -R www-data:www-data roundcube-1.6.10
cd roundcube-1.6.10
The config file determines what plugins will be in use, which interface and skins will be in use, what SMTP and IMAP server the email client will connect to, etc.
Make a copy of the default config file (first, ensure your current directory is /var/www/roundcube-1.6.10
):
sudo cp config/config.inc.php.sample config/config.inc.php
Open the config file and edit these important settings i.e. the database connection, IMAP server, and SMTP server.
sudo nano config.inc.php
Here’s a sample config for the Outlook email server. You need to adjust db_dsnw
, imap_host
, and smtp_host
as per your email provider. This configuration uses an SQLite database for simplicity.
$config[‘db_dsnw’] = ‘sqlite:////var/www/roundcubemail-1.6.10/config/db.sqlite?mode=0640’;
$config[‘imap_host’] = ‘ssl://imap.office365.com:993’;
$config[‘smtp_host’] = ‘ssl://smtp-mail.outlook.com:587’;
If you want to use some plugins, you need to download them manually in the plugins
directory or use Composer to manage plugins. Then enable the config file as:
Create a new file roundcube_site.conf
under /etc/apache2/sites-available
with the contents:
<VirtualHost *:80>
DocumentRoot /var/www/roundcubemail-1.6.10
# ServerName roundcube.CHANGEME_YOURDOMAIN.com # Replace it
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/roundcubemail-1.6.10>
AllowOverride All
Require all granted
</Directory>
# Block access to the database
<FilesMatch "\.sqlite$">
Require all denied
</FilesMatch>
</VirtualHost>
Enable the newly created Apache site:
sudo a2ensite roundcube_site.conf
Disable the default Apache site as it might cause the issue:
sudo a2dissite 000_default.conf
Restart Apache to load changes:
sudo systemctl reload apache2
Finally, you can launch the Roundcube interface simply by visiting the IP of your server. It’ll ask for Username and Password. You can get those credentials from your email provider.
A quick tip, in case the setup is not working, inspect the errors.log
file.
Also, inspecting the Apache access.log
and error.log
files can provide additional clues.
tail -f /var/log/apache2/access.log
tail -f /var/log/apache2/error.log
To add additional email accounts, switch to the Settings tab, select Identities, and then click on the Create icon.
You can import all your previous contacts from a vCard or CSV file. To do so, head over to the Contacts tab and click on Import icon on top.
If you want to import CardDAV, add composer plugins roundcube
/carddav
.
Collected Recipients will bring a list of contacts that had been previously contacted. Similarly, Trusted Senders will bring a list of a sender.
It’s worthwhile to mention some of the popular plugins :
If you didn’t like the Roundcube experience, there are other alternatives to consider.
Roundcube offers hundreds of plugins to customize the experience. With its docker deployment, the Roundcube mail client can be deployed within a matter of a few minutes.
If you’re comfortable with server management and need a lightweight, open-source webmail solution, Roundcube could be a perfect fit for you. However, if you require more advanced features or don’t want the hassle of self-hosting, you might want to consider other options.