Description
This function creates a new email filter. For more information about Exim filters, read Exim's documentation.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
account |
string |
The email address, for user-level filters. If you do not use this parameter, the function creates an account-level filter. |
A valid email address on the account. |
user@example.com |
filtername |
string |
Required The filter name. |
A string. |
coffee |
oldfiltername |
string |
The name of an existing filter, to rename it. If you do not use this parameter, the function creates a new filter. |
A filter on the account. |
pool |
action* |
string |
Required The filter's action. Important: You must increment each action. For example, pass the first action as action1and the second action asaction2. |
|
deliver |
dest* |
string |
The destination for filtered mail. This parameter defaults to an empty string. Important:
|
cheesecloth@example.com |
|
match* |
string |
Required The filter's match type.
Important: You must increment each match type. For example, pass the first match type asmatch1 and the second match type as match2. |
String operators:
Numeric operators:
|
contains |
opt* |
string |
The connection between multiple conditions. This parameter defaults to and. Important: You must increment each connection. For example, pass the first connection asopt1 and the second connection as opt2. |
|
and |
part* |
string |
Required The email section to query. Important: You must increment each section. For example, pass the first section as part1 and the second section as part2. |
Note: Generally, the recipient does not receive the BCCfield in an email's header. For this reason, youcannot use the BCC field in a filter.
|
$message_body |
val* |
string or integer |
Required The value to match. Important: You must increment each value. For example, pass the first value as val1 and the second value as val2. |
|
coconut |
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
, andval1
parameters. - Assign the information for the second filter rule to the
action2
,dest2
,match2
,opt2
,part2
, andval2
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
anddest1
parameters. - Assign the first set of conditions to the
match1
,opt1
,part1
, andval1
parameters. - Assign the second set of conditions to the
match2
,opt2
,part2
, andval2
parameters.
Returns
Return |
Type |
Description |
Possible values |
Example |
account |
string |
The filter's email address. The function only returns this value if it created a user-level filter. |
The account input return's value. |
user@example.com |