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.

Changing Multiple Pop / Email Quotas

Discussion in 'E-mail Discussions' started by sdhaskins, Jun 11, 2007.

  1. sdhaskins

    sdhaskins Registered

    Joined:
    Jul 17, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I have scourned through this forum, search engines without avail.

    We are an ISP that both hosts domains for customers, and sells Internet access with included pop accounts.

    Our server has over 2000 email accounts for the Main domain, originally we were allowing for 10MB of storage space, but now want to increase that to 25MB as to be more competitive.

    As you know, manually doing this is horrible.

    Is there a way to mass change those quotas?

    --SDH
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    You need to write a script to trawl through the /home/*/etc/*/quota files and modify them with a search and replace.
     
  3. sdhaskins

    sdhaskins Registered

    Joined:
    Jul 17, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Wanted to bump this thread and see if anyone has successfully written any scripts to do this.

    I have over 3200 Email Accounts now on one of our domains and really would like to standardize all of the quotas.

    --SDH
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    As the majority of the X3 theme is built upon API2, nearly anything that can be done in the X3 theme can be done programmatically.

    You can find the source for the X3 theme in /usr/local/cpanel/base/frontend/x3. Simply find the file you execute in the cPanel interface to change quotas for an email account, find the appropriate file in that path (it's fairly straightforward) and then look at the source code to see what APIs are being called.

    You can then call those APIs via the XML-API which itself can be called from any language that supports HTTP/S and XML, such as PHP. You can find documentation for how to use the XML-API as well as other APIs via the XML-API at:

    http://www.cPanel.net/plugins/xmlapi
     
  5. esolutions

    esolutions Member

    Joined:
    Aug 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    I've found the file that changes the quota for the email accounts. Its at
    Code:
    /usr/local/cpanel/base/frontend/x3/mail/doeditquota.html
    The line that changes the quota is:
    Code:
    <cpanel Email="editquota($FORM{'email'},$FORM{'domain'},$FORM{'quota'})">
    I'd like to use this to change all the quotas for an 800 email account, but I can't figure out how to use the API to accomplish this, I created a PHP file in
    Code:
    /usr/local/cpanel/base/frontend/x3/mail/
    with the following code:
    Code:
    <?php
    include("/usr/local/cpanel/php/cpanel.php");
    
    $cpanel = &new CPANEL();
    
    //$array = $cpanel->api2('Email', 'listpopswithdisk' , array("domain"=> "domain.tld"));
    
    $array = $cpanel->api2('Email', 'editquota' , array("domain"=> "domain.tld","email"=>"user","quota"=>"100"));
    print_r($array);
    
    $cpanel->end();
    ?>
    
    but when I run that from my browser (after logging into cPanel), I get the following output and the quota does NOT change:
    Code:
    Array
    (
        [cpanelresult] => Array
            (
                [apiversion] => 2
                [func] => editquota
                [module] => Email
            )
    
    )
    
    I think this might be because the editquota function is not listed here: http://www.cpanel.net/plugins/api2/index.html

    So does anyone know how to run the editquota function for emails programmatically? Thanks in advance.
     
    #5 esolutions, Feb 9, 2009
    Last edited: Feb 9, 2009
  6. esolutions

    esolutions Member

    Joined:
    Aug 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Update:

    From reading some more on the Internet, its possible that the function I need is part of cPanel API1. The problem is the cPanel site has not documentation at all about API1. Does anyone know where I can find documentation for the API1 functions?
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The documentation for API1 and API2 is still a work in progress. However, the function you mentioned is an API1 function and here's how I know:

    API2 functions are typically Something::SomethingElse

    API1 functions are typically Something=SomethingElse

    Calling an API1 function through API2 will not work, as you have observed. However, there is an example of calling an API1 function via LivePHP at:

    http://httpupdate.cpanel.net/cpanelsync/EDGE/cpanel/php/README.TXT

    You can use:

    Code:
    $cpanel->api1('Email','editquota',array('email','domain','quota'));
    Rule of thumb is that if it is a function in the x3 theme, chances are that it is available in our APIs as x3 is largely built upon API1 and API2.
     
  8. esolutions

    esolutions Member

    Joined:
    Aug 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Thank you!

    That's all I needed, I figured out from some of your other posts that it was an API1 function but I didn't notice that the array for the arguments was different for API1 calls so I was trying to do
    Code:
    $array = $cpanel->api1('Email', 'editquota' , array("domain"=> "domain.tld","email"=>"user","quota"=>"100"));
    
    instead of
    Code:
    $array = $cpanel->api1('Email', 'editquota' , array("user","domain.tld","100"));
    It looks like I was also putting the arguments in the wrong order.
    Thanks again.
     
  9. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Yeah, a major difference between API1 and API2 is that in API1, the parameters are not named and the order matters. In API2, since the parameters are named, the ordering isn't as pertinent.
     
Loading...

Share This Page