Bulk Mail Quota Update

Discussion in 'Installation/Configuration' started by warlock, Jul 6, 2011.

  1. warlock

    warlock Member

    Hi Guys,

    Is there anyway to get ISPConfig to recheck all the quota settings for all users?

    Here is what I have done, I have a client who has some 500 mailboxes, original only pop3 account so quota was set to 100MB, more and more of their users are now using IMAP and mobile devices so they are not removing mail from the server thus their mailboxes are filling up and mail is not being delivered.

    I have run a SQL UPDATE statement to update all the users for a specific domain to 500MB, but the changes are not applied, They are only applied if I go into each mailbox in ISPC and save.

    I take it once you click save ISPC runs a script to update that users quota settings ? Can we not run something that will update all users quota settings ?

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do not cahnge settings in ispconfig database directly with sql, as these changes will not get written to the config files and are ignored by the system as they are no valid config transactions. If you want to update a value from a script, use the remote API or the datalogUpdate function from the ISPConfig mysql database connection class.
  3. warlock

    warlock Member

    Cool thanks,

    Is there and API doc ?
    I see that it's not part of teh official ISPC3 Doc.

    Can you explain a little more about datalog update
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no API doc available, but there are some example files in the ispconfig 3 tar.gz file and some informations about the api in the dev forum.

    Every configuration change that shall be written to disk needs a transaction record in the sys_datalog table and the datalogUpdate function is writing these transaction records and updates also the mysql database table.
  5. warlock

    warlock Member

    I am a real noob when it comes to trying to write these things,
    does anyone have a script I can copy and use to achieve this ?
  6. osterhase

    osterhase New Member

    Have a look at this thread - maybe it's a starting point.
  7. warlock

    warlock Member

    Ok so this is what I have done so far, please forgive me I am trying here

    $username = 'xxx';
    $password = 'xxx';
    $soap_location = 'http://localhost:8080/remote/index.php';
    $soap_uri = 'http://localhost:8080/remote/';
    $client = new SoapClient(null, array('location' => $soap_location,
                                         'uri'      => $soap_uri));
    try {
    	if($session_id = $client->login($username,$password)) {
    		echo 'Login sucessful. Session-ID:'.$session_id.'<br />';
    	$primary_id = 2;
    	$domain_id = $client->mail_user_get($session_id, $primary_id);
    		if($client->logout($session_id)) {
    		echo 'Logout succesful.<br />';
    } catch (SoapFault $e) {
    	die('SOAP Blad: '.$e->getMessage());
    I am getting a successful login and logout, But I am not seeing the users details that I am querying,

    Also another question how would I pass a parameter to the php script, so lets say I want to query users_id 2, how would this be formed ?

    and I assume I comment out this line "$primary_id = 2;"
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    You dont print the details on the screen, so you dont see them.

    change line:

    $domain_id = $client->mail_user_get($session_id, $primary_id);


    $data = $client->mail_user_get($session_id, $primary_id);

    Replace the line:

    $primary_id = 2;


    $primary_id = intval($_GET['primary_id']);
  9. warlock

    warlock Member

    So If I now want to update the user, do I have to insert all the prameters returned, or only those in the mail_user.tform.php

  10. till

    till Super Moderator Staff Member ISPConfig Developer

    The easiest way is to use the parameters that the get function returned.
  11. warlock

    warlock Member


    the only limitation I find here is if you are getting the users mail details you need to know the user ID. Is there on other way of querying the user details by using the actual email address ? other than first interrogating the database for the id and passing it to the rest of the function ?
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    You can find a list of all available API functions in the file interface/lib/classes/remoting.inc.php
  13. osterhase

    osterhase New Member

    I think you have to interrogate the database and then pass it on to the function.
  14. warlock

    warlock Member

    this is what I am saying, but then it's not really a true API, as you have to then all externals access to the database queries.

    But ok, at least I have something to work with for now
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    The api is made to control ispconfig from a external application and in that case, you have the ID's because you inserted the record with the API. In your case, you dont know the ID because your records were inserted in the ispconfig interface and not with the API.

    But you can easily extend the API to add a function to search the account by email address.

Share This Page