# Configuring e-mail filtering in cPanel

> Create account-level and global email filters in cPanel to block, redirect or sort incoming messages by rules you set.

Source: https://helpcenter.ruachost.com/email/cpanel-email/configuring-e-mail-filtering-in-cpanel/

E‑mail filters allow you to block or redirect unwanted messages based on specific conditions. They’re useful for reducing spam, organizing incoming mail, or automatically handling certain types of messages.

## Types of Filters

- **Account‑level filters** → Apply to a single e‑mail account.
- **Global filters** → Apply to all e‑mail accounts under a domain.

## Creating an E‑mail Filter

1. **Log in to cPanel**.
2. On the **Tools page → Email section**:

   - For a specific account → click **Email Filters** → locate the account → **Manage Filters**.
   - For all accounts → click **Global Email Filters**.
3. Click **Create a New Filter**.
4. Enter a **Filter Name** (must be unique).
5. Under **Rules**, define conditions:

   - Example: Block messages with “buy” in the subject.

     - First box → **Subject**
     - Second box → **contains**
     - Text box → `buy`
   - Add multiple rules with the **+ icon**.
6. Under **Actions**, choose what happens if rules match:

   - Discard message.
   - Redirect to another address.
   - Deliver to a folder.
   - Flag as spam.
   - You can add multiple actions.
7. Click **Create**.

## Testing a Filter

1. Log in to **cPanel → Email Filters** or **Global Email Filters**.
2. Locate the filter → click **Test Filter**.
3. Enter a sample message.
4. Review the **Filter Trace Results** to see if rules matched and actions applied.

## Editing or Deleting a Filter

1. Log in to **cPanel → Email Filters** or **Global Email Filters**.
2. Under **Current Filters**, locate the filter.
3. Options:

   - **Edit** → modify rules/actions.
   - **Delete** → confirm deletion.

> **Note:**
- Filters use strict logic → be careful not to make rules too broad.
- Rules are **not case‑sensitive** (`buy` = `BUY`).
- Filters are cumulative → a message can pass one filter but be blocked by another.
