Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    4

    Default cPanel API get email quota

    Hi everyone!

    I'd like to know what's the name of the function (if ther's any) to get the quota for an email account.

    I managed to list (listpops) the e-mail accounts on a specific domain, but the array I get as a result contains email and login only (which are both the same in my case).

    I searched the forum for some time but found nothing. Correct me if I'm wrong.

    WHM 11.24.2
    cPanel 11.24.5-S38506

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    try the call Email::listpopswithdisk

    Code:
    <apicall>
    	<module>Email</module>
    	<function>listpopswithdisk</function>
    	<version>2</version>
    	<description>List email accounts associated with a particular domain.  This function will also list quota and disk usage information.</description>
    
    	<param>
    		<name>domain</name>
    		<value>string (optional)</value>
    		<description>The domain whose email accounts you wish to view.</description>
    	</param>
    
    	<param>
    		<name>nearquotaonly</name>
    		<value>boolean (optional)</value>
    		<description>Passing '1' to this parameter allows you to only view accounts that have used 95% or more of their allotted disk space.</description>
    	</param>
    	
    	<param>
    		<name>no_validate</name>
    		<value>boolean (optional)</value>
    		<description>Passing '1' to this parameter will cause the function to only read data from your '.cpanel/email_accounts.yaml' file.  This parameter is 'off' by default, causing the function to check the passwd file, quota files, etc.  Theoretically, each of these files should contain identical values.</description>
    	</param>
    
    	<param>
    		<name>regex</name>
    		<value>Regular Expressions (optional)</value>
    		<description>Regular expressions allow you to filter results based on a set of criteria.</description>
    	</param>
    
    	<output>Returns a list of hashes, 1 per email account.  Note:  Certain output values can potentially come out in a format other than the one indicated.  This is a fallback in case a function fails.  In the event that a function fails, check the cPanel error_log for details.
    
    $VAR1 = [
              {
                'txtdiskquota' => An integer value that contains the disk quota in megabytes.,
                'diskquota' => An integer or string value that contains the disk quota in megabytes.  This value is affected by the account's locale (language).  (e.g.  '250' or 'unlimited'),
                'diskusedpercent' => An integer value that contains the percentage of disk space used.,
                'diskused' => A floating point value that contains the disk space used in megabytes.  (e.g. 108.83),
                'humandiskquota' => A string value that contains the disk quota with the descriptor.  (e.g. '250 MB'),
                '_diskused' => An integer value that contains the disk space used in bytes.,
                'login' => A string value that contains the login name of the account.  This value contains the domain.  (e.g. user@example.com),
                'email' => A string value that contains the email address of the account.,
                'domain' => A string value that contains the domain name you have queried.  (e.g. example.com),
                'user' => A string value that contains the username that corresponds to the domain.,
                'humandiskused' => A string value that contains the amount of disk space used and the signifier.  (e.g. '109.39 MB' or 'none'),
                'diskusedpercent20' => An integer value that contains the percentage of disk space used.,
                '_diskquota' => An integer value that contains the disk quota in bytes.
              },
    	</output>
    </apicall>
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    4

    Default

    Hi cPanelMatt.

    listpopswithdisk function works like a charm

    Thanks a lot!

Similar Threads & Tags
Similar threads

  1. Using cPanel API for changing email password
    By saliljain25 in forum cPanel Developers
    Replies: 3
    Last Post: 02-24-2011, 09:50 AM
  2. Replies: 6
    Last Post: 02-15-2011, 10:57 AM
  3. cPanel API - PHP Class vs. Email Responder
    By Jack.Straw in forum cPanel Developers
    Replies: 2
    Last Post: 09-08-2010, 01:15 PM
  4. api question for email quota
    By promak in forum cPanel Developers
    Replies: 4
    Last Post: 11-05-2008, 08:14 AM
  5. cPanel email API Search?
    By vidir in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-26-2008, 09:46 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube