# Return cPanel account's mail domains

This function lists the account's mail domains.

Important:

  When you disable the Receive Mail role, the system disables this function.

Note:

  This function always returns the account's main domain first.

Additional Note:

  By default, temporary domains (*.cpanel.site) are excluded. Use the return_temporary_domain parameter to include them.

Endpoint: GET /Email/list_mail_domains
Version: 11.136.0.4
Security: BasicAuth

## Query parameters:

  - `add_www` (integer)
    Whether to list www. addresses.
* 1 — List www. addresses.
* 0 — Do not list www. addresses.
For example, if you specify 1, the function's output would include both example.com and www.example.com. If you specify 0, the output would include only example.com.
    Enum: 0, 1

  - `include_wildcard` (integer)
    Whether to list wildcard addresses.
* 1 — List wildcard addresses.
* 0 — Do not list wildcard addresses.
For example, if you specify 1, the function's output would include both example.com and *.example.com. If you specify 0, the output would include only example.com.
    Enum: 0, 1

  - `return_temporary_domain` (boolean)
    Whether to include temporary domains (*.cpanel.site) in the output.
By default, temporary domains are excluded.

  - `select` (string)
    The name of the domain that the function returns with the select output parameter. If you do not use this parameter, the function will not return the select parameter with any domains.
    Example: "example.com"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "list_mail_domains"

  - `module` (string)
    The name of the module called.
    Example: "Email"

  - `result` (object)

  - `result.data` (array)

  - `result.data.domain` (string)
    The domain name.
    Example: "example.com"

  - `result.data.select` (integer)
    The domain that you specified in the select input parameter. The function only returns this value if you included the select parameter when you called the function.

Note:

  Because this value only appears if you included the select input parameter, The value always defaults to 1.
    Example: 1

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.metadata.transformed` (integer)
    Post-processing may have transformed the data.
    Enum: 1

  - `result.status` (integer)
    * 1 - Success.
* 0 - Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


