Child pages
  • cPanel API 1 Functions - Email::tracefilter
Skip to end of metadata
Go to start of metadata

Description

This function tests an account's email filters.

Notes:

  • This function only tests filters for a cPanel account's main domain that search the body of email messages.
  • In cPanel & WHM version 11.50 and later, if the domain or account does not contain a filter file, this function will fail.

Warning:

cPanel API 1 is deprecated. Do not use this function. Instead, we strongly recommend that you use the following newer functions:

Important:

In cPanel & WHM version 76 and later, when you disable the MailReceive role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$test_email_filter = $cpanel->api1('Email', 'tracefilter', array('user@example.com', 'This email is filtered.') ); // Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $test_email_filter = $cpliveapi->api1('Email', 'tracefilter', ['user@example.com', 'This email is filtered.'] ); # Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 

 cPanel Tag System (deprecated)


Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We provide this example to help developers move from the old cPanel tag system to our LiveAPI system. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

<cpanel Module="Email::tracefilter( $FORM('account','msg') )">
 Command Line
cpapi1 --user=username Email tracefilter 'This email is filtered.' user@example.com


Notes:

  • You must URI-encode these values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 1 documentation or run the cpapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi1 command:

    /usr/local/cpanel/bin/cpapi1

 Output (plaintext)

This function returns a message of success or failure, the name of the file that the function examined, and the destination of the filter.

Parameters

ParameterTypeDescriptionPossible valuesExample
account

string

The name of the email account.

Note:

This function tests old-style cPanel filters in the account's /home/filters directory only

If you do not specify a value, the function tests the main domain's filters in the /etc/vfilters/ directory.

An email account on the server.user@example.com
msgstring

Required

The string to test filters against.

Any string.

This email is filtered.

Returns

This function returns a message of success or failure, the name of the file that the function examined, and the destination of the filter.