當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。