skip University | Computing Services | Search | News | A-Z Index | Contact us Text only 
University of Bath logo - links to University home University of Bath logo - links to University home page BUCS: University of Bath Computing Services BUCS logo - links to BUCS home page Computing Services
Need Help? Check the FAQ

Developing Sieve Scripts with Mulberry

Sieve allows you to filter your mail on the server. This means that your rules will be applied to your mail regardless of where you view it (e.g. if you use webmail at home, the filtering will still be applied to your account).

The Mulberry email client has the facility to create server side Sieve filter scripts to enable effective management of email. General information about the Sieve language can be found on the Sieve documentation page. The information detailed below will describe how sieve scripts can be developed from scratch using the Mulberry Graphical User Interface (GUI). These notes refer to Mulberry 3.0.2 and above. A bug exists with the user interface of the Sieve Rules dialog box which is not serious but is confusing. See the workaround for more details. The recommended version of Mulberry is 3.1.

Note: At present the Mulberry GUI can be used to create, upload, activate and delete sieve scripts from an IMAP server. Mulberry does not yet have the capability to download or generally read a sieve script from an IMAP server.

There are four basic steps to developing a sieve or server side mail filter script using Mulberry.

The final two stages may be combined.

Creating a Sieve account

From Mulberry's main Preferences dialogue (File -> Preferences) make sure you are looking at the advanced view (click Advanced radio button). Click the Accounts tab and from the Account drop down menu click New...

From the Account Type drop down menu choose SIEVE Filtering - Manage Sieve, name the account (arbitrary) and click OK.

You will be returned to the main account preferences screen. The sieve server is imaphost.bath.ac.uk. Authenticate using your usual username and password. The authentication method is plain text. For this reason sieve account management is only available within the campus network. The dialog box settings should appear as below.

Click OK to finish.

Note: Sieve accounts are currently only available for use within the campus network.

Defining a Sieve rule

From the main Mulberry window click Mailbox -> Rules... The Rules dialog box appears with the Local tab displayed, click on the SIEVE tab to switch to server side Sieve rules.

From here the first thing to do is click on the Script button and create a name for the Sieve script. The named script will appear in the Scripts window in the right hand pane. You now create and apply rules that will apply to the Sieve script. To do this click on the Rule button. The Edit Rule dialog box appears.

The above procedure can be repeated to create a number of individual rules that will make up a complete script. The following dialogue box indicates the result of a number of rules being associated with a couple of sieve scripts:

Note the rules in the Rules pane are independent of the scripts in the Scripts pane until they are linked to the script through the Triggered by: action. This methodology means individual rules can be quickly added and removed to and from Sieve scripts by simply toggling the trigger. As many rules as you like can be added to a Sieve script.

Uploading a Sieve script to the IMAP server

Once rule sets and Sieve scripts have been created they must be uploaded to the IMAP server. To do this choose the script you want to upload and click ont he Write button. You will be presented with the following dialog box.

The account is the one created in the first step. If you have not created an account you need to do so before continuing. Mulberry currently allows you to upload or delete scripts from the IMAP server. You have the choice of 'uploading' or 'uploading and activating'. Refer to the Email Filtering web page to understand the general concept in use here.

If you choose to 'Upload to Server and Activate' the sieve script will take affect immediately. Any mail coming in to your account will be subject to the rules of the script you have just created. Be sure your Sieve script is doing what you are expecting it to do.

The final choice is Save to a File.

Enabling the Sieve Script

If you choose to 'Upload to Server Only' the Sieve script will be uploaded but not activated. Up to 5 sieve scripts can be uploaded to the IMAP server but only one can be active at any one time. Note that a single Sieve script can contain as many rules as you like. It may seem pointless to have a Sieve script uploaded but not active on the IMAP server but it facilitates the ability to quickly switch the way your mail is dealt with. A vacation script is an obvious example. To activate an uploaded script from Mulberry you would actually choose the 'Upload to Server and Activate' option above. Alternatively the interactive Sieve program can be also used which can be useful if you are remote from the campus.

Sieve Rules

The following tables explain the pull down menus and the sieve filtering criteria that you can select from within the Mulberry GUI. These criteria look at the header of an email to match and filter.

Find Messages whose:

From Address Matches the From address in the message header
To Address Matches the "To" address in the message header
CC Address Matches the "CC" address in the message header
Bcc Address Matches the "BCC" address in the message header
Recipient Matches either the To, CC or Bcc addresses in the message header
Correspondent Matches either any address in From, To, CC or Bcc message headers that is not one of your addresses or an alias.
Sender Matches the Sender address in the message header
Subject Matches the Subject text in the message header
Header Field Matches text in a chosen message header
Size Matches the size of the message
All Messages Messages Always matches

The second pull down menu under the Find Messages whose: area is a list of dynamic choices that are dependent on the selection you made above, for example: is, is not, contains, starts with, ends with, matches etc. Hopefully these are self explanatory. The only exception is for the Header Field choice which allows you to define any header and associated value to match on. One use of this field is to match email marked as spam as described on the Filtering Email web page but the concept can be extended generically.

Actions:

Keep The message will always be delivered to the ‘default’ mailbox (usually INBOX), in spite of any actions that come before or after this one.
Discard The message will be removed and not be delivered to any mailbox. There will be no error message or warning to indicate the message was removed.
Reject Not Supported
Redirect The message will be bounced to an address that you specify and will not be delivered to any mailbox.
File into The message will be delivered into the mailbox that you specify. Mailboxes other than INBOX can only be used when SIEVE is available with an IMAP server. The mailbox that you specify must be a valid mailbox for the SIEVE server. If the mailbox does not exist, the message will instead be delivered to the ‘default’ mailbox.

 

Saving a Sieve script to a File

A Sieve script can be saved to a file. The file is local to the PC or workstation Mulberry is installed on. It will be saved to your personal profile area. So for MS Windows 2000/XP this will be somewhere like:

	C:\Documents and Settings\<username>\Application Data\Cyrusoft\Mulberry\SIEVE Scripts\

and for MS Windows 98/ME somewhere like:

   C:\windows\Application Data\Cyrusoft\Mulberry\SIEVE Scripts\
or
C:\windows\profiles\<username>\Application Data\Cyrusoft\Mulberry\SIEVE Scripts\

depending upon whether or not a local profile has been set.

Workaround for Rules Dialog bug

Prior to version 3.02 of Mulberry there is a small bug with the Sieve Rules dialog box. When the Rules window is opened and the Sieve tab clicked it appears there is only a single pane available, the Scripts pane. In actuality the Rules pane has been hidden by the vertical window divider bar being all the way over to the left. The bar needs to be dragged to the middle of the window for the Rules pane to become visible. Once the bar has been set the bug is not longer an issue.

Furthermore the scripts window has to be focused (clicked with the mouse) before clicking the Script button will give you the option of creating any Sieve scripts.

Whilst these bugs are minor and do not affect the creation of sieve scripts, we still recommend that all users upgrade to Mulberry 3.16 which is the latest site licensed version.

-Rate this page...

How useful was this page to you?

Very  Mostly  Fairly  Not really  Not at all

Email address (optional):

Page last modified 18 May 2004