View Single Post
  #2 (permalink)  
Old 02-29-2008, 04:24 PM
Ron Gage Ron Gage is offline
Project Contributor
 
Posts: 10
Default Example of how easy this class is to use

Just so you can see how easy this class is to implement, here is the example code to retrieve a list of email address for a domain from a zimbra server...

Code:
<?php
include ("zimbraAdmin.php");
include ("zimbraAdmin.config");
$zim = new zimbraAdmin($zimbraserver);

if ($zim->zimbra_login($zimbraadminemail,$zimbraadminpassword) == false)
  {
  echo ("Could not authenticate to the Zimbra server\n");
  exit(-1);
  }
if ($argc != 2)
  {
  echo ($argv[0] . " [domain name to retrieve]\n\n");
  echo ("Get the current email addresses for the domain you request.\n\n");
  exit(-1);
  }


$addr = $argv[1];
echo ("Email addresses: $addr\n");
$ret = $zim->zimbra_get_all_accounts($addr);
if (isset ($ret['ACCOUNT']['NAME']))
  {
  $name = $ret['ACCOUNT']['NAME'];
  $status = "active";
  if ($zim->zimbra_is_account_locked($name) == true)
    $status = "locked";
  printf ("%s - %s\n",$name, $status);
  }
else
  foreach ($ret['ACCOUNT'] as $a)
    {
    $name = $a['NAME'];
    $status = "active";
    if ($zim->zimbra_is_account_locked($name) == true)
      $status = "locked";
    printf ("%s - %s\n",$name, $status);
    }

?>
Reply With Quote