forked from libersoft/zcs-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
78 lines (55 loc) · 2.02 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
CONTENTS OF THIS FILE
---------------------
* About zcs-php
* Support
* Usage and Examples
ABOUT ZCS-PHP
---------------
zcs-php is a small set of PHP classes to query a Zimbra Collaboration Suite server via the SOAP API interface.
zcs-php classes are released under the terms of GPLv3, see LICENSE.txt
SUPPORT
-------
You can file a bug report or file a feature request at:
https://github.com/libersoft/zcs-php/issues
We can provide commercial support and payed features, drop us a line at [email protected]
USAGE AND EXAMPLES
------------------
The main class to use is ZimbraAdmin. ZimbraSOAP is used to build and send XML SOAP messages.
If something go wrong, ZimbraException is raised, containing an error message.
Here follows an excerpt of a simple ZimbraAdmin usage:
<?php
require_once "ZimbraAdmin.php";
$zimbraadminemail = '[email protected]';
$zimbraadminpassword = 'adminpassword';
$zimbraadmindomain = 'domainToAdminister';
$zimbra = new ZimbraAdmin('zimbra.domain.com', '7071');
$zimbra->auth($zimbraadminemail, $zimbraadminpassword);
// createAccount()
$newAccount = $zimbra->createAccount(array(
'name' => 'test@'.$zimbraadmindomain,
'password' => 'thepassword',
'zimbraMailQuota' => '1024',
'displayName' => 'Test',
));
// getAccount() pass
$account = $zimbra->getAccount($zimbraadmindomain, 'id', $newAccount->id);
// modifyAccount()
$account = $zimbra->modifyAccount(array(
'id' => $newAccount->id,
'zimbraMailQuota' => '2048',
));
// addAccountAlias() e removeAccountAlias()
$alias = 'test_alias@'.$zimbraadmindomain;
$success = $zimbra->addAccountAlias($newAccount->id, $alias);
$success = $zimbra->removeAccountAlias($newAccount->id, $alias);
// deleteAccount()
$deleted = $zimbra->deleteAccount($newAccount->id);
// getAccount() fail
try {
$zimbra->getAccount($zimbraadmindomain, 'name', '[email protected]');
} catch (Exception $exc) {
echo 'non-existing account';
}
// getTotalQuota()
$domainQuota = $zimbra->getTotalQuota($zimbraadmindomain);
Have Fun!