Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th October 2011, 16:46
matiasCU matiasCU is offline
Member
 
Join Date: Apr 2007
Posts: 57
Thanks: 5
Thanked 2 Times in 2 Posts
Default Change the domain user without using the panel

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' => 'user1@domain.tld',
'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 user1@domain1.tld user1@domain2.tld, as you might do this?

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

Thanks.
Reply With Quote
Sponsored Links
  #2  
Old 17th October 2011, 10:19
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,446
Thanks: 813
Thanked 5,216 Times in 4,089 Posts
Default

Quote:
What would happen if I just change by sql query maildir field value of a user?
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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 18th October 2011, 01:28
matiasCU matiasCU is offline
Member
 
Join Date: Apr 2007
Posts: 57
Thanks: 5
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by till View Post
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.
Thank you very much Till, is what I figured why do you ask before.
Where to find documentation on the update function?
Reply With Quote
  #4  
Old 18th October 2011, 08:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,446
Thanks: 813
Thanked 5,216 Times in 4,089 Posts
Default

The remote api documentation has been released as part of the current beta. You can find it in the beta tar.gz in the file in the remot_client sub directory:

http://www.howtoforge.com/forums/showthread.php?t=54370
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
matiasCU (18th October 2011)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Statistic not working mzo Installation/Configuration 49 20th April 2011 12:19
ERROR: Connection dropped by IMAP server. [Centos 5.4, courier imap,squirrel, etc] darevil HOWTO-Related Questions 7 9th June 2010 14:49
Cannot send or receive mail farbrorc Installation/Configuration 6 24th January 2010 11:56
CGI and FormMail Cracklefish Installation/Configuration 17 13th October 2009 13:40
Need help get mail to work (can't recieve and apperently can't send) omega13a Installation/Configuration 19 20th August 2009 21:06


All times are GMT +2. The time now is 01:17.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.