public MailAccount[] GetAccounts(string domainName) { Tree config = AMSHelper.GetUsersConfig(); List <MailAccount> accounts = new List <MailAccount>(); AmsMailbox[] mbList = AmsMailbox.GetMailboxes(config, domainName); foreach (AmsMailbox mb in mbList) { accounts.Add(mb.ToMailAccount()); } return(accounts.ToArray()); }