# Sort mail with labels and filters

> Create labels, write filters that sort new mail as it arrives, and block senders you never want to hear from in webmail.

Source: https://www.coritan.com/docs/mail/webmail/labels-and-filters/

In the dashboard:

- /webmail/settings/labels: https://www.coritan.com/webmail/settings/labels
- /webmail/settings/filters: https://www.coritan.com/webmail/settings/filters

Labels group your conversations. They work like folders, but one conversation can have more than one label. Filters sort new mail as it arrives: they can move a message, label it, star it, forward it or delete it. Labels are on the **Labels** tab of webmail settings, at [www.coritan.com/webmail/settings/labels](https://www.coritan.com/webmail/settings/labels). Filters are on the **Filters and blocked** tab, at [www.coritan.com/webmail/settings/filters](https://www.coritan.com/webmail/settings/filters), which also blocks senders and imports and exports filters.

Filters run on the mail server, so they sort mail while webmail is closed, and every app that reads the mailbox sees the result. Labels show in mail apps as folders.

## Before you begin

- To create, rename or delete a label, you need to own the mailbox or be able to send from it. Someone who **Can only read** the mailbox sees its labels but cannot change them.
- The **Filters and blocked** tab is for whoever manages the mailbox: its owner, or, for a mailbox that no Coritan account owns, everyone who can send from it. See [Who sees each tab](/docs/mail/webmail/settings/#who-sees-each-tab).

## Create a label

1. In the sidebar, under **Labels**, select **New label**.
2. Type a name of up to 200 characters, then press <kbd>Enter</kbd>. To stop, press <kbd>Esc</kbd>.

The label appears in the sidebar. You can also create one on the **Labels** tab: type the name in **New label**, then select **Create label**. We show `Label created.`

To open the **Labels** tab from the sidebar, select the gear beside **Labels** (**Manage labels**).

## Label a conversation

- Open a conversation, or select some in the list, then select the tag button (**Labels**). Type in **Search labels** to narrow the list, then select a label to add it. A tick means the label is on every conversation you selected; select that label again to take it off.
- Drag conversations from the list onto a label in the sidebar. This adds the label and leaves them where they are.
- Select the folder button (**Move to**), then a label. The messages leave the folder you are in, and any other label they had, for that label alone.

To take a label off an open conversation, select the X on the label's name above the first message. You can also press <kbd>l</kbd> to open the **Labels** menu, or <kbd>v</kbd> for **Move to**.

Select a label in the sidebar to see its conversations. To search within one, see [Read and search mail in webmail](/docs/mail/webmail/read-and-search/).

## Rename or delete a label

The **Labels** tab lists every label with the number of conversations it has. Select a label's name to open it.

- To rename a label, select the pencil button beside it, change the name, then select **Save**. We show `Label renamed.`
- To delete a label, select the bin button beside it, then confirm with **Delete label**. We show `Label deleted.`

Deleting a label leaves its conversations in your mail. A conversation that was only under that label moves to Archive.

> [!NOTE]
> Webmail keeps the messages you schedule, the conversations you snooze and your templates in folders named Scheduled, Snoozed and Templates. They are not labels, so the **Labels** tab does not list them, but mail apps show them as folders.

## Create a filter

A filter has conditions and actions. When a new message meets the conditions, the actions run on it. Filters run from the top of the list, and every filter a message matches acts on it, until one says **Stop here**. A filter acts only on mail that arrives after you save it.

1. On the **Filters and blocked** tab, select **Add filter…**.
2. In **Name**, type a name for the filter, such as `Invoices`.
3. Under **When a message matches**, choose **All conditions** or **Any condition**.
4. Fill in the first condition: what to look at, how to compare, and what to look for, such as **From**, **contains** and `billing@example.com`. Select **Add condition** for another one.
5. Under **Then**, choose the first action and, where it asks, a folder or an address. Select **Add action** for another one.
6. Select **Add filter**.

We show `Filter “Invoices” added.`, and the filter appears at the bottom of the list with a summary of what it does.

You can also start from mail you have:

- From a message you are reading, open its menu (**Message actions**) and select **Filter messages like this**. The editor opens with the conditions **From** **contains** the sender's address and **Subject** **contains** the message's subject.
- From a search, select **Show search options** in the search bar, fill in the fields, then select **Create filter**. The editor opens with a condition for each field you filled in.

### What a filter can look at

| Look at | How it compares |
| --- | --- |
| **From**, **To**, **Cc**, **Subject**, **Message text** | **contains**, **does not contain** or **is** the text you type |
| **Size** | **is larger than** or **is smaller than** a whole number of MB |
| **Attachments** | **At least one** or **None** |

### What a filter can do

| Action | What happens to the message |
| --- | --- |
| **Move to** | It goes to the folder or label you choose, and not to the Inbox. |
| **Copy to** | It gets the label you choose, and it still arrives in the Inbox. |
| **Mark as read** | It arrives marked as read. |
| **Star it** | It arrives starred. |
| **Mark it important** | It arrives marked as important. |
| **Forward to** | It goes on to one confirmed address. A copy stays here unless you clear **Keep a copy in this mailbox**. See [Forward your mail to another address](/docs/mail/webmail/forwarding/). |
| **Discard it** | It is deleted as it arrives and never reaches Trash. |
| **Stop here** | The filters below this one do not run on it. |

A filter files mail into Inbox, Archive, Spam, Trash or one of your labels.

## Change or turn off a filter

The tab lists your filters in the order they run. On each row:

- The switch at the start turns the filter off or on. A filter that is off reads **Off**, stays in the list and does nothing.
- The arrows move the filter up or down the list.
- The pencil button opens the filter. Change it, then select **Save filter**.
- The bin button deletes the filter once you confirm with **Delete filter**. Mail the filter sorted already stays where it is.

Blocked senders run before your filters, and so does forwarding all mail. When all mail is forwarded, the tab says so above the list, with a link to the **Forwarding** tab.

## Block a sender

New messages from a blocked address go straight to Spam, even when the sender is one of your contacts. No other filter runs on them, so they are not forwarded either.

1. On the **Filters and blocked** tab, under **Blocked senders**, type an address such as `alex@example.com` in **Address or @domain**. To block everyone at a domain, type `@example.com`.
2. Select **Block**.

We show `Mail from alex@example.com goes to Spam from now on.`, and the address joins the list.

To block the sender of a message you are reading, open the message's menu (**Message actions**), select `Block` followed by the sender's name, then confirm with **Block**.

Mail that arrived before you blocked the sender stays where it is. To unblock an address, select **Unblock** beside it in **Blocked senders**.

## Import and export filters

- **Export** downloads `filters.json`, with your filters and blocked senders. Forwarding all mail is not in it. The button appears once you have a filter.
- **Import…** reads a `filters.json` exported from this webmail, or the `mailFilters.xml` file that Gmail exports from its Filters and Blocked Addresses settings. Imported filters go after the ones you have.

When you import, each label a filter uses is matched by name, and a label that does not exist yet is created. A filter keeps a forward only to an address that has confirmed on the **Forwarding** tab. Gmail filters that look for something this webmail cannot match, or that only do something it cannot do, such as sorting into categories, are left out. After the import, we say how many filters came in and what was left out.

## Filters written as Sieve

A mailbox's filters are kept on the mail server as a script in the Sieve language. Webmail writes that script for you from your filters and blocked senders. You can also write it yourself.

1. On the **Filters and blocked** tab, select **Edit as Sieve**. The **Sieve script** box shows the script your filters make.
2. Change the script. To have the mail server check it, select **Validate script**.
3. Select **Save script**. We show `Sieve script saved.`

To leave without saving, select **Back to rules**. If you changed the script, confirm with **Discard changes**.

Once you save a script of your own, the tab shows the script instead of the list, and so it does when another app changes the script. Until the filters are rules again, you cannot add filters, block senders or forward all mail. To go back to rules, select **Replace with rules…** and confirm with **Replace script**. The script is deleted and you start again with no filters, so copy the script first if you want to keep it.

## Limits

- A mailbox holds up to 100 filters. Forwarding all mail takes one, and blocked senders take one for each group of up to ten addresses.
- A filter has up to 10 conditions and 10 actions, and forwards to one address.
- What a condition looks for is up to 256 characters. A size is 1–1000 MB.
- A filter's name is up to 120 characters, and a label's name up to 200.
- A script is up to 100,000 characters.

## Troubleshooting

A new filter did not sort the mail already in the mailbox
: Filters act on mail as it arrives. To sort older mail, search for it, select the conversations, then use **Labels** or **Move to**.

`Filters are not available on this mail server.`
: The mail server that holds this mailbox runs no filters, so it cannot block senders or forward mail either. Labels still work.

`The mail server is not running these filters at the moment, so new mail is not sorted by them.`
: The filters are saved, but the mail server is not using them. Another app may have switched it to a script of its own. Save any change to the filters, such as turning one off and on again, to make them run again.

`Give the filter a name.`
: Type a name in **Name**.

`Enter what to look for.`
: A condition has an empty box. Type what to look for, or remove the condition with its X.

`Enter a whole number of MB from 1 to 1000.`
: A **Size** condition takes whole megabytes, such as `10`.

`Choose a folder.`
: A **Move to** or **Copy to** action has no folder yet. Choose one.

A message that starts `A filter forwards to one address.`
: Keep one **Forward to** action. To forward to two addresses, make a second filter with the same conditions.

A message that ends `has not confirmed forwarding from this mailbox yet. Confirm it on the Forwarding tab first.`
: The filter forwards to an address that has not confirmed. [Add and confirm the address](/docs/mail/webmail/forwarding/#add-and-confirm-a-forwarding-address), then save the filter again.

`That folder no longer exists. Choose another.` or `The folder this filter files into no longer exists. Choose another.`
: Someone deleted the label the filter files mail into. In the list, the filter's summary reads `a folder that no longer exists`. Edit the filter and choose another folder.

A message that says another filter `files into a folder that no longer exists, so no change to the filters can be saved`
: No change saves while a filter that is on files into a deleted label. Edit the filter the message names, or turn it off, then try again.

`The mail server did not accept the filter` or `The script has an error`
: The mail server could not read the filter or the script. The message says what it found. Fix the script, or replace it with rules.

A warning that starts `These filters are a Sieve script, so blocking waits until they are rules again.`
: You tried to block a sender while the filters are a script. Add the block to the script, or [replace the script with rules](#filters-written-as-sieve).

`This mailbox has no Spam folder, so it cannot block anyone.`
: Blocked mail goes to Spam, and this mailbox has none. A filter with **From** **contains** the address can still move the sender's mail elsewhere or discard it.

`There is a label with that name already.`
: Two labels cannot share a name. Choose another name, or use the label you have.

A message that ends `you can read this mailbox but not change it.`
: The mailbox was shared with you so that you can only read it. Ask its owner to let you send from it.

There is no **Labels** tab or no **Filters and blocked** tab
: **Labels** is for everyone who can send from the mailbox. **Filters and blocked** is for whoever manages it. Ask the mailbox's owner to make the change.

## Related

- [Forward your mail to another address](/docs/mail/webmail/forwarding/)
- [Read and search mail in webmail](/docs/mail/webmail/read-and-search/)
- [Change webmail settings](/docs/mail/webmail/settings/)
- [Open and share mailboxes in webmail](/docs/mail/webmail/mailboxes-and-sharing/)
