This repository was archived by the owner on Oct 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexamples.txt
87 lines (67 loc) · 1.82 KB
/
examples.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
79
80
81
82
83
84
85
86
87
CLI.php Examples
================
First off ...
Make sure you include the class in your script!
<?php
include("/path/to/CLI.php");
?>
//////////////////////////////////////////////////////
//
// Example 1:
// Create an account
//
//////////////////////////////////////////////////////
<?php
$host = "company.com";
$port = 106;
$login = "postmaster@company.com";
$password = "pass";
$cli = new CLI;
// Debug mode is off for now - set to "1" to turn on
// $cli->setDebug(1);
$cli->Login($host,$port,$login,$password);
$UserData = array(
"accountName" => "john",
"settings" => array(
"AccessModes" => "Mail POP IMAP PWD WebMail WebSite",
"RealName" => "John X. Smith",
"MaxAccountSize" => "100k"
)
);
$cli->CreateAccount($UserData);
$cli->Logout();
?>
//////////////////////////////////////////////////////
//
// Example 2:
// Create a domain with default settings
//
//////////////////////////////////////////////////////
<?php
// Specify a new domain to set up
$newdomain = "billybob.com";
// Connect to your CG server
$host = "company.com";
$port = 106;
$login = "postmaster@company.com";
$password = "pass";
$cli = new CLI;
$cli->setDebug(1);
$cli->Login($host,$port,$login,$password);
// Create domain
$settings = array(
// no IMAP, no WebSite
"DomainAccessModes" => array("Mail","POP","PWD","ACAP","WebMail","Relay","Mobile")
);
$cli->CreateDomain($newdomain,$settings);
// Add domain alias
$aliases = array("mail.$newdomain");
$cli->SetDomainAliases($newdomain,$aliases);
// Create Forwarders to your primary postmaster account
$cli->CreateForwarder("abuse@$newdomain","postmaster@company.com");
$cli->CreateForwarder("postmaster@$newdomain","postmaster@company.com");
// Create Basic Skin
$cli->CreateDomainSkin("$newdomain","");
// Done!
$cli->Logout();
?>