Change the domain user without using the panel

Discussion in 'Developers' Forum' started by matiasCU, Oct 15, 2011.

  1. matiasCU

    matiasCU Member

    Hi People,
    Massive change is possible with remote api-mail accounts? For example, change a user's maildir. Just as when you create a mailbox with the following function:

    $params = array( 'server_id' => 1,
    'name' => 'name of user1',
    'email' => '[email protected]',
    'password' => 'somepass',
    'quota' => '0',
    'maildir' => '/var/vmail/domain.tld/user1'
    'homedir' => '/var/vmail','uid' => '5000',
    'gid' => '5000',
    'postfix' => 'y',
    'disableimap' => '0',
    'disablepop3' => '0');
    $client_id = 0;
    $domain_id = $client->mail_user_add($session_id,$client_id, $params);

    What would happen if I just change by sql query maildir field value of a user? It would make the mailbox pass another location in /var/vmail/? For example, I need to change a user [email protected] [email protected], as you might do this?

    user1 maildir is /var/vmail/domain1.tld/user1 and need to be /var/vmail/domain2.tld/user1

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    It would break your system. Always use the remote API to do changes in the ispconfig db as all changes that you do directly in sql will not get processed by the server scripts.

    But the function you posted above is wrong for that purpose as it will add a new user instaed of modifying a existing account. To modify existing accounts, use the update function.

    For example in your case above, the direct change in the sql db will result in two mailboxes, a complete old one which is inaccessible and a partly created new one which misses functions like quota etc.
  3. matiasCU

    matiasCU Member

    Thank you very much Till, is what I figured why do you ask before.
    Where to find documentation on the update function?
  4. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page