Email filters in cPanel: block, redirect, sort
Create cPanel email filters and global filters to discard spam, redirect messages, sort mail by subject or sender, and avoid overbroad rules.
On this page
cPanel email filters let you act on incoming mail automatically. You can discard spam, redirect specific senders, sort messages by subject, or pipe messages to a script. Filters are powerful, so test narrowly before using broad delete rules.
Filter types
| Filter | Scope | Use case |
|---|---|---|
| Email Filters | One mailbox | Rules for a specific user mailbox. |
| Global Email Filters | All mailboxes in the cPanel account | Account-wide spam or routing rules. |
Create a filter
- Open cPanel.
- Choose Email Filters for one mailbox or Global Email Filters for all mail.
- Click Create a New Filter.
- Name the filter clearly, such as
Discard fake invoices. - Choose a field such as From, Subject, To, Any Header, or Spam Status.
- Choose a match rule such as equals, contains, begins with, or matches regex.
- Enter the text to match.
- Choose the action and save.
Common actions
- Discard Message: deletes the message during delivery.
- Redirect to Email: forwards matching mail to another address.
- Deliver to Folder: moves mail to a specific IMAP folder.
- Pipe to Program: advanced script handling; use only for maintained scripts.
- Fail with Message: rejects the message with a bounce.
Examples
| Goal | Rule | Action |
|---|---|---|
| Move SpamAssassin-tagged mail | Spam Status begins with Yes | Deliver to folder Junk |
| Discard a known sender | From equals sender@example.net | Discard Message |
| Sort invoices | Subject contains invoice | Deliver to folder Invoices |
| Redirect support mail | To equals support@example.com | Redirect to Email |
Safety checks
- Test with a harmless action such as Deliver to Folder before discarding mail.
- Avoid broad rules like Subject contains
orderunless you are sure. - Regex filters are powerful but easy to misconfigure.
- If expected mail disappears, temporarily disable recent filters and test again.
Related: How to manage spam filters in cPanel | Email forwarders in cPanel: redirect mail to another address | Default Address in cPanel: handle mail to unknown addresses | Not receiving email-why and how to fix it
Need cPanel hosting or licensing?
Use UnderHost cPanel hosting or add cPanel/WHM to a VPS or dedicated server for familiar website, email, DNS, and database management.





















