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 10th April 2014, 18:44
david_hitt@lionlike.com david_hitt@lionlike.com is offline
Junior Member
 
Join Date: Feb 2011
Posts: 25
Thanks: 6
Thanked 4 Times in 4 Posts
Default Using API to pull email domains

I'm trying to use the API to pull all email domains owned by a specific client. The sys_groupid in the mail_domains table seems to be the relationship to client accounts (a sys_groupid value consistant with a specific client)... however, the sys_groupid of all clients in the client table is 1 - none are unique. The ISPConfig control panel at :8080 does relate mail domains to the appropriate owner, but how is this relationship made if not by the sys_groupid?

Thanks!
Reply With Quote
Sponsored Links
  #2  
Old 10th April 2014, 19:05
david_hitt@lionlike.com david_hitt@lionlike.com is offline
Junior Member
 
Join Date: Feb 2011
Posts: 25
Thanks: 6
Thanked 4 Times in 4 Posts
 
Default Nevermind... solution found

sys_groupid is stored in the sys_group table that relates groupid to client. So the code to link client, to group id, to mail domains is as follows:

PHP Code:
$sysname mysql_fetch_assoc(mysql_query("SELECT sysname FROM client WHERE id=".$_GET['oid'].""));
$client = new SoapClient(null, array('location' => $soap_location,'uri'=>$soap_uri,'trace' => 1,'exceptions' => 1));
try {
  
$session_id $client->login($username,$password);
  
$client_data $client->client_get($session_id, array('username' => $sysname['sysname']));
  
$client_id $client_data[0]['client_id'];
  
$groupid $client->client_get_groupid($session_id$client_id);
  
$mail_record $client->mail_domain_get($session_id, array('sys_groupid' => $groupid));
  foreach (
$mail_record as $mail) {
    echo 
$mail['domain'];
  }
  
$client->logout($session_id);
}
catch (
SoapFault $e) {
  
//echo $client->__getLastResponse();
  
die('SOAP Error: '.$e->getMessage());

Reply With Quote
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
postfix unable to receive email from external domains jono1515 Server Operation 0 10th May 2013 01:10
Sending emails with custom FROM email address merisor Installation/Configuration 4 8th February 2010 16:27
Piping email to php script (Virtual Users And Domains With Postfix, Courier & MySQL) acoghlan HOWTO-Related Questions 2 5th September 2009 12:51
multiple domains and a lot of email accounts zappulec Installation/Configuration 1 21st August 2009 13:39
problem with incoming email sumwoman Installation/Configuration 7 27th January 2007 08:09


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


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