Control Panels

How to Create Email Filters in cPanel (Sort, Forward and Block Mail Automatically)

Learn how to set up email filters in cPanel to block spam, organize messages, and streamline inbox management.

Short answer: In cPanel, open Email > Email Filters, click Manage Filters next to a mailbox, then Create a New Filter. Give it a name, add one or more rules (for example Subject contains Invoice), choose an action such as Deliver to Folder, and save. Use the Filter Test box to check it. For rules that apply to every address on your account, use Global Email Filters.

Email Filters or Global Email Filters?

Tool Applies to Use it for
Email Filters One mailbox Sorting into folders, forwarding particular mail, personal blocks
Global Email Filters All mail for every address on the cPanel account Blocking a sender or subject for the whole business

Step 1: open the filter page

  1. Log in to cPanel.
  2. Open Email > Email Filters (or Global Email Filters).
  3. For a single mailbox, click Manage Filters next to the address.
  4. Click Create a New Filter.

Step 2: write the rules

Each rule has three parts: what to look at, how to compare it, and the value.

Look at Compare with Example
From contains, equals, begins with, matches regex From contains @supplier.com
Subject contains, does not contain, matches regex Subject contains Invoice
To contains, equals To contains sales@
Body contains Body contains unsubscribe
Any header contains A header your newsletter tool adds
Spam status / spam score begins with, is above Spam score above 5 (needs Spam Filters turned on)

Add more rules with the + button and choose and (all must match) or or (any may match).

Step 3: choose the action

Action What happens
Deliver to Folder Moves the message into a folder in the mailbox. The safest way to sort.
Redirect to Email Forwards the message to another address.
Discard Message Deletes the message silently. The sender is not told.
Fail with Message Rejects the message and sends your text back to the sender.
Stop Processing Rules Prevents later filters from acting on the message.
Pipe to a Program Sends the message to a script on your account, for advanced uses.

Prefer Deliver to Folder over Discard while you test a filter. A discarded message cannot be recovered if the rule catches the wrong mail.

Step 4: test before you rely on it

At the bottom of the filter page, the Filter Test box lets you paste a sample message, starting with headers such as From: and Subject:, and shows what the filters would do. Then send a real test message and check where it lands.

Useful filter examples

# Sort invoices
Rule:   Subject contains "Invoice"
Action: Deliver to Folder  INBOX.Invoices

# Move high-scoring spam out of the inbox
Rule:   Spam Score is above 5
Action: Deliver to Folder  INBOX.spam

# Block one sender for every address on the account (Global Email Filters)
Rule:   From contains "spammer@example.org"
Action: Discard Message

Order matters

Filters run from top to bottom. A message that matches an early filter with Stop Processing Rules, or that is discarded, never reaches later filters. Put specific filters first and broad ones last. Drag filters on the list to change their order.

Filters and spam protection

Filters work best together with Email > Spam Filters. Turn on spam filtering so messages get a spam score, then let a filter, or the built-in spam box option, move high-scoring mail out of the inbox. For server-wide settings, see our cPanel anti-spam settings guide.

Filters in webmail

Roundcube webmail has its own filter settings under Settings > Filters, if your server enables them. They are stored separately from cPanel’s filters, so keep each rule in one place to avoid confusion.

Need help with this?

Business email that works with your website, with spam filtering included in our hosting plans.

See web hosting plansContact @CustomerPanel

Frequently asked questions

How do I block an email address in cPanel?

Create a Global Email Filter with From contains the address and the action Discard Message, or use Deliver to Folder to keep a copy.

What is the difference between Email Filters and Global Email Filters?

Email Filters apply to one mailbox. Global Email Filters apply to all mail for every address on the cPanel account.

Why is my filter not working?

Check the rule text and the order of your filters, and use the Filter Test box with a real message’s headers.

Can a filter forward email to another address?

Yes. Use the Redirect to Email action.

Can I recover a discarded message?

No. Discarded messages are deleted. Use Deliver to Folder while testing.


Sources