cPanel API 2 Functions - Email::listpopswithdisk

Warning:

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


Description

This function lists a domain's email addresses with quota and disk usage information.

Warning:

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

  • Email::list_pops_with_disk — This function lists the cPanel account's email accounts with disk information.

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=listpopswithdisk&domain="example.com"&nearquotaonly="0"&no_validate="0"
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 example.com email addresses, and validate the
// information across multiple files.
$list_email_address_info = $cpanel->api2(
    'Email', 'listpopswithdisk',
    array(
        'domain'          => 'example.com',
        'nearquotaonly'   => '0',
        'no_validate'     => '0',
    )
);
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 example.com email addresses, and validate the
# information across multiple files.
my $list_email_addresses = $cpliveapi->api2(
    'Email', 'listpopswithdisk',
    {
        'domain'          => 'example.com',
        'nearquotaonly'   => '0',
        'no_validate'     => '0',
    }
);
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 listpopswithdisk domain=example.com nearquotaonly=0 no_validate=0 regex=user
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": "listpopswithdisk",
    "data": [
      {
        "txtdiskquota": "unlimited",
        "diskquota": "unlimited",
        "diskusedpercent": 0,
        "mtime": 1412881950,
        "diskused": 0,
        "humandiskquota": "None",
        "_diskused": "483",
        "login": "user@example.com",
        "email": "user@example.com",
        "domain": "example.com",
        "user": "user",
        "suspended_incoming":0,
        "suspended_login":0,
        "suspended_incoming":0,
        "suspended_login":0,
        "humandiskused": "483\u00a0bytes",
        "diskusedpercent20": 0,
        "_diskquota": 0
      },
      {
        "txtdiskquota": "unlimited",
        "diskquota": "unlimited",
        "diskusedpercent": 0,
        "mtime": 1412881950,
        "diskused": 0,
        "humandiskquota": "None",
        "_diskused": "0",
        "login": "account@example.com",
        "email": "account@example.com",
        "domain": "example.com",
        "user": "account",
        "suspended_incoming":0,
        "suspended_login":0,
        "suspended_incoming":0,
        "suspended_login":0,
        "humandiskused": "None",
        "diskusedpercent20": 0,
        "_diskquota": 0
      },
      {
        "txtdiskquota": 250,
        "diskquota": 250,
        "diskusedpercent": 0,
        "mtime": 1412881950,
        "diskused": 0,
        "humandiskquota": "250\u00a0MB",
        "_diskused": 0,
        "login": "mail@addondomain.com",
        "email": "mail@addondomain.com",
        "domain": "addondomain.com",
        "user": "mail",
        "suspended_incoming":0,
        "suspended_login":0,
        "suspended_incoming":0,
        "suspended_login":0,
        "humandiskused": "None",
        "diskusedpercent20": 0,
        "_diskquota": "262144000"
      }
    ],
    "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 email address information.

If you do not specify a value, the function lists information for all of the account's domains.

A valid domain on the account. example.com
nearquotaonly Boolean

Whether to limit results to accounts that use 95% or more of their allotted disk space.

If you do not specify a value, the function lists information for all email addresses.

  • 1 — Limit results.
  • 0 — Do not limit results.
0
no_validate Boolean

Whether to only read data from the .cpanel/email_accounts.yaml file.

If you specify 0 or do not specify a value, the function also checks the passwd file and quota files to ensure that the account information is identical.

  • 1 — Only check the .cpanel/email_accounts.yaml file.
  • 0 — Check all of the files.
0
regex string

A Perl Compatible Regular Expression (PCRE) that filters the results. The system matches the PCRE to both the email address's username and domain.

A valid PCRE.

user

Returns

Return Type Description Possible values Example
txtdiskquota

integer

or

string

The disk quota.
  • A positive integer that represents the disk quota in megabytes (MB).
  • unlimited — The email account's disk quota is unlimited.
555
diskquota

integer

or

string

The disk quota.

This return's value is localized for the account's locale setting.

  • A positive integer that represents the disk quota in megabytes (MB).
  • unlimited — The email account's disk quota is unlimited.
555
diskusedpercent integer The percentage of disk space that the email account uses.
  • A positive integer.
  • 0 — The account's disk quota is unlimited.
72
mtime integer The file modification time, in Unix time. A time, in Unix time format. 1412881950
diskused integer The disk space that the email account uses, in megabytes (MB).
  • A positive floating-point value.
  • 0 — The account has an unlimited disk quota.
399.6
humandiskquota string The disk quota, in human-readable format.
  • The disk quota and the unit of measure.
  • None — The account's disk quota is unlimited.
555 MB
_diskused integer The disk space that the email account uses, in bytes. A positive integer. 399600000
login string

The email address, or the main account username.

  • A valid email address.
  • The username for the main account.

user@example.com

email string

The email address, or the string Main Account .

  • A valid email address.
  • Main Account
user@example.com
domain string The email account's domain.

The email account's domain.

For example, example.com if the email address is user@example.com.

example.com
user string The email account username.

The email account's username.

For example, user if the email address is user@example.com.

user
suspended_incoming Boolean

Whether the email account's incoming email is suspended.

  • 1 — Incoming email is suspended.
  • 0 — Incoming email is not suspended.
0
suspended_login Boolean

Whether the user's ability to log in to, send mail from, and read their email account is suspended.

  • 1 — Logins are suspended.
  • 0 — Logins are not suspended.
0
humandiskused string The disk space that the email account uses, in human-readable format. The disk space that the email account uses, a non-breaking space (\u00a0), and the unit of measure. 399.6\u00a0bytes
diskusedpercent20 integer The percentage of disk space that the email account uses.
  • A positive integer.
  • 0 — The account's disk quota is unlimited.
72
_diskquota integer The disk quota, in bytes.
  • A positive integer.
  • 0 — The account's disk quota is unlimited.
555000000
reason string

A reason for failure.

Note:

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


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