Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    4

    Default Changing Multiple Pop / Email Quotas

    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. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    You need to write a script to trawl through the /home/*/etc/*/quota files and modify them with a search and replace.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    4

    Default

    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. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sdhaskins View Post
    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
    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. #5
    Member
    Join Date
    Aug 2006
    Posts
    18

    Default

    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.
    Last edited by esolutions; 02-09-2009 at 04:10 PM.

  6. #6
    Member
    Join Date
    Aug 2006
    Posts
    18

    Default

    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. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by esolutions View Post
    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?
    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/cpanels...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. #8
    Member
    Join Date
    Aug 2006
    Posts
    18

    Default

    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. #9
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by esolutions View Post
    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.
    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.

Similar Threads & Tags
Similar threads

  1. changing mail quotas for all mailboxes
    By guyu in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-08-2007, 11:48 AM
  2. Multiple domains email to pop accounts
    By Agent 86 in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 10-30-2004, 06:26 AM
  3. pop, multiple copies of same message
    By rushman in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 07-23-2004, 09:44 PM
  4. Changing quotas using SSH
    By alert3ff in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-25-2003, 08:24 PM
  5. Problems changing quotas
    By hyrum in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-05-2003, 02:52 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube