Child pages
  • WHM API 1 Function - block_incoming_email_from_country
Skip to end of metadata
Go to start of metadata

Description

This function blocks email from specific countries.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/block_incoming_email_from_country?api.version=1&country_code=AD
 Command Line
whmapi1 block_incoming_email_from_country country_code=AD


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "updated": 1
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "block_incoming_email_from_country"
  }
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
country_codestring

Required

The country to block.

A valid ISO 3166-1 alpha-2 code two-letter country code.

Warning:

Do not block the ZZ country code if the server uses a NAT configuration.

Note:

  • The function returns 0 for the updated return if the server already blocks that country.
  • To search all available country codes, read the ISO's Full list of Country Codes documentation.
  • To block multiple countries, duplicate or increment the parameter name. For example, to block three countries, you could:

    • Use the country_code parameter multiple times.

    • Use the country_code, country_code-1, and country_code-2 parameters.

AD

Returns

ReturnTypeDescriptionPossible valuesExample
updatedBoolean

Whether the function blocked one or more countries.

  • 1 — Success.
  • 0 — Failure.

1