Email & webmail

Create email filters in cPanel (per account and global filters)

Use cPanel Email Filters and Global Email Filters to sort, forward, discard or bounce messages by subject, sender or spam score, and test each rule before saving.

IntermediatecPanel hosting2 min read

Email filters act on messages as they arrive on the server, before any email app sees them. Use them to move newsletters into a folder, forward invoices to your accountant, or delete mail that matches a pattern. Because they run on the server, they work the same in webmail, Outlook and on your phone.

Before you start

  • At least one email account. See create email accounts in cPanel.
  • Decide the scope:
    • Email Filters apply to one mailbox.
    • Global Email Filters apply to every address on your cPanel account, including forwarders.

Create a filter for one mailbox

  1. Open cPanel → Email → Email Filters.
  2. Click Manage Filters next to the account, then Create a New Filter.
  3. Enter a Filter Name, for example Invoices.
  4. Under Rules, build the condition, e.g. Subject contains invoice. Use the + button to add more rules joined with and or or.
  5. Under Actions, choose what happens:
    • Deliver to Folder: click Browse and pick an IMAP folder such as INBOX.Invoices.
    • Redirect to Email: forward a copy to another address.
    • Discard Message: delete silently.
    • Fail with Message: bounce back to the sender with your text.
    • Stop Processing Rules: no later filter runs.
    • Pipe to a Program: send the message to a script (advanced).
  6. Click Create.

Tip: Create the destination folder in webmail first. In Roundcube go to Settings → Folders. See use Roundcube webmail.

Useful rule ideas

GoalRuleAction
Hide newslettersAny Header contains List-UnsubscribeDeliver to Folder INBOX.Newsletters
Delete obvious spamSpam Score is greater than 8Discard Message
Copy invoicesFrom contains billing@supplier.comRedirect to Email accountant address
Block a senderFrom equals pest@example.netFail with Message

For most spam, the Spam Filters tool is easier; use filters for edge cases.

Test the filter

Back on the Manage Filters page, scroll to Filter Test. Paste a sample message with headers, for example:

From: billing@supplier.com
Subject: Invoice 1024

Please find attached.

Click Test Filter. cPanel shows which rule matched and what would happen, without touching real mail.

Global filters

Open cPanel → Email → Global Email Filters and click Create a New Filter. The form is the same, but the rule runs for all mail delivered to your account. Typical use: discard messages with a very high spam score for every mailbox. Global filters run before per-account filters.

Edit, reorder or delete

Each list shows Edit and Delete links. Drag filters by the handle to change their order; they run from top to bottom.

Troubleshooting

  • Filter does nothing: rules are case sensitive in some fields; try matches regex with (?i)invoice, and test with Filter Test.
  • Mail disappeared: a Discard rule matched more than expected. Use Track Delivery to see what happened.
  • Folder not found: the folder must already exist and be written as INBOX.Name.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.