public virtual MailList GetList(string listName) { try { string domain = GetDomainName(listName); string account = GetAccountName(listName); svcMailListAdmin svcLists = new svcMailListAdmin(); PrepareProxy(svcLists); SettingsRequestResult sResult = svcLists.GetRequestedListSettings( AdminUsername, AdminPassword, domain, account, smListSettings ); if (!sResult.Result) throw new Exception(sResult.Message); 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); } }
public virtual MailList[] GetLists(string domainName) { try { svcMailListAdmin svcLists = new svcMailListAdmin(); PrepareProxy(svcLists); 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) { SettingsRequestResult sResult = svcLists.GetRequestedListSettings( AdminUsername, AdminPassword, domainName, listName, smListSettings ); if (!sResult.Result) throw new Exception(sResult.Message); 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); } }