The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cPanel API get email quota

Discussion in 'cPanel Developers' started by tvovk, Dec 17, 2009.

  1. tvovk

    tvovk Registered

    Joined:
    Dec 17, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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>
    
     
  3. tvovk

    tvovk Registered

    Joined:
    Dec 17, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi cPanelMatt.

    listpopswithdisk function works like a charm :)

    Thanks a lot!
     
Loading...

Share This Page