1. Code
  2. Email Applications

Running Your Own Email Server: Customizing Roundcube

This post is part of a series called Running Your Own Open Source Email Server.
Running Your Own Open Source Email Server: Administering iRedMail
Final product image
What You'll Be Creating

This is part three of a tutorial series for Running Your Own Open Source Email Server. In this tutorial, I'll guide you through customizing iRedMail's chosen web-based email client, Roundcube.

Roundcube is an independent open source project with a developer community of its own providing support, documentation, themes and plugins. Roundcube's feature set offers many of the features mainstream clients provide:

  • localized in over 70 languages
  • drag-and-drop message management
  • full support for MIME and HTML messages
  • multiple sender identities
  • full featured address book with groups and LDAP connectors
  • rich text/HTML message composing
  • searching messages and contacts
  • threaded message listing
  • spell checking
  • IMAP folder management
  • support for external SMTP server
  • template system for custom skins
  • plug-in API for flexible extensions

Here's a complete list of RoundCube features.

Keep in mind, if you're not a fan of Roundcube, you can use iRedMail's POP and IMAP features to access your mail from any compatible mail application. Here's a visual guide to configuring iRedMail with Apple Mail and your iPhone.

Themes for Roundcube

Themes on Roundcube are called skins. You can find a variety of skins here and here. There is a free/by-donation theme that looks like Google:

Roundcube The Free By Donation Google Larry Theme

You can also purchase skins, typically for US$99. These provide advanced look and feel environments, including mobile web support. A few provide similar look and feel to familiar mainstream environments.

Here's an iCloud-based skin:

Roundcube iCloud Skin

Here's an Outlook-based skin (see a demo):

Roundcube Outlook skin

I've installed this one for a client and it seemed to work quite well.

If you'd like to build your own skin, here's Roundcube's documentation for creating a theme.

Plugins for Roundcube

Plugins are a great way to customize and extend Roundcube's default feature set. There are a few plugins and settings I like to use to improve login and authentication.

Extend Session Lifetime

The first isn't a plugin but a setting to extend the session lifetime. If you look in your file, it will provide a section for where the Roundcube settings are:

The default session lifetime for Roundcube is only ten minutes. Let's change ours to three days, which is 4,320 minutes.

Go to your Roundcube configuration directory (based on your version number):

Change the session lifetime from 10 minutes to 60 or 600 or 4320 minutes, etc.:

Note: Older versions of Roundcube had different configuration file names. These were merged in version 1.0.x.

The Persistent Login Plugin

Next, let's install the Persistent Login Plugin. This provides a remember me checkbox on the sign-in page.

To install the Remember Me plugin, go to your Roundcube plugin directory (Your version # may vary) and download the code.

You may need to install unzip to unpack the code:

Rename the folder:

Modify the active plugins array by editing the Roundcube file:

Add “persistent_login” to the plugins array:

Restart your web server:

You should see this at your Roundcube login—notice the checkbox at the bottom:

Roundcube Persistent Login Plugin

Two Factor Authentication for Roundcube

If you'd like to add two factor authentication for your Roundcube email, check out Alexandre Espinosa Menor's Two Factor Google Authenticator. I won't walk through the installation and configuration here but you can see how it works. The installation instructions are similar to the plugin we installed above.

The login screen gets a secondary step requiring your Google Authenticator code:

Roundcube Two Factor Authentication with Google Authenticator

And you can configure Google Authenticator from Roundcube's Settings:

Roundcube Two Factor Authentication with Google Authenticator Settings

The Mark as Junk Plugin

The Mark as Junk plugin provides a GUI mechanism for you to mark email as spam and have iRedMail’s spam agents learn from your selections.

Download the release appropriate to your version of Roundcube from GitHub. We're using version 1.8.2 of the plugin for Roundcube 1.0.x.

Then, copy the default settings and reload the web server again:

You should see the Junk icon in your command buttons in the Roundcube client:

Roundcube Mark as Junk

Whenever you encounter a junk message, just click the Junk button and the iRedMail server components for spam filtering will be trained.

The Plugin Manager

You can also install the Roundcube Plugin Manager. It makes it possible for individual Roundcube users to install their own plugins. 

Plugin Manager emerged with the idea of putting users in control of their webmail preferences allowing them to enable and disable functionality (plugins) per account to fit their personal needs while providing administrators a more simple way to control, manage and update roundcube plugins at the same time.
Roundcube Plugin Manager

Installing Plugin Manager is exactly the same as the process we used with the other plugins above. See here for installation instructions.

Note: Using Plugin Manager with some plugins requires that you purchase credits in a virtual currency.

PGP Encryption With Roundcube

Encryption has long been at the top of requested features for Roundcube:

PGP encryption is one of the most frequently requested features for Roundcube and for good reasons more and more people start caring about end-to-end encryption in their everyday communication. But unfortunately webmail applications currently can’t fully participate in this game and doing PGP encryption right in web-based applications isn’t a simple task. Although there are ways and even some basic implementations, all of them have their pros and cons. And yet the ultimate solution is still missing.

The only active project listed is Mailvelope which manages encryption in the browser. It's available for Chrome and Firefox.

PGP Encryption in the Browser with Mailvelope

In Closing

I hope you've enjoyed this introductory series. If you need more Roundcube help, visit the Roundcube support website

Please post any comments, corrections or additional ideas below. You can browse my other Tuts+ tutorials on my instructor page or follow me on Twitter @reifman.

Related Links

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.