-
Notifications
You must be signed in to change notification settings - Fork 50
Home
Nguyen Van Nguyen edited this page Aug 30, 2022
·
4 revisions
Examples of common tasks
$username = 'test';
$domain = 'zimbra-1.zimbra';
$password = 'testpass';
$adminApi = new AdminApi('https://192.168.0.150:7071/service/admin/soap');
$adminApi->auth('admin', 'adminpass');
$adminApi->createAccount($username . '@' . $domain, $password);
$domain = 'zimbra-1.zimbra';
$adminApi = new AdminApi('https://192.168.0.150:7071/service/admin/soap');
$adminApi->auth('admin', 'adminpass');
$adminApi->createDomain($domain);
$accountID = See down;
$domain = 'zimbra-1.zimbra';
$alias = 'test2';
$adminApi = new AdminApi( 'https://192.168.0.150:7071/service/admin/soap');
$adminApi->auth('admin', 'adminpass');
$adminApi->addAccountAlias($accountID, $alias . '@' . $domain);
$name = 'test';
$adminApi = new AdminApi('https://192.168.0.150:7071/service/admin/soap');
$adminApi->auth('admin', 'adminpass');
$account = new AccountSelector(AccountBy::NAME(), $name);
$response = $adminApi->getAccount($account);
$accountID = $response->getAccount()->getId();
$account = new AccountSelector(AccountBy::NAME(), $username . '@' . $domain);
$api = new MailApi('https://192.168.0.150/service/soap');
$api->auth($account, 'user password');
$mp = new MimePartInfo ( null, 'multipart/alternative' );
$mp->addMimePart ( new MimePartInfo ( null, 'text/plain', 'Email Body Here' ) );
$tomsg = new MsgToSend();
$tomsg->setSubject($subject)
->addEmail(new EmailAddrInfo('Target Email', AddressType::TO(), 'Name of target or email again'))
->setMimePart($mp);
$api->sendMsg($tomsg);