<?php echo '<pre>'; include '../Source/DA/Emails.php'; // Optional, you can pass these as arguments of the class constructor too $socket = new HTTPSocket(); $socket->connect('topdomain.nl', 2222); $socket->set_login('user', 'pass'); DA_Api::$DEFAULT_SOCKET = $socket; DA_Api::$DEFAULT_DOMAIN = 'domain.nl'; // new DA_Emails instance $emails = new DA_Emails(); // displays the users print_r($emails->fetch()); // creates a new user, should return true var_dump($emails->create('testing', 'test_pass', 20)); // fetches the data, quota and usage, of one user print_r($emails->fetchUserQuota('testing')); // sets a new password and quota var_dump($emails->modify('testing', 'new_test_pass', 30)); // fetches all data, including quotas and usage print_r($emails->fetchQuotas()); // deletes the test user, should be true var_dump($emails->delete('testing'));
<?php echo '<pre>'; include_once '../Source/HTTPSocket.php'; $sock = new HTTPSocket(); $sock->connect('domain.nl', 2222); $sock->set_login('DirectAdminUsername', 'DirectAdminPassword'); include_once '../Source/DA/Emails.php'; $emails = new DA_Emails($sock, 'domain.com'); try { // Fetch a list of users (before the @ sign) or pop emails print_r($emails->fetch()); // Fetch a list of users and their usage and quota print_r($emails->fetchQuotas()); // Fetch the quota and usage for a single user print_r($emails->fetchUserQuota('username')); // Create a user email => username - password - quota (MiB) var_dump($emails->create('username', 'pass', 50)); // Modify a user email => username - password - quota (MiB) var_dump($emails->modify('username')); // Delete a user email var_dump($emails->delete('username')); } catch (DA_Exception $e) { echo $e->getMessage(); } include_once '../Source/DA/Forwarders.php'; $fwd = new DA_Forwarders($sock); $fwd->setDomain('refox.nl'); try { // Fetch a list of users and their forward emails print_r($fwd->fetch());