add_mailstandardfilter()

Create standard filters for mail accounts.

All API functions Email Account

Signature

add_mailstandardfilter(array $parameters): mixed

Parameters

Pass these parameters as KasRequestParams. Every request also requires kas_login, kas_auth_type, and kas_auth_data, as shown in SOAP with PHP.

Name Description Requirement
mail_login The mail account login Required
filter Filters and actions: filter1:action1;filter2:action2 and so on
  • Filters: see the return value of get_mailstandardfilter
  • Actions for the content filter type: delete|mark|move=folder|forward=email@example.com; leave the action empty for all other filter types
  • Example: greyl;rbl_cbl:mark enables greylisting and marks emails whose sender is listed in the RBL CBL
Required

PHP example

<?php

// $sessionToken is returned by KasAuth, see SOAP with PHP.
$parameters = [
    'mail_login' => 'm0123456',
    'filter' => 'spamc_move:move=Junk;greyl;rus;rbl_cbl:delete;virus_delete',
];

try {
    $client = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
    $response = $client->KasApi(json_encode([
        'kas_login' => 'w0123456',
        'kas_auth_type' => 'session',
        'kas_auth_data' => $sessionToken,
        'kas_action' => 'add_mailstandardfilter',
        'KasRequestParams' => $parameters,
    ]));
    print_r($response);
} catch (SoapFault $fault) {
    echo 'Error: ' . $fault->faultstring;
}

Responses and error codes

  • TRUE the action was carried out
  • missing_parameter a required parameter is missing
  • action_syntax_incorrect
  • filter_doesnt_exist
  • filter_not_allowed
  • login_not_found
  • mail_login_syntax_incorrect
  • spamfilter_not_in_contract
  • unknown_filtertype