# Email Filtering

Email / Email Filtering

## Return cPanel account's email filters total

 - [GET /Email/count_filters](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/count_filters.md): This function returns the number of email filters for every email address on a cPanel account.

Important:

  When you disable the Receive Mail role or the IP Blocker feature, the system disables this function. For more information, read our How to Use Server Profiles documentation.

## Delete email account's email filter

 - [GET /Email/delete_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/delete_filter.md): This function deletes an email filter.

Important:

  When you disable the Receive Mail role, the system disables this function.

## Disable email filter for email account

 - [GET /Email/disable_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/disable_filter.md): This function disables an email filter.

Important:

  When you disable the Receive Mail role, the system disables this function.

## Enable email filter for email account

 - [GET /Email/enable_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/enable_filter.md): This function enables an email filter.

Important:

  When you disable the Receive Mail role, the system disables this function.

## Return email filter's information

 - [GET /Email/get_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/get_filter.md): This function retrieves an email filter's information.

Important:

When you disable the Receive Mail role, the system disables this function.

## Return account-level email filters

 - [GET /Email/list_filters](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/list_filters.md): This function lists account-level mail filters. For more information about Exim filters, read Exim’s documentation.

Important:

  When you disable the Mail Receive role, the system disables this function.

## Return domains with domain-level email filters

 - [GET /Email/list_filters_backups](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/list_filters_backups.md): This function lists all of the cPanel account's domains that use domain-level filters.

Important:

  When you disable the Receive Mail role, the system disables this function.

## Return system-level email filter file information

 - [GET /Email/list_system_filter_info](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/list_system_filter_info.md): This function retrieves a .yaml.gz file that contains system-level filter information.

Important:

  When you disable the Receive Mail role, the system disables this function.

## Update email address's email filter order

 - [GET /Email/reorder_filters](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/reorder_filters.md): This function modifies the filter order for an email address. For more information about Exim filters, read Exim's documentation.

Important:

When you disable the _Receive Mail_ role, the system disables this function.

## Create email filter

 - [GET /Email/store_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/store_filter.md): This function creates a new email filter. For more information about Exim filters, read Exim's documentation.

Important:

When you disable the Receive Mail role, the system disables this function.

### Create multiple rules

You may create up to 4,096 separate sets of conditions in one filter. To do this, append numbers to the parameter names.

To create a filter with two sets of actions and conditions, use the following parameters:
  * Assign the information for the first filter rule to the action1, dest1, match1, opt1, part1, and val1 parameters.
  * Assign the information for the second filter rule to the action2, dest2, match2, opt2, part2, and val2 parameters.

To create a filter that uses one set of actions but two sets of conditions, use the following parameters:
  * Assign the actions to the action1 and dest1 parameters.
  * Assign the first set of conditions to the match1, opt1, part1, and val1 parameters.
  * Assign the second set of conditions to the match2, opt2, part2, and val2 parameters.

## Run test for main domain email filters

 - [GET /Email/trace_filter](https://api.docs.cpanel.net/specifications/cpanel.openapi/email-filtering/trace_filter.md): This function tests mail filters. The function only tests filters for the cPanel account's main domain, and only tests against the message's body. For more information about Exim filters, read Exim's documentation.

Note:

If the domain or account does not contain a filter file, this function will fail.

Important:

When you disable the Receive Mail role, the system disables this function.

