cPanel API 2 Functions - Email::listlists

Warning:

The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.


Description

This function lists the cPanel account or domain's mailing lists.

Warning:

We strongly recommend that you use the following UAPI function instead of this function:

  • Email::list_lists — This function lists the account's Mailman mailing lists.

Important:

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


Examples


WHM API (JSON)

https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=listlists&domain=example.com&regex=list
Note:

For more information, read our Calls from the WHM API documentation.


LiveAPI PHP Class

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// List all of example.com's mailing lists.
$list_mailing_lists = $cpanel->api2(
    'Email', 'listlists',
    array(
        'domain'          => 'example.com',
    )
);

// List all of the cPanel account's mailing lists.
$list_mailing_lists = $cpanel->api2(
    'Email', 'listlists',
);
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.

# List all of example.com's mailing lists.
my $list_mailing_lists = $cpliveapi->api2(
    'Email', 'listlists',
    {
        'domain'          => 'example.com',
    }
);

# List all of the cPanel account's mailing lists.
my $list_mailing_lists = $cpliveapi->api2(
    'Email', 'listlists',
);
Note:

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


cPanel Tag System (deprecated)

Warnings:
  • cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
  • cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
  • For more information, read our Deprecated cPanel Tag Usage documentation.

Command Line

cpapi2 --user=username Email listlists domain=example.com regex=list
Notes:
  • You must URI-encode values.
  • username represents your account-level username.
  • You must run the --user=username command.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi2 command:
    /usr/local/cpanel/bin/cpapi2

Output (JSON)

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "listlists",
    "data": [
      {
        "diskused": "20379",
        "listid": "list_example.com",
        "subscribe_policy": 1,
        "archive_private": 0,
        "accesstype": "public",
        "desthost": "172.16.254.1",
        "advertised": 1,
        "humandiskused": "19.9\u00a0KB",
        "listadmin": "admin@example.com",
        "list": "list@example.com"
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Email"
  }
}
Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.


Parameters

Parameter Type Description Possible values Example
domain string

The domain to search for mailing lists.

If you do not use this parameter, the function lists all of the cPanel account's mailing lists.

A valid domain on the server.

example.com
regex string

A Perl Compatible Regular Expression (PCRE) that filters the results.

If you do not use this parameter, the function lists all of the mailing lists for all of the cPanel account's domains.

A valid PCRE.

list

Returns

Return Type Description Possible values Example
diskused integer The disk space that the mailing list currently uses, in megabytes (MB). A positive integer. 20379
listid string The mailing list's name and domain. The mailing list name, an underscore (_), and the domain. list_example.com
subscribe_policy integer The level of control that the mailing list administrator maintains over new subscribers.
  • 1 — Anyone can subscribe. The system sends a confirmation email.
  • 2 — The administrator must approve subscriptions. The system does not send a confirmation email.
  • 3 — The administrator must approve subscriptions. The system sends a confirmation email.
1
archive_private Boolean Whether the mailing list archive is private.
  • 1 — The mailing list archive is private.
  • 0 — The mailing list archive is public.
0
accesstype string The user's level of access to the mailing list.
  • private— The list contains all of the following settings:
    • The list contains private archives.
    • The administrator must approve subscriptions.
    • The Mailman directory page does not display the list.
  • public — The list contains any of the following settings:
    • The list contains public archives.
    • Anyone can subscribe.
    • The Mailman directory page displays the list.
public
desthost string The IP address of the domain that you specified in the domain input parameter. An IPv4 address. 172.16.254.1
advertised Boolean Whether the Mailman directory page displays the list.
  • 1 — The Mailman directory page displays the list.
  • 0 — The Mailman directory page does not display the list.
1
humandiskused string The disk space that the mailing list uses, in human-readable format. The disk space that the mailing list uses, a non-breaking space (\u00a0), and the unit of measure. 19.9\u00a0KB
listadmin string The mailing list's administrators' email addresses. A comma-separated list of email addresses. admin@example.com,admin2@example.com
list string The mailing list name and domain. The mailing list name, the @ character, and the domain. list@example.com
reason string

A reason for failure.

Note:

This function only returns a reason value if it failed.


A string that describes the error.

This is an error message.
result Boolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1