Email filters in cPanel allow you to automatically manage incoming messages based on criteria such as sender, subject, or content. With them, you can organize emails into folders, block unwanted senders, forward messages to another account, or delete emails you don't need — all without manual intervention.
cPanel offers two levels of email filters. It's important to understand the difference in order to choose the right one:
| Type | Where is it? | Who does it apply to? |
|---|---|---|
| Global filters | Email → Global Email Filters | All email accounts on the domain |
| Per-account filters | Email → Email Filters | Only a specific email account |
ℹ️ Which one to choose? Global filters are ideal for rules you want to apply across all accounts (for example, blocking a spam sender for the entire domain). Per-account filters are better for personalized rules for each mailbox.
The process is the same for both filter types. In this example, we'll use global filters:


In the Filter Name field, type a descriptive name that allows you to easily identify the rule. This name is for reference only and does not affect how the filter works.
Good name examples: Block spam promotions, Invoices to folder, Forward orders to sales.
Each filter needs at least one condition that determines when it triggers. Conditions are made up of three parts:
1️⃣ Field to evaluate — Which part of the email is analyzed:
| Field | What does it evaluate? | Common use |
|---|---|---|
| From | The sender's address | ⭐ Very common |
| Subject | The message subject line | ⭐ Very common |
| To | The recipient's address | Moderate |
| Body | The message content | Moderate |
| Any Header | All email headers | Advanced |
| Spam Score | The SpamAssassin score of the message | Advanced |

2️⃣ Comparison operator — How the value is compared:
| Operator | Meaning | Example |
|---|---|---|
| contains | The field includes the text anywhere | Subject contains "invoice" → matches "Your January invoice" |
| equals | The field matches the text exactly | From equals "spam@example.com" |
| begins with | The field starts with the text | Subject begins with "[ALERT]" |
| ends with | The field ends with the text | From ends with "@spamdomain.com" |
| does not contain | The field does NOT include the text | Subject does not contain "important" |
| matches regex | Matches a regular expression | Advanced — for complex patterns |

3️⃣ Value — The text or address you want to search for (for example: invoice, spam@example.com, newsletter).
ℹ️ Multiple conditions: You can add more than one condition by clicking the + button. When using multiple conditions, choose whether the filter triggers when all (AND) or any (OR) of them are met.
Once the conditions are defined, select what to do with the matching emails:
| Action | What does it do? |
|---|---|
| Discard message | Deletes the email without delivering it (the sender is not notified) |
| Redirect to email | Forwards the email to another address (no local copy is kept) |
| Deliver to folder | Moves the email to a specific IMAP folder |
| Fail with message | Rejects the email and sends an error message back to the sender |
| Stop processing rules | Stops evaluating subsequent filters for this message |
| Pipe to a program | Sends the email to a script (advanced use) |

Click Create to save the filter. The filter will be applied immediately to all new incoming emails.
Here are some filters you can replicate directly based on your needs:
Ideal for blocking persistent spam from a known address.
| Filter name: | Block spam promotions |
| Condition: | From → equals → offers@spammer.com |
| Action: | Discard message |

Keeps your inbox clean by automatically organizing invoices.
| Filter name: | Invoices to folder |
| Condition: | Subject → contains → invoice |
| Action: | Deliver to folder → Invoices |

ℹ️ Note: The folder must exist beforehand. You can create it from Webmail (Roundcube or Horde) before setting up the filter.
When spam comes from multiple addresses at the same domain.
| Filter name: | Block spam domain |
| Condition: | From → ends with → @spamdomain.com |
| Action: | Discard message |
Useful when a contact form sends orders to a general account and you need them to also reach the sales team.
| Filter name: | Forward orders to sales |
| Condition: | Subject → contains → new order |
| Action: | Redirect to email → sales@yourdomain.com |
⚠️ Important: The "Redirect" action does not keep a copy in the original account. If you need to keep a copy and also forward, use a Forwarder in cPanel instead of a filter.
Automatically deletes emails that SpamAssassin clearly considers spam for all accounts on the domain.
| Filter name: | Delete high spam |
| Condition: | Spam Score → is above → 8 |
| Action: | Discard message |
✅ Best practices:
Tax invoice is better than just invoice.❌ Common mistakes:
⚠️ Remember: Filters only apply to new emails that arrive after the rule is created. They do not affect messages already in your inbox.
If you need help setting up a specific filter or aren't sure which rule to apply, our support team can guide you: