Guide to Email Filters with cPanel

Updated: 16 February 2024

Email filters help you manage your emails by using rules you set up. You can configure these filters in cPanel in two places:

  • Global Email Filters (cPanel » Home » Email » Global Email Filters) — These filters apply to all email addresses in your cPanel account.
  • Email Filters (cPanel » Home » Email » Email Filters) — These filters apply to specific email addresses in your cPanel account.


It's better to use many simple filters than one big filter. This is because the server's mail system, called Exim, can handle many small rules more easily than one big rule.


In these sections, you can add a rule by clicking +, or remove a rule by clicking -.

Email Filter Rules and Criteria Explained

This guide helps you decide what part of an email your filter should check to see if an email fits your rules.

You can set your filter to check:

  • From - Who sent the email.
  • Subject - What the email is about.
  • To - Who the email is sent to.
  • Reply Address - Where replies to the email go.
  • Body - What the email says inside.
  • Any Header - Parts of the email's top section, like To, From, etc.
  • Any recipient - Anyone getting the email.
  • Has not been previously delivered - Emails still waiting to be sent.
  • is an Error Message - Only checks error messages.
  • List ID - Emails from your mailing lists.
  • Spam Status - If the email is marked as spam or not.
  • Spam Bar - A score showing how likely an email is spam. More plus signs (+) mean higher chance of spam.
  • Spam Score - A number showing the spam score. Higher numbers mean more spammy.


You can't use BCC (blind carbon copy) to filter emails because the recipient doesn't see this info.

Operators Explained

After choosing which part of the email to look at, you pick how to compare it to what you're checking for.

Here are your choices:

  • equals - The email section is exactly the same as what you say.
  • matches regex - The email section fits a special pattern you create.
  • contains - The email section includes what you specify.
  • does not contain - The email section does not have what you specify.
  • begins with - The email section starts with what you specify.
  • ends with - The email section ends with what you specify.
  • does not begin - The email section does not start with what you specify.
  • does not end with - The email section does not end with what you specify.
  • does not match - The email section is not exactly the same as what you specify.

Actions: What Happens to Emails That Match a Filter

When cPanel finds an email that fits one of your filters, it does one of these things:

  • Discard Message - The system throws away the email without telling anyone it didn't get delivered.
  • Redirect to email - The system sends the email to a different email address you choose.


    This doesn't keep a copy in the original mailbox. If you want to keep a copy and send it somewhere else, you need to use the "Deliver to folder" action and choose the INBOX folder.

  • Fail with message - The system doesn't deliver the email and tells the sender it didn't go through.
  • Stop Processing Rules - The system won't apply any more filters or actions to this email.
  • Deliver to folder - The system puts the email in a specific folder you say.
  • Pipe to a program - Read Below

Pipe to a program

This sends the email to another program you have. For example, you could use it to automatically put email info into a help desk system.

The program gets the email and any headers. It can use variables like those in the $_SERVER array or from the command line. Be careful with memory limits in your program. If your program sends anything back, even an empty line, cPanel will think there's an error and send a bounce message. Put the program in your home directory and just give the part of the path after that. For example, use "" instead of "/home/user/", where "user" is your username.


If you're using PHP, make sure your code is correctly wrapped in the right start and end tags.

Filter Priority

Remember that filters are applied in the order they are listed. If you have multiple filters, make sure they are listed in the correct order.