Ejemplo n.º 1
0
        public override void DeleteList(string listName)
        {
            try
            {
                SM3.svcMailListAdmin svcLists = new SM3.svcMailListAdmin();
                PrepareProxy(svcLists);

                string account = GetAccountName(listName);
                string domain  = GetDomainName(listName);

                SM3.GenericResult gResult = svcLists.DeleteList(
                    AdminUsername,
                    AdminPassword,
                    domain,
                    listName
                    );

                if (!gResult.Result)
                {
                    throw new Exception(gResult.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't delete a mail list.", ex);
            }
        }
Ejemplo n.º 2
0
        public override void DeleteDomainAlias(string domainName, string aliasName)
        {
            try
            {
                SM3.svcDomainAliasAdmin service = new SM3.svcDomainAliasAdmin();
                PrepareProxy(service);

                SM3.GenericResult result = service.DeleteDomainAlias(
                    AdminUsername,
                    AdminPassword,
                    domainName,
                    aliasName
                    );

                if (!result.Result)
                {
                    throw new Exception(result.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't delete domain alias.", ex);
            }
        }
Ejemplo n.º 3
0
        public override void UpdateList(MailList list)
        {
            try
            {
                string domain  = GetDomainName(list.Name);
                string account = GetAccountName(list.Name);

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

                List <string> settings = new List <string>();
                settings.Add(string.Concat("description=", list.Description));
                settings.Add(string.Concat("disabled=", !list.Enabled));
                settings.Add(string.Concat("moderator=", list.ModeratorAddress));
                settings.Add(string.Concat("password="******"requirepassword="******"whocanpost=anyone");
                    break;

                case PostingMode.MembersCanPost:
                    settings.Add("whocanpost=subscribersonly");
                    break;

                case PostingMode.ModeratorCanPost:
                    settings.Add("whocanpost=moderator");
                    break;
                }

                settings.Add(string.Concat("prependsubject=", list.EnableSubjectPrefix));
                settings.Add(string.Concat("maxmessagesize=", list.MaxMessageSize));
                settings.Add(string.Concat("maxrecipients=", list.MaxRecipientsPerMessage));

                switch (list.ReplyToMode)
                {
                case ReplyTo.RepliesToList:
                    settings.Add("replytolist=true");
                    break;

                case ReplyTo.RepliesToSender:
                    settings.Add("replytolist=false");
                    break;
                }

                SM3.GenericResult result = lists.SetRequestedListSettings(AdminUsername, AdminPassword,
                                                                          domain,
                                                                          account,
                                                                          settings.ToArray()
                                                                          );

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

                if (list.Members.Length > 0)
                {
                    result = lists.SetSubscriberList(AdminUsername, AdminPassword,
                                                     domain,
                                                     account,
                                                     list.Members
                                                     );

                    if (!result.Result)
                    {
                        throw new Exception(result.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't update mail list.", ex);
            }
        }