xref: /php-src/.github/setup_hmailserver.php (revision f62f6a6d)
1<?php
2
3/** If required change these values to make the test runs */
4const IMAP_MAIL_DOMAIN = 'example.com';
5const IMAP_MAILBOX_PASSWORD = 'p4ssw0rd';
6/** Tests require 4 valid userids */
7const IMAP_USERS = ["webmaster", "info", "admin", "foo"];
8
9$hmail = new COM("hMailServer.Application");
10$hmail->authenticate("Administrator", "");
11
12$domain = $hmail->Domains->Add();
13$domain->Name = IMAP_MAIL_DOMAIN;
14$domain->Active = true;
15$domain->Save();
16
17$accounts = $domain->accounts();
18
19foreach (IMAP_USERS as $user) {
20    $account = $accounts->Add();
21    $account->Address = "$user@" . IMAP_MAIL_DOMAIN;
22    $account->Password = IMAP_MAILBOX_PASSWORD;
23    $account->Active = true;
24    $account->Save();
25}
26