MailSuite Pro 7 documentation

Domains

API reference on CApiDomainsManager class

In MailSuite Pro, you can manipulate domains, locate them in the database based on name or ID, modify domain properties, delete or disable specific domains.

The following code is the complete walkthrough for creating a domain and supplying custom parameters for it. The approach for invoking API manager for domains is a common point for any methods here.

include_once '/var/www/webmail/libraries/afterlogic/api.php';
if (class_exists('CApi') && CApi::IsValid()) {
    $oApiDomainsManager = CApi::Manager('domains');

    $oDomain = new CDomain('domain.com');
    $oDomain->IncomingMailServer = 'imap.domain.com';
    $oDomain->OutgoingMailServer = 'smtp.domain.com';

    if ($oApiDomainsManager->createDomain($oDomain)) {
        echo 'Domain '.$oDomain->Name.' is created successfully.';
    } else {
        echo $oApiDomainsManager->GetLastErrorMessage();
    }
} else {
    echo 'WebMail API isn\'t available';
}

WebMail Lite doesn't allow for managing domains, but you can still obtain default domain properties via API and amend those.

In either case, it's important to update domain upon making any modifications to it.

NOTE: many API methods return boolean values. If not stated otherwise, true/false value stands for success or failure respectively.

API reference on CApiDomainsManager class