当前位置: 首页>>代码示例>>C#>>正文


C# Mail.MailGroup类代码示例

本文整理汇总了C#中WebsitePanel.Providers.Mail.MailGroup的典型用法代码示例。如果您正苦于以下问题:C# MailGroup类的具体用法?C# MailGroup怎么用?C# MailGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MailGroup类属于WebsitePanel.Providers.Mail命名空间,在下文中一共展示了MailGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddMailGroup

        public static int AddMailGroup(MailGroup item)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // check package
            int packageCheck = SecurityContext.CheckPackage(item.PackageId, DemandPackage.IsActive);
            if (packageCheck < 0) return packageCheck;

            // check quota
            QuotaValueInfo quota = PackageController.GetPackageQuota(item.PackageId, Quotas.MAIL_GROUPS);
            if (quota.QuotaExhausted)
                return BusinessErrorCodes.ERROR_MAIL_GROUPS_RESOURCE_QUOTA_LIMIT;

            // check recipients number
            if(!CheckRecipientsAllowedNumber(item.PackageId, Quotas.MAIL_MAXGROUPMEMBERS, item.Members))
                return BusinessErrorCodes.ERROR_MAIL_GROUPS_RECIPIENTS_LIMIT;

            // check if mail resource is available
            int serviceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.Mail);
            if (serviceId == 0)
                return BusinessErrorCodes.ERROR_MAIL_RESOURCE_UNAVAILABLE;

            // check package items
            if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(MailGroup)) != null)
                return BusinessErrorCodes.ERROR_MAIL_GROUPS_PACKAGE_ITEM_EXISTS;

            // place log record
            TaskManager.StartTask("MAIL_GROUP", "ADD", item.Name);

            try
            {
                // check service items
                MailServer mail = new MailServer();
                ServiceProviderProxy.Init(mail, serviceId);
                if (mail.GroupExists(item.Name))
                    return BusinessErrorCodes.ERROR_MAIL_GROUPS_SERVICE_ITEM_EXISTS;

                // add domain if not exists
                string domainName = item.Name.Substring(item.Name.IndexOf("@") + 1);
                int domainResult = AddMailDomain(item.PackageId, serviceId, domainName);
                if (domainResult < 0)
                    return domainResult;

                // create service item
                item.Enabled = true;
				item.Members = RemoveItemNameFromMembersList(
						  item.Name
						, item.Members.Clone() as string[]
					);

                // add service item
                mail.CreateGroup(item);

                // save item
                item.ServiceId = serviceId;
                int itemId = PackageController.AddPackageItem(item);

                TaskManager.ItemId = itemId;

                return itemId;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:72,代码来源:MailServerController.cs

示例2: BindItem

 public void BindItem(MailGroup item)
 {
     mailEditItems.Items = item.Members;
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:4,代码来源:SmarterMail50_EditGroup.ascx.cs

示例3: BindItem

        private void BindItem()
        {
            try
            {
                if (!IsPostBack)
                {
                    // load item if required
                    if (PanelRequest.ItemID > 0)
                    {
                        // existing item
                        try
                        {
                            item = ES.Services.MailServers.GetMailGroup(PanelRequest.ItemID);
                        }
                        catch (Exception ex)
                        {
                            ShowErrorMessage("MAIL_GET_GROUP", ex);
                            return;
                        }

                        if (item != null)
                        {
                            // save package info
                            ViewState["PackageId"] = item.PackageId;
                            emailAddress.PackageId = item.PackageId;
                        }
                        else
                            RedirectToBrowsePage();
                    }
                    else
                    {
                        // new item
                        ViewState["PackageId"] = PanelSecurity.PackageId;
                        emailAddress.PackageId = PanelSecurity.PackageId;
                    }
                }

                // load provider control
                LoadProviderControl((int)ViewState["PackageId"], "Mail", providerControl, "EditGroup.ascx");

                if (!IsPostBack)
                {
                    // bind item to controls
                    if (item != null)
                    {
                        // bind item to controls
                        emailAddress.Email = item.Name;
                        emailAddress.EditMode = true;

                        // other controls
                        IMailEditGroupControl ctrl = (IMailEditGroupControl)providerControl.Controls[0];
                        ctrl.BindItem(item);
                    }
                }
            }
            catch
            {
                ShowWarningMessage("INIT_SERVICE_ITEM_FORM");
                DisableFormControls(this, btnCancel);
                return;
            }
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:62,代码来源:MailGroupsEditGroup.ascx.cs

示例4: UpdateDomainCatchAllGroup

		private void UpdateDomainCatchAllGroup(string domainName, string mailboxName)
		{
			// check if system catch all group exists
			string groupName = SYSTEM_CATCH_ALL + "@" + domainName;
			if (GroupExists(groupName))
			{
				// delete group
				DeleteGroup(groupName);
			}

			if (!String.IsNullOrEmpty(mailboxName))
			{
				// create catch-all group
				MailGroup group = new MailGroup();
				group.Name = groupName;
				group.Enabled = true;
				group.Members = new string[] { mailboxName + "@" + domainName };

				// create
				CreateGroup(group);
			}
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:22,代码来源:SmarterMail7.cs

示例5: GetGroup

		public MailGroup GetGroup(string groupName)
		{
			try
			{
				svcAliasAdmin svcGroups = new svcAliasAdmin();
				PrepareProxy(svcGroups);

				AliasInfoResult result = svcGroups.GetAlias(AdminUsername, AdminPassword,
					GetDomainName(groupName), groupName);

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

				MailGroup group = new MailGroup();
				group.Name = groupName;
				group.Members = result.AliasInfo.Addresses;
				group.Enabled = true; // by default
				return group;
			}
			catch (Exception ex)
			{
				throw new Exception("Could not get mail domain group", ex);
			}
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:24,代码来源:SmarterMail7.cs

示例6: UpdateGroup

		public void UpdateGroup(MailGroup group)
		{
			Tree config = AMSHelper.GetUsersConfig();
			AmsMailbox amsGroup = new AmsMailbox(group.Name);

			if (amsGroup.Load(config))
			{
				amsGroup.LoadAccountConfig();
				amsGroup.Read(group);

				if (!amsGroup.Save(config))
					throw new Exception("Couldn't update specified mail group.");
			}
			else
			{
				throw new Exception("Couldn't find specified mail group.");
			}
		}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:18,代码来源:AbilityMailServer.cs

示例7: ToMailGroup

		public MailGroup ToMailGroup()
		{
			MailGroup group = new MailGroup();

			group.Name = mailboxName;
			group.Enabled = userConfig["enabled"] == "1" ? true : false;

			TreeNode redirection = deliveryConfig.ChildNodes["redirection"];

			if (redirection != null)
			{
				TreeNode redirections = redirection.ChildNodes["redirections"];

				if (redirections != null)
				{
					List<string> list = new List<string>();
					
					foreach (TreeNode node in redirections.ChildNodes)
						list.Add(node.NodeValue);

					group.Members = list.ToArray();
				}
			}

			return group;
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:26,代码来源:AmsMailbox.cs

示例8: AddMailGroupAsync

 /// <remarks/>
 public void AddMailGroupAsync(MailGroup item, object userState)
 {
     if ((this.AddMailGroupOperationCompleted == null))
     {
         this.AddMailGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddMailGroupOperationCompleted);
     }
     this.InvokeAsync("AddMailGroup", new object[] {
                 item}, this.AddMailGroupOperationCompleted, userState);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:10,代码来源:MailServersProxy.cs

示例9: UpdateMailGroup

 public int UpdateMailGroup(MailGroup item)
 {
     object[] results = this.Invoke("UpdateMailGroup", new object[] {
                 item});
     return ((int)(results[0]));
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:6,代码来源:MailServersProxy.cs

示例10: BeginAddMailGroup

 /// <remarks/>
 public System.IAsyncResult BeginAddMailGroup(MailGroup item, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("AddMailGroup", new object[] {
                 item}, callback, asyncState);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:6,代码来源:MailServersProxy.cs

示例11: UpdateMailGroup

 public int UpdateMailGroup(MailGroup item)
 {
     return MailServerController.UpdateMailGroup(item);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:esMailServers.asmx.cs

示例12: AddMailGroup

 public int AddMailGroup(MailGroup item)
 {
     return MailServerController.AddMailGroup(item);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:esMailServers.asmx.cs

示例13: UpdateGroup

 public void UpdateGroup(MailGroup group)
 {
     try
     {
         Log.WriteStart("'{0}' UpdateGroup", ProviderSettings.ProviderName);
         MailProvider.UpdateGroup(group);
         Log.WriteEnd("'{0}' UpdateGroup", ProviderSettings.ProviderName);
     }
     catch (Exception ex)
     {
         Log.WriteError(String.Format("'{0}' UpdateGroup", ProviderSettings.ProviderName), ex);
         throw;
     }
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:14,代码来源:MailServer.asmx.cs

示例14: UpdateMailGroup

        public static int UpdateMailGroup(MailGroup item)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // load original meta item
            MailGroup origItem = (MailGroup)PackageController.GetPackageItem(item.Id);
            if (origItem == null)
                return BusinessErrorCodes.ERROR_MAIL_GROUPS_PACKAGE_ITEM_NOT_FOUND;


            // check package
            int packageCheck = SecurityContext.CheckPackage(origItem.PackageId, DemandPackage.IsActive);
            if (packageCheck < 0) return packageCheck;

            // check recipients number
            if (!CheckRecipientsAllowedNumber(origItem.PackageId, Quotas.MAIL_MAXGROUPMEMBERS, item.Members))
                return BusinessErrorCodes.ERROR_MAIL_GROUPS_RECIPIENTS_LIMIT;

            // place log record
            TaskManager.StartTask("MAIL_GROUP", "UPDATE", origItem.Name);
            TaskManager.ItemId = item.Id;

            try
            {
                // get service
                MailServer mail = new MailServer();
                ServiceProviderProxy.Init(mail, origItem.ServiceId);
                item.Name = origItem.Name;
                item.Enabled = true;
				item.Members = RemoveItemNameFromMembersList(
						  item.Name
						, item.Members.Clone() as string[]
					);

                // update service item
                mail.UpdateGroup(item);
                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:49,代码来源:MailServerController.cs

示例15: UpdateMailGroupAsync

 /// <remarks/>
 public void UpdateMailGroupAsync(MailGroup item)
 {
     this.UpdateMailGroupAsync(item, null);
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:5,代码来源:MailServersProxy.cs


注:本文中的WebsitePanel.Providers.Mail.MailGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。