How I stay on top and process my professional email with IMAP Flags, Sieve and Thunderbird

At my current job, I am lucky enough to choose which mail user agent I can run to process my professional email: after a lot of experiments, I decided to stick with Thunderbird, because it is open source and it can be heavily customized. It seems, though, that I am not the only one to enjoy Thunderbird.

How does my normal day-to-day inbox look?

This is what I see when I open Thunderbird. Do you feel underwhelmed by the unread inbox count? Fear not.

The workflow

Yeah, I agree, 242 unread items in inbox might be scaring. But I am using a consolidated workflow to process all these unread emails in my inbox in a very short time.

The keys to everything are the rules I defined for my processing and the message list: these two elements can allow me, just by peeking at the screen, to understand what a particular group of messages is about (the topic) and the recipient (directly me, am I in CC or it is a mailing list message?). In this post, I am going to illustrate my workflow to process all these emails in a jiffy.

Rules

Let’s start with some ground rules:

  • Never touch a mail twice: when opening a mail, it gets either:
    • Archived (or deleted)
    • Moved to the waiting for folder
    • Triggers an action (reply, forward)
      No other action is contemplated or allowed. Never return twice to an already processed email.
  • Every email generated by a human cannot be automatically filtered and archived to a folder
  • Every unfiltered email must land in inbox (that where everything untouched and needing at least a read must land, right?)
  • Important emails (the ones I am the direct recipient) needs the highest priority and must be processed first
  • Mobile processing is allowed and encouraged

Thunderbird message list

The second pillar is the Thunderbird message list. As you can see, I tweaked the columns and sorted them in a different order to show:

  • Whether the mail is starred
  • The sender
  • The subject
  • The number of emails grouped for that thread
  • Date/time

The idea

The idea is to write server-side filters to automatically:

  • Archive or delete emails that are automatically generated and I want to keep for future reference (build or test logs) or that I am not interested in (spam)
  • Flags/tags every email based on the recipient:
    • If I am the recipient make them stand from the crowd
    • If it is a mailing list message or related to a particular project (e.g. the projects I am directly involved with), group them with a flag

By configuring Thunderbird appropriately, whenever a message has a particular flag, the flag is displayed using a specified color.

IMAP flag and filters

The concept of a flag is an IMAP feature and luckily again, the IMAP server I am using supports user-defined IMAP flags.
The next step is to write server-side filters: the server I am using supports filters written in Sieve.
An example of a filter that applies a flag if the message is a mailing list message:

# rule:[uyuni]
if anyof (header :is "x-mailinglist" "uyuni-devel", header :is "x-mailinglist" "uyuni-users", header :is "x-mailinglist" "uyuni-announce")
{
addflag "$label5";
stop;
}

In this case, if the message comes from the Uyuni project mailing list, it gets the flag label 5 applied.
The connection between an IMAP flag and a Thunderbird showing it with color is defined in the Thunderbird configuration.

How can a message in which I am the recipient (or it is not caught by one of the previous filters) stand out from the crowd?
The last filter in my chain is exactly a catch-all filter that applies the “unfiltered-email” flag:

# rule:[unfiltered-emails-tagging]
if true
{
addflag "\\Flagged";
addflag "$label6";
stop;
}

The attentive reader notices that a standard \\Flagged flag is also set for the messages that are caught by this filter. Why is this needed?

My mobile email client does not support user-defined IMAP flags (I do not have the same colorful message list as I have it in Thunderbird). To overcome this limitation and still separate important messages (the unfiltered ones) from the rest, I added the \\Flagged flag (which normally gets rendered as a starred or flagged message) to these messages.
The result is that unfiltered messages have a star near associated with them. That is visually acceptable on mobile and Thunderbird as well (in addition to the user-defined colored flag).

Thunderbird and flags

Thunderbird does not still know which color associate with an IMAP flag. Let’s define one.

  1. Open Thunderbird settings and fire up the Config Editor in the Advanced Settings.
    Define the following new String keys:

    1. name: mailnews.tags.$label0.color
    2. key: #000000
    3. name: mailnews.tags.$label0.tag
    4. key: my-first-tag
      Each new flag/label will have its own incremental $label.
  2. Restart Thunderbird
  3. In Thunderbird settings > Display > Settings you can customize the color of each tag

Done! If Sieve is doing its job and Thunderbird is correctly reading the tags, you will have each tagged message colored.

The workflow

Now that the setup is in place, here is how I process my inbox daily with a focused approach:

  1. Show only the important and urgent emails: in other words, show only the emails that are directly directed to me (I am the recipient). I have a complex set of Sieve filters that try to catch every email that is not in this category, so I can use the last filter (the “unfiltered” ones) as a fallback.
    In Thunderbird, it is enough to select the associated tag (unfiltered-email) or, equivalently, show only starred messages.
    Show only the starred messages (or the ones tagged with “unfiltered-email”)

    With the mobile client, only the latter is applicable (for the reasons expressed above): show only the starred/flagged ones.
    The next step is to process every email by adhering to the rules and principles described above.
  2. When all important and urgent emails category is empty, it is time to process all other messages. Based on a quick look I have at the message list (and its coloring), I can decide to show a combination of tags and show only the messages that have all the tags, or any of them, or a combination of the two.
    Thunderbird offers a very customizable tag filter when showing the message list:
    Thunderbird capabilities of selecting a set of filters are impressive

    Let’s decide I want to focus, for example, on the uyuni-or-spacewalk filter and show only messages tagged as such:
    Showing only the messages that are tagged with `uyuni-or-spacewalk` tag.
    Hey, this is a public mailing list, I only have to redact the names!

    With this filtered view I am free to focus just on the messages shown and have a quick glimpse of what are the major topics in this particular area.

Troubleshooting

If you want to check which user-defined flags your IMAP server supports, there is a handy Ruby script I found.

The verdict

I am proud of my current setup; it is the result of several months of experimenting, switching tools, tweakings, rollbacks, and commitments.
By taking ownership of my inbox I can stay on top of everything that is happening and, thanks to the filtering and tagging, I can set my priorities and tailor my email client to show what I am focusing on. I make my email client work for me, not the other way around.
Besides, providing a timely and precise answer to any email that requires that action has been a breeze.
The only thing I want to improve is to find a mobile email client that can read IMAP tags and allows me to process other tags while reading emails from mobile.

How do you manage to stay on top of your professional email? Do you use any particular mechanism like auto-tagging and Thunderbird?

2 thoughts on “How I stay on top and process my professional email with IMAP Flags, Sieve and Thunderbird”

  1. Ciao Michele, grazie per aver condiviso questo setup, molto interessante! Anch’io ho speso molto tempo per pensare ad una soluzione e ho creato un git-hook che mi permette di gestire i miei server-side sieve scripts direttamente via git, questo mi permette di continuare ad evolverli senza diventare pazzo all’aumentare della complessita’. Qui puoi trovare il repo [0], ovviamente e’ (e sara’ sempre) WIP.

    Cheers!

    [0] https://github.com/StayPirate/sieve-susede

Leave a Reply to Gianluca GabrielliCancel reply