UnderHost
Knowledgebase Docs

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

FilterScopeUse case
Email FiltersOne mailboxRules for a specific user mailbox.
Global Email FiltersAll mailboxes in the cPanel accountAccount-wide spam or routing rules.

Create a filter

  1. Open cPanel.
  2. Choose Email Filters for one mailbox or Global Email Filters for all mail.
  3. Click Create a New Filter.
  4. Name the filter clearly, such as Discard fake invoices.
  5. Choose a field such as From, Subject, To, Any Header, or Spam Status.
  6. Choose a match rule such as equals, contains, begins with, or matches regex.
  7. Enter the text to match.
  8. 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

GoalRuleAction
Move SpamAssassin-tagged mailSpam Status begins with YesDeliver to folder Junk
Discard a known senderFrom equals sender@example.netDiscard Message
Sort invoicesSubject contains invoiceDeliver to folder Invoices
Redirect support mailTo equals support@example.comRedirect to Email

Safety checks

  • Test with a harmless action such as Deliver to Folder before discarding mail.
  • Avoid broad rules like Subject contains order unless 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

Was this article helpful?

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.

Related articles

Back to cPanel