コード例 #1
0
        public override MailList[] GetLists(string domainName)
        {
            try
            {
                SM3.svcMailListAdmin svcLists = new SM3.svcMailListAdmin();
                PrepareProxy(svcLists);

                SM3.MailingListResult mResult = svcLists.GetMailingListsByDomain(
                    AdminUsername,
                    AdminPassword,
                    domainName
                    );

                if (!mResult.Result)
                {
                    throw new Exception(mResult.Message);
                }

                List <MailList> mailLists = new List <MailList>();
                foreach (string listName in mResult.listNames)
                {
                    SM3.SettingsRequestResult sResult = svcLists.GetRequestedListSettings(
                        AdminUsername,
                        AdminPassword,
                        domainName,
                        listName,
                        sm3Settings
                        );

                    if (!sResult.Result)
                    {
                        throw new Exception(sResult.Message);
                    }

                    SM3.SubscriberListResult rResult = svcLists.GetSubscriberList(
                        AdminUsername,
                        AdminPassword,
                        domainName,
                        listName
                        );

                    if (!rResult.Result)
                    {
                        throw new Exception(rResult.Message);
                    }

                    MailList list = new MailList();
                    list.Name = string.Concat(listName, "@", domainName);
                    SetMailListSettings(list, sResult.settingValues);
                    SetMailListMembers(list, rResult.Subscribers);
                    mailLists.Add(list);
                }

                return(mailLists.ToArray());
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't obtain domain mail lists.", ex);
            }
        }
コード例 #2
0
        public override MailList GetList(string listName)
        {
            try
            {
                string domain  = GetDomainName(listName);
                string account = GetAccountName(listName);

                SM3.svcMailListAdmin svcLists = new SM3.svcMailListAdmin();
                PrepareProxy(svcLists);

                SM3.SettingsRequestResult sResult = svcLists.GetRequestedListSettings(
                    AdminUsername,
                    AdminPassword,
                    domain,
                    account,
                    sm3Settings
                    );

                if (!sResult.Result)
                {
                    throw new Exception(sResult.Message);
                }

                SM3.SubscriberListResult mResult = svcLists.GetSubscriberList(
                    AdminUsername,
                    AdminPassword,
                    domain,
                    account
                    );

                if (!mResult.Result)
                {
                    throw new Exception(mResult.Message);
                }

                MailList list = new MailList();
                list.Name = listName;

                SetMailListSettings(list, sResult.settingValues);
                SetMailListMembers(list, mResult.Subscribers);

                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't obtain mail list.", ex);
            }
        }