IT Services

Setting up simple email filtering with Mulberry

Introduction

Mulberry has a built-in facility called Local Rules (under its Mailbox menu) with which you can set up simple filtering for your email. This uses client-side filtering as opposed to server-side filtering, so is less efficient and only works when you are logged in to Mulberry.

Local Rules filtering is an alternative to the Sieve server-side filtering system, which for technical reasons cannot be made available to Mulberry users at present. A server-side filter with limited functionality is available via My Accounts. For more information, see our guide to server-side filtering.

The following guide is an introduction to Mulberry Local Rules, but is not a complete description. See the Where to find out more section for more information.

Contents of this Guide

top of page

About Rules and Triggers

In Mulberry, a Rule consists of one or more conditions or search criteria to be met, and one or more actions to be taken. The conditions and actions apply to email messages and mailboxes. For example, a condition might be for an email message to have come from a particular sender's address or mail domain. An example action is for the email to be moved to another mailbox. A Rule is normally associated with one or more Triggers which define an event when that Rule should be invoked. An example of a Trigger event is when a mailbox is opened or closed.

Creating Rules

Follow the steps shown below to create a Rule.

  1. Open Mulberry's Mailbox menu, then choose Rules....
  2. In the Rules window, click the Local tab:

  3. [Local tab in Rules window]

  4. Click the [Rule] button, then enter a suitable name for this Rule in the box at the top:

    [Name box in Edit Rule window]

  5. In the Find Messages Whose section, you choose the various test criteria. You select which header or characteristic of the message you want to test, and how to test it. There are many different test criteria to choose from.

    For example, to test to see if a message has come from anyone at example.com, set the boxes to look like this:

    [Example Find Messages condition]

    If you want to add more selection criteria, click the More Choices button and complete the new row of boxes.

  6. In the Actions section, you choose what to do with a message that meets the selection criteria. The menu of available actions is quite long, but the table below describes those that you are most likely to use:

    Set Flag
    Sets a specified flag on the message, such as Seen, Deleted, Answered etc.
    Unset Flag
    Cancels a specified flag on the message (see above)
    Copy Message To
    Copies the matching messages to the specified mailbox.
    Move Message To
    As for Copy Message To, but also sets the Deleted flag on the message.
    Expunge Message
    Expunges (permanently removes) the matching messages.

    You will notice that the Action options will vary according to what the Action is. You can do more than one Action on any selected message: just click the More Actions button to add another action.
  7. You can select the Stop if Matched checkbox if you want the filter system to stop testing once it finds a matching selection criterion. This makes it more efficient.
  8. When you have completed a set of selection criteria and actions, click OK to save it. Your new Rule should then appear in the Rules window.
top of page

Creating Triggers

Follow the steps shown below to create a Trigger.

  1. Click the [Trigger] button, then add a suitable name for the Trigger in the box:

    [Name box in Edit Trigger window]
  2. Choose an event in the Trigger when box.
  3. If the Apply section is empty, as shown in the picture above, click the More Targets button, when you should see something like this:

    [More Targets button in Edit Trigger window]
  4. Click the menu bar which probably shows None, and it will display a choice of targets, namely None, Mailbox, Cabinet, Account and All.
  5. If you want the trigger to operate with any of your mailboxes, choose the All option. To choose a single mailbox on which the trigger is to operate, choose Mailbox and then select a mailbox in the box to the right. If you choose the Account option, followed by a selected account in the box to the right, the trigger will operate only on mailboxes belonging to that account.
  6. Click OK. The new Trigger should appear in the Rules window on the right-hand side.
top of page

Activating a Rule

You need to associate a Rule with a Trigger before it will start working. The table given below shows the available trigger events:

Trigger eventWhat it means
New Messages ArriveOperates when new messages are detected in a mailbox that is open or being checked.
Opening a MailboxOperates whenever a mailbox is opened.
Closing a MailboxOperates whenever a mailbox is closed.
AllOperates when any of the above three events occur.
NeverDoes nothing: this is used to disable a trigger without deleting it.

In the Rules window, double-click on the Rule you created earlier, then click the [Triggered-by] button. Then, from the list that appears, select the Trigger you want to associate with this Rule. Then click OK.

top of page

Changing, correcting and deleting Rules

Whenever you need to make any changes to a Rule, you just need to follow these steps:

  1. Click the appropriate Rule name in the Rules pane.
  2. Click the Edit tool icon.
  3. Make the required changes to the Rule following steps 4 to 7 in the section Creating a Rule.
top of page

Using Rules to filter spam

Spam is difficult to identify reliably through automatic means. The Sussex mail system currently runs a system called SpamAssassin which applies complex tests to incoming messages to try to intercept spam. This happens before messages are actually delivered. Although SpamAssassin currently intercepts and rejects up to 250,000 spam emails every day, many still get through and it can never be fully effective. If you are being troubled by persistent spam from a particular source, you can create rules to discard it, but you need to be very careful. Some of the examples in the next section may help you.

top of page

Some Example Rules

IGNORING MESSAGES FROM A SPECIFIED ADDRESS

For this, your Rule needs to examine the 'From:' address (the sender's address), in the incoming message. Let's suppose you want to put all messages coming from salesteam@example.com into a folder called JUNK. Your Rule could look like this:

[Example Rule for ignoring address]

Note how this Rule has been called junkmail in the example; you could add other addresses for which you want to apply the same treatment, by clicking the More Choices button. Click OK when you have finished creating or editing the Rule.

IGNORING MESSAGES FROM A SPECIFIED DOMAIN

The domain is that part of an email address which appears to the right of the '@' symbol. For example, example.com (as in another@example.com) and sussex.ac.uk (as in a.n.other@sussex.ac.uk) are both domains. If you want to 'junk' all email from a particular domain then you can use the same method as that described in the previous example, and just specify the mail domain instead of the full address, such as @example.com (it's best to include the @ sign together with the domain).

IGNORING MESSAGES WITH SPECIFIED KEY WORDS IN THE SUBJECT

Much junk email is readily identifiable from certain key words in the subject line. Suppose you wanted to 'junk' any messages that have the word 'anatrim' in the subject line. You could use a Rule like this:

[Example Rule for key words]

You could add tests for other keywords by clicking the More Choices button.

COMBINING TEST CONDITIONS

You can do more than one test on any one message. For example, you might want to combine tests for both a mail domain (in the From line) and a keyword (in the Subject line), or you might want to test for several different keywords. For each extra test, you just need to click the More Choices for each extra test you want to perform, as illustrated below:

[Example Rule with combined conditions] top of page

Filing instead of Discarding

Notice that the examples show unwanted mail being moved into nominated junk mail folders instead of being discarded altogether (for example using the Expunge Message action). This is because there is a danger that immediate expunging might discard genuine messages. It is safer to move these messages into a specially reserved mailbox, then at regular intervals check that mailbox yourself for any genuine email, move any to another folder, and delete and expunge the rest. The following detail from the Actions section of a Rule entry dialogue box illustrates how to use the Move Message To action:

[Move Message To action]

In this example, we are saving unwanted messages to a mailbox called 'SPAM'. Note the use of Mail/, which prefixes the mailbox name. You will need this if your SPAM mailbox is stored in your Mail/ hierarchy, if you have one, but you should omit the Mail/ part if the SPAM mailbox is stored in your topmost mailstore hierarchy. When choosing a mailbox to receive such mail, you can use the browse ([Browse]) button at the far end of the text box instead.

It's extremely important that you frequently review the contents of your nominated mailbox, checking quickly for 'genuine' messages, and deleting everything else therein. You must never leave the mailbox to grow unimpeded: if you do, this will waste a huge amount of disk space (remember that you share the system with around 14,000 other people!) and could overdraw your disk quota.

top of page

Keeping your Rules up to date

Circumstances for filter rules may change. For example, junk mail from a particular domain which you have been filtering, may stop coming if that domain ceases to exist or stops sending junk. In such cases you should consider removing the filter rule that handles this so as to conserve resources. The less the mail server is asked to do, the more efficiently it will work for everyone.

Do not be tempted to discard mail from an address or domain from which you have received only a few junk mails. 'Spammers' tend to use false addresses and change addresses frequently, so it's only worth filtering junk email from persistent sources. It's better just to "Ignore, Delete and Forget" occasional junk mail rather than set up a filter against it.

top of page

Where to find out more

You can find out more about Mulberry Local Rules by reading pages 167-172 and pages 175-186 of the online Mulberry Reference Manual.

If you are a University of Sussex student or staff member and you have any queries about Local Rule filtering, please contact us at IT Services Online Support.

Updated on 24 August 2010