EMAILS

cPanel : How do I configure e-mail filters?

Configuring email filters in cPanel is a simple process that allows you to manage your incoming emails efficiently. This interface enables you to create, modify, and delete filters for selected email accounts.

Email filters allow you to set specific rules for incoming messages.

For example, you can define a rule to identify emails from a specific sender. When an email matches this rule, the system can automatically perform an action, such as deleting the message.

It is important to note that it is recommended to use multiple simple filters rather than a single complex filter. The server’s mail transfer agent, Exim, processes many small rules more efficiently than a single complex rule.

How to configure email filters in cPanel?

  • Log in to your cPanel.
  • Go to the EMAIL section and click on Email Filters.

cPanel email filters

Note: This procedure sets up filters for specific email addresses. To set up filters that apply to all email addresses in the domain, choose the Global Email Filters option.

  • Click Manage Filters for the email address you wish to configure.

  • Click Create a Filter to open the email filtering settings.


You will be redirected to the window below, where you can modify the filter by naming it, selecting the rules, choosing the criteria, entering a string value, and specifying the action the filter should take.

Note that you can add one or more rules and actions to your filter. This remains optional. Once the rules are set up, simply click Create.

Filtering Rules

The first set of options specifies which part of the email message the system examines to determine if the message matches your filter settings.
You can choose from the following options:

From — The sender’s address of the message.
Subject — The subject line of the message.
To — The address to which the message was sent.

Note: Typically, 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-To Address — The address where the sender receives replies. – Body — The content of the message. – Any Header — Refers to any part of the email header, including: To, From, Envelope-To, Content-Type, etc. – Any Recipient — Any recipient of the message. – Not Yet Delivered — The system only checks messages that are pending delivery. – Is an Error Message — The system only checks error messages sent by an auto-reply system. – List-ID — The mailing lists of the account. – Spam Status — Indicates whether Apache SpamAssassin™ has marked the message as spam. The spam status line starts with Yes or No. – Spam Bar — The content of the spam bar header generated by Apache SpamAssassin for this message. The more plus (+) signs assigned to a message, the higher the likelihood the system will consider it 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, refer to the Spam Score section below.

Comparison Operators

After selecting which part of the email message the system should examine, choose the type of comparison between that part of the message and the criteria you’ve set.
You can choose from the following options:

is equal to — The message exactly matches a defined string.
matches a regular expression — The message matches a regular expression you define.

Note: When selecting this option, the filter interprets characters as Perl-compatible regular expressions (PCRE), rather than literal characters part of a string. This includes common wildcard characters such as * and ?. Exim interprets backslashes as escaped characters, so you may need to add additional backslashes in your PCRE. For more information on Exim’s handling of backslashes, consult the Exim documentation.

contains — The message contains a string you define. – does not contain — The message does not contain the defined string. – starts with — The message starts with the defined string. – ends with — The message ends with the defined string. – does not start with — The message does not start 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.
Enter the word or phrase you want to filter under the operator and criteria fields.

Actions

When cPanel determines that an email message matches your filter, it processes the message with one of the following actions you specify:
Delete the message — The system deletes the incoming message without sending a failure notification.
Redirect to an email — The system forwards the message to another email address you define.

Note: This action does not keep a copy of the message in the inbox. To keep a copy of the message while forwarding it to another address, add a “Deliver to Folder” action to the filter and set it to deliver to the INBOX folder.

Fail with a message — The system deletes the message and automatically sends a failure notification to the sender. – Stop Processing Rules — The system stops executing further actions or applying remaining filters to 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, refer to the “Pipe to a Program” section below.
And that’s it! After clicking on “Create“, your new email filter is now in place! All new incoming emails for the specified email account will now be filtered according to this rule.

Articles Liés