Moments that matter: Smarter IMAP email with DBMail and Sieve

Email is essential, as are time and sanity, the latter are scarce resources so it's essential to use them well. Filtering email to organise and tame this never ending stream benefits us by using our time more effectively and keep our sanity. This article uses standard SIEVE RFC-5228 to make moments that matter more effective.

The need for managing emails has always been there, often accomplished with an intelligent email client that has rules to filter and organise email into folders.  Duplicating those filters when working from home or on site with a laptop was eminently do-able if occasionally out of sync, with more clients the complications increase, and you also have to be on-line.

In our multi connected world where we need access to information at our fingertips, having our email pre-filtered and actioned as soon as it arrives with any remainder going into appropriate folders leaving only a small number in our in-box awaiting our attention means that we can use our smart-phones, web-mail, laptop and smart applications more efficiently making our lives easier and more productive.

Server

Here at Persistent Objects we use DBMail as our mail delivery agent as it fits our requirements including integrating Sieve message filtering and using a database such as MySQL or PostgreSQL allows us to use replication for disaster recovery.

The first thing to say is that although we are using it to good effect, it's not a panacea, no substitute for good organisation, and although integrated, some clients make editing Sieve scripts easier than others.  Most good mail delivery agents have Sieve integration so you may already have it available as an option!

The message transfer agent (we use Exim) is not involved, we are currently using dbmail-deliver but could just have easily used dbmail's lmtp.  Your MTA probably won't change.

local_delivery:
  driver = pipe
  command = "/usr/local/sbin/dbmail-deliver -d ${local_part}\@$domain"
  return_fail_output
  user = mailnull

The DBMail implementation is just as straightforward

[SIEVE]
#
# Port to bind to.
#
port = 4190

[DELIVERY]
#
# Run Sieve scripts as messages are delivered.
#
sieve = yes

These small changes make Sieve available, no clients are impacted and you are ready to sieve.

Webmail

Many webmail clients support Sieve using plugins.  At Persistent Objects we are using RoundCube as our webmail client with ManageSieve to manage Sieve Scripts, it offers a straightforward, intuitive, easy to use visual point and click interface.

For Roundcube, the default managesieve plugin configuration file config.inc.php.dist is copied to plugins/managesieve/config.inc.php and the managesieve_port changed to 4190 if necessary, it should be the same as the server in our case as per the dbmail configuration.

$rcmail_config['managesieve_port'] = 4190;

Let Roundcube know that you will be using the managesieve plugin in config/main.inc.php

$rcmail_config['plugins'] = array('managesieve');

Avelmail is available for Squirrelmail and integrates well, alas for us it appeared harder for our average users as it was script based and less easy to edit.

Clients

Smart phones such as Android have a basic email client that checks for email in a selected folder such as inbox and so if you have automated your mail appropriately, you will not be distracted unnecessarily, and you can easily check alternative folders when required.  For more functionality many other email clients are available.

Email clients do not need to know anything about sieve, they just work!

Thunderbird, KMail, Opera and many others 'Just Work'.  Many such as Thunderbird use addons for managing Sieve scripts, others such as KMail have it integrated, still others such as Opera don't understand how to edit Sieve scripts and work fine with no impairment.

With no visible changes, it is easy to wonder what the fuss was all about, it was only when logging off the desktop and realising that emails were still being filtered and actioned that the benefit starts to become apparent, checking emails on a smart-phone later in the evening offers fewer distractions, longer battery life and reduced data charges making those moments that matter more effective, what could be easier and better than using our time more effectively and keeping our sanity!

And finally

Email is essential to any business.  By filtering, organising and automating it's straightforward to reduce stress, be more productive and make the most of those moments that matter.

By Alan Hicks