Description

This function lists data for old-style email filters in the cPanel account's .filter file.

 For more information about Exim filters, read Exim's documentation.

We strongly recommend that you use the following UAPI function instead of this function:

Examples 




https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=listfilters



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List the old-style filters for this account.
$list_old_style_filters = $cpanel->api2(
    'Email', 'listfilters'
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List the old-style filters for this account.
my $list_old_style_filters = $cpliveapi->api2(
    'Email', 'listfilters',
);




cpapi2 --user=username Email listfilters



{
  "cpanelresult": {
    "apiversion": 2,
    "func": "listfilters",
    "data": [
      {
        "dest": "/dev/null",
        "nicedest": "Discard",
        "filter": "$h_X-Spam-Bar: contains "+++++""
      },
      {
        "dest": "/dev/null",
        "nicedest": "Discard",
        "filter": "$header_subject: contains "coconut""
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Email"
  }
}



Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
deststringThe filtered mail's destination.
  • A file path.
  • An application path.
  • A valid email address.
/dev/null
nicedeststringThe filter's action.A valid string.Discard
filterstringThe filter's criteria.An email section, a match type, and the value to match.
$h_X-Spam-Bar: contains "+++++"
reasonstring

A reason for failure.

This function only returns a reason value if it failed. 


A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1