This is an old revision of the document!


Sieve: automatic actions on mail arrival

Description

Our infrastructure implements the Pigeonhole Sieve Interpreter, an implementation of the Sieve standard protocol.

There are two ways to set up and maintain email filtering on your email account:

  • the easy and recommended (but somewhat limited) way through the webmail (Sogo), from your mail preferences.
  • the more technical way, through Thunderbird plugin sieve.

You cannot use both, as modifying your filters defined in Thunderbird through Sogo Web interface will erase all filters that Sogo does not understand.

Using Nomagic Sogo webmail

This is the easiest way to implement mail filtering, including management of vacation auto-reply. You do not need to know anything about Sieve language or syntax, everything is done via the webmail graphical user interface.

To set up automatic reply during a leave of absence, see the dedicated page.

Access your filters

  1. Authenticate with your Nomagic account at https://webmail.nomagic.uk
  2. Go to your Preferences
  3. Go to Mail and further into Filters to show / modify / add / delete your filters

    Here we can see that this account has no filters defined yet.
  4. To add a filter, click on the button CREATE FILTER
  5. Here below is the definition of our new filter, which we called Nomagic support.

    The filter is split in two parts:
    → The upper side is to define which emails should fall into that filter.
    → The lower side is to define what action to apply to those emails.

In this example, we tell the server to add an Important flag to all emails coming from support@nomagic.uk, and we make sure that it stops going through the mail filters if this filter has been applied.

Voilà! You can create as many filters as you need.

You can also combine it so it's more manageable. For example, the following filter is applied to messages sent to either nomagic-newsletter@mailing.nomagic.uk or nomagic-users@mailing.nomagic.uk:

As you noticed, we add a specific action in our filter when we want to stop processing the incoming email. This is because by design, if a mail is susceptible to match several filters, it will go through all of them and apply each of their actions.

By using the Stop processing filter action as well as reordering the list of your filters, you can precisely define what filters will be applied to an incoming email.


Using sieve plugin in Thunderbird

Installation

The plugin should be found when search for 'Sieve' in Thunderbird extension search bar. Simply install and you are now ready to go.

Configuration

Below is the workflow step by step to access and create your first Sieve filter. You can create multiple profiles, but keep in mind that only one at a time can be activated.

  • To make it easier to access your filter rules, we recommend putting a shortcut to the sieve plugin on your main Thunderbird window. To do that, right click anywhere on the tab bar and select Customize…

  • Look for Sieve filters, then drag and drop to the main bar (as it shows on previous screenshot).

  • Click on the Sieve icon and click Continue on the welcome screen

  • Give your new set of rules a name


All done! The Sieve plugin comes with documentation included on the right side of the screen.

To be able to use the different actions, you need to import them first at the top of the file using require. You can do that as needs come, or put a quite general line like this:

require ["imap4flags","envelope","subaddress","fileinto","variables","vacation","reject"];

Example

In this first example we are setting up a 'flag' rule, marking any email coming from management@nomagic.uk as important, based on the Thunderbird flag colour numbers.

  • We identify flag Important as number 1 from Thunderbird's preferences

  • We make sure at least the imap4flag action is activated, and we set up our filter.

Sieve plugin automatically checks for syntax error, which makes it very handy when you add / modify rules

It is strongly advised to keep a commented label of each of your rules, as shown on the screenshot, with the format:

# rule:[rules-description]


That's it, all emails from NOMAGIC's management will be marked with the important flag as they arrive in your mailbox!

Troubleshooting

Authentication

A vulnerability fix deployed by package manager on the 01/03/2018 resulted in the new requirement:

  • authentication mechanism needs to be set from client (as opposed to guessed during connection)

If the sieve plugin is not set properly to Plain authentication, you will get the following error:
Click on Settings… button, then select Change Settings and use the drop-down menu to select Plain from the Security tab

FAQ

Empty