Description

This function returns the number of hosts that can send mail to an account.

Examples 




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



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Return number of hosts allowed to send email to example.com.
$get_number_hosts = $cpanel->api2(
    'SPFUI', 'count-settings', 
		array(
		'user'			=> 'username'
	 ) 
);

 



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Return number of hosts allowed to send email to example.com.
my $get_number_hosts = $cpliveapi->api2(
    'SPFUI', 'count_settings',
		{
		'user'			=> 'username'
		}
 );




cpapi2 --user=username SPFUI count_settings user=username



{
  "cpanelresult": {
    "apiversion": 2,
    "func": "count_settings",
    "data": [
      {
        "count": 6
      }
    ],
    "event": {
      "result": 1
    },
    "module": "SPFUI"
  }
}



Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

The account's username.

If you do not specify a value, this parameter defaults to the currently authenticated username.

The cPanel account username.
username

 

Returns

ReturnTypeDescriptionPossible valuesExample
countintegerThe number of allowed hosts.A positive integer.6
reasonstring

A reason for failure.

This function only returns a reason value if there was an error. 


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