MYCLOUD EMAIL | How to Configure Email Filters

Overview

Email filters use the criteria that you specify to determine how to handle email messages. The following cPanel interfaces allow you to configure email filters:

  • The Global Email Filters interface (cPanel >> Home >> Email >> Global Email Filters) — Global email filters affect the cPanel account’s email addresses.

  • The Email Filters interface (cPanel >> Home >> Email >> Email Filters) — User-level filters affect specific email addresses on the cPanel account.

Important:
We strongly recommend that you use multiple, simple filters instead of a single large filter. Exim, the server’s mail transfer agent, handles many small rules more efficiently than a single large rule.
Note:
In these interfaces, click + to add a rule, or click - to remove rules.

Filter rules and criteria

The first set of options specifies which part of the email message the system examines to determine whether the message matches your filter parameters.

You can choose from the following options:

  • From — The message sender’s address.
  • Subject — The message’s subject line.
  • To — The address to which the sender sent the message.
    Note:
    Generally, the recipient does not receive the BCC field in an email’s header. For this reason, you cannot use the BCC field in a filter.
  • Reply Address — The address at which the sender receives replies.
  • Body — The message’s content.
  • Any Header — Any Header refers to any part of the header in an email, including: ToFromEnvelope-ToContent-Type, etc.
  • Any recipient — Any recipient of the message.
  • Has not been previously delivered — The system only examines messages that remain in the queue for delivery.
  • is an Error Message — The system only examines error messages that an auto-response system sends.
  • List ID — The account’s mailing lists.
  • Spam Status — Whether Apache SpamAssassin™ marked the message as spam. The Spam Status line begins with Yes or No.
  • Spam Bar — The content of the Spam Bar header that Apache SpamAssassin generated for this message. The more plus signs (+) that Apache SpamAssassin assigns to a message, the greater the likelihood that the system marks the message as spam.
  • Spam Score — The total number of plus signs (+) in the Spam Bar value, expressed as an integer. For more information about the Spam Score option, read the Spam Score section below.

Operators

After you select the portion of the email message that the system will examine, select the type of comparison between that portion of the email and the criteria that you enter.

You can choose from the following options:

  • equals — The message exactly matches a defined string.
  • matches regex — The message matches a regular expression that you define.
    Click to view an example rule that matches a regular expression
    Note:
    • When you select this option, the filter interprets characters as Perl-Compatible Regular Expressions (PCRE), rather than as literal characters that are part of a string. This includes commonly-used wildcard characters such as the * and ? characters.
    • Exim interprets backslashes as escaped characters. As a result, you may need to include additional backslashes in your PCRE. 
  • contains — The message a string that you define.
  • does not contain — The message does not contain the defined string.
  • begins with — The message begins with the defined string.
  • ends with — The message ends with the defined string.
  • does not begin — The message does not begin with the defined string.
  • does not end with — The message does not end with the defined string.
  • does not match — The message does not exactly match the defined string.

Spam Score

The following options are only applicable when you select the Spam Score option:

  • is above (#s only) — The message’s Spam Score is greater than the number that you define.
  • is not above (#s only) — The message’s Spam Score is equal to or less than the number that you define.
  • is below (#s only) — The message’s Spam Score is less than the number that you define.
  • is not below (#s only) — The message’s Spam Score is greater than or equal to the number that you define.
    Important:

    When you create a filter that uses several operators, the system processes the and operator before the or operator. For example:

    • The system processes A or B and C as A or (B and C).
    • The system processes A and B or C as (A and B) or C.

Criteria

Enter the criteria to use in the text box under the Rules menus. The type of data that you enter determines the comparison that the system performs.

For example, if you select the From and Equals filters, enter user@example.com as the criteria. The system determines that any email from user@example.com matches the filter, but does not match seconduser@example.com because it contains additional letters.

Important:
Exim converts newlines into spaces in the $message_body field. Do not add \n characters to any body filters that you create.

 

Multiple rules

To create additional rules for a filter, click a plus symbol to the right of a rule. A new option menu, operator menu, and criteria text box will appear on the interface.

To delete a rule, click the minus symbol to the right of that rule. The system will remove that rule from the interface.

Select how the system processes the list of rules with the or menu to the right of the rules:

  • or — Any rule in the list must be true for the system to perform the actions.
  • and — All rules in the list must be true for the system to perform the actions.

Actions

When cPanel determines that an email message matches your filter, it handles that message with the any of the following actions that you specify:

  • Discard Message — The system discards the incoming message with no failure notice.
  • Redirect to email — The system forwards the message to another email address that you specify.

    Note:
    This action does not retain a copy of the message in the mailbox. To retain a copy of the message in the inbox and forward it to another address, add a Deliver to folder action to the filter and set it to deliver it to the INBOX folder.

     

  • Fail with message — The system discards the message and automatically send a failure notice to the sender.

  • Stop Processing Rules — The system stops performing further actions or applying any remaining filters on this message.

  • Deliver to folder — The system delivers the message to a specified folder.

  • Pipe to a program — The system sends the incoming message to a specified program. For more information, read the Pipe to a Program section below.

Pipe to a Program

Important:
  • Make certain that your script uses the proper file permissions (0700). To change your script’s file permissions, run the chmod 0700 myscript.php command, where myscript.php represents your script’s location and file name.
  • This option only appears if your hosting provider enables it.

Use the Pipe to a Program option to parse and enter email information into a different system. For example, use the Pipe to a Program option to pipe email information to a program that enters email information into a ticket system.

  • STDIN pipes email and headers to the program.
  • Pipes can accept variables from the $_SERVER array and variables on the command line.
  • The language or environment that you use may cause memory limit issues.
  • If your script produces any output, even a blank line, the system will create a bounce message that contains that output.

When you use the Pipe to a Program option, enter a path that is relative to your home directory. For example, to use the /home/user/script.pl script, enter script.pl in the Pipe to a Program text box, where user represents your username.

Note:
If you use PHP, make certain that you appropriately wrap your code in start and end tags.

 

Multiple actions

To create additional actions for a rule, click a plus symbol to the right of an action. A new action menu will appear on the interface.

To delete an additional action, click the minus symbol to the right of the action. The system will remove that action from the interface.

  • email
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

MYCLOUD EMAIL | How to setup Out-of-Office reply in your Webmail

Please follow the steps below:- Login into your Webmail (for e.g....

MYCLOUD EMAIL | How to Set Up a Signature in Webmail

  Overview An email signature is a personalized block of text at the bottom of an email. The...

MYCLOUD EMAIL | How to Set Up Webmail Folders

Overview You may need to perform certain steps in your webmail application in order to view...

MYCLOUD EMAIL | How to Set Up a cPanel Email Account for iOS® and Android™

Overview Warning: Because cPanel, L.L.C. doesn’t develop or ship these products, Exitra...

MYCLOUD EMAIL | IMAP Versus POP3

Overview IMAP and POP3 are different in how and for how long they store mail on the mail server....

Powered by WHMCompleteSolution