• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Mail.MailAlias类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: UpdateMailForwarding

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

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

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

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

            try
            {
                // update forwarding
                MailServer mail = new MailServer();
                ServiceProviderProxy.Init(mail, origItem.ServiceId);
                MailAlias alias = new MailAlias();
                alias.Name = origItem.Name;
                alias.ForwardTo = item.ForwardTo;

                //For MailEnable alias updating
                alias.DeleteOnForward = true;
                alias.ForwardingAddresses = new string[1];
                alias.ForwardingAddresses[0] = item.ForwardTo;
               
                //
                
                // update service item
                mail.UpdateMailAlias(alias);
                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:48,代码来源:MailServerController.cs


示例2: AddMailForwarding

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


示例3: AddMailForwarding

        public static int AddMailForwarding(MailAlias 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_FORWARDINGS);
            if (quota.QuotaExhausted)
                return BusinessErrorCodes.ERROR_MAIL_FORWARDINGS_RESOURCE_QUOTA_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(MailAlias)) != null)
                return BusinessErrorCodes.ERROR_MAIL_FORWARDINGS_PACKAGE_ITEM_EXISTS;

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

            try
            {
                // check service items
                MailServer mail = new MailServer();
                ServiceProviderProxy.Init(mail, serviceId);
                if (mail.MailAliasExists(item.Name))
                    return BusinessErrorCodes.ERROR_MAIL_FORWARDINGS_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
                MailAlias alias = new MailAlias();
                alias.Name = item.Name;
                alias.ForwardTo = item.ForwardTo;
                //for MailEnable alias creation
                alias.DeleteOnForward = true;
                alias.ForwardingAddresses = new string[1];
                alias.ForwardingAddresses[0] = item.ForwardTo;
                alias.Password = Guid.NewGuid().ToString("N").Substring(0, 12);
                alias.Enabled = true;
				
                // add service item
                mail.CreateMailAlias(alias);

                // 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


示例4: SaveItem

        private void SaveItem()
        {
            if (!Page.IsValid)
                return;

            // get form data
            MailAlias item = new MailAlias();
            item.Id = PanelRequest.ItemID;
            item.PackageId = PanelSecurity.PackageId;
            item.Name = emailAddress.Email;
            item.ForwardTo = txtForwardTo.Text.Trim();

            //checking if forwarding name is different from existing e-mail accounts
            MailAccount[] accounts = ES.Services.MailServers.GetMailAccounts(PanelSecurity.PackageId, true);
            foreach (MailAccount account in accounts)
            {
                if (item.Name == account.Name)
                {
                    ShowWarningMessage("MAIL_FORW_NAME");
                    return;
                }
            }

            //checking if forwarding name is different from existing e-mail lists
            MailList[] lists = ES.Services.MailServers.GetMailLists(PanelSecurity.PackageId, true);
            foreach (MailList list in lists)
            {
                if (item.Name == list.Name)
                {
                    ShowWarningMessage("MAIL_FORW_NAME");
                    return;
                }
            }

            //checking if forwarding name is different from existing e-mail groups
            MailGroup[] mailgroups = ES.Services.MailServers.GetMailGroups(PanelSecurity.PackageId, true);
            foreach (MailGroup group in mailgroups)
            {
                if (item.Name == group.Name)
                {
                    ShowWarningMessage("MAIL_FORW_NAME");
                    return;
                }
            }

            // get other props
            IMailEditForwardingControl ctrl = (IMailEditForwardingControl)providerControl.Controls[0];
            ctrl.SaveItem(item);

            if (PanelRequest.ItemID == 0)
            {
                // new item
                try
                {
                    int result = ES.Services.MailServers.AddMailForwarding(item);
                    if (result < 0)
                    {
                        ShowResultMessage(result);
                        return;
                    }

                }
                catch (Exception ex)
                {
                    ShowErrorMessage("MAIL_ADD_FORWARDING", ex);
                    return;
                }
            }
            else
            {
                // existing item
                try
                {
                    int result = ES.Services.MailServers.UpdateMailForwarding(item);
                    if (result < 0)
                    {
                        ShowResultMessage(result);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    ShowErrorMessage("MAIL_UPDATE_FORWARDING", ex);
                    return;
                }
            }

            // return
            RedirectSpaceHomePage();
        }
开发者ID:jordan49,项目名称:websitepanel,代码行数:90,代码来源:MailForwardingsEditForwarding.ascx.cs


示例5: BindItem

        public void BindItem(MailAlias item)
        {

        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:IceWarp_EditForwarding.ascx.cs


示例6: GetMailAliases

		public MailAlias[] GetMailAliases(string domainName)
		{
			try
			{

				svcAliasAdmin aliases = new svcAliasAdmin();
				PrepareProxy(aliases);

				AliasInfoListResult result = aliases.GetAliases(AdminUsername, AdminPassword, domainName);

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

				List<MailAlias> aliasesList = new List<MailAlias>();


				foreach (AliasInfo alias in result.AliasInfos)
				{
					if (alias.Addresses.Length == 1)
					{
						MailAlias mailAlias = new MailAlias();
						mailAlias.Name = alias.Name + "@" + domainName;
						mailAlias.ForwardTo = alias.Addresses[0];
						aliasesList.Add(mailAlias);
					}
				}
				return aliasesList.ToArray();
			}
			catch (Exception ex)
			{
				throw new Exception("Could not get the list of mail aliases", ex);
			}


		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:35,代码来源:SmarterMail7.cs


示例7: CreateMailAlias

		public void CreateMailAlias(MailAlias mailAlias)
		{
			try
			{
				svcAliasAdmin aliases = new svcAliasAdmin();
				PrepareProxy(aliases);

				GenericResult result = aliases.AddAlias(AdminUsername, AdminPassword,
														GetDomainName(mailAlias.Name), mailAlias.Name,
														new string[] { mailAlias.ForwardTo });


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

			catch (Exception ex)
			{
				if (MailAliasExists(mailAlias.Name))
				{
					DeleteMailAlias(mailAlias.Name);
				}
				Log.WriteError(ex);
				throw new Exception("Could not create mail alias", ex);

			}

		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:28,代码来源:SmarterMail7.cs


示例8: UpdateMailForwardingAsync

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


示例9: CreateMailAliasAsync

 /// <remarks/>
 public void CreateMailAliasAsync(MailAlias mailAlias)
 {
     this.CreateMailAliasAsync(mailAlias, null);
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:5,代码来源:MailServerProxy.cs


示例10: UpdateMailForwarding

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


示例11: BeginUpdateMailForwarding

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


示例12: AddMailForwardingAsync

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


示例13: UpdateMailForwarding

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


示例14: GetMailAlias

		public MailAlias GetMailAlias(string mailAliasName)
		{
			svcAliasAdmin aliases = new svcAliasAdmin();
			PrepareProxy(aliases);


			MailAlias alias = new MailAlias();
			MailAlias newAlias = new MailAlias();

			//convert old alliases created as mailboxes
			if (!MailAliasExists(mailAliasName))
			{
				MailAccount account = GetAccount(mailAliasName);
				newAlias.Name = account.Name;
				if ((account.ForwardingAddresses != null) && (account.ForwardingAddresses.Length > 0))
				{
					newAlias.ForwardTo = account.ForwardingAddresses[0];
				}
				else
				{
					newAlias.ForwardTo = string.Empty;
				}
				DeleteAccount(mailAliasName);
				CreateMailAlias(newAlias);
				return newAlias;
			}

			AliasInfoResult result = aliases.GetAlias(AdminUsername, AdminPassword, GetDomainName(mailAliasName), mailAliasName);
			alias.Name = result.AliasInfo.Name;
			if ((result.AliasInfo.Addresses != null) && (result.AliasInfo.Addresses.Length > 0))
			{
				alias.ForwardTo = result.AliasInfo.Addresses[0];
			}
			else
			{
				alias.ForwardTo = "[email protected]";
			}
			return alias;
		}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:39,代码来源:SmarterMail10.cs


示例15: UpdateMailAlias

 public void UpdateMailAlias(MailAlias mailAlias)
 {
     this.Invoke("UpdateMailAlias", new object[] {
                 mailAlias});
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:5,代码来源:MailServerProxy.cs


示例16: UpdateMailAlias

	    public void UpdateMailAlias(MailAlias mailAlias)
	    {
	        throw new System.NotImplementedException();
	    }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:4,代码来源:AbilityMailServer.cs


示例17: BeginUpdateMailAlias

 /// <remarks/>
 public System.IAsyncResult BeginUpdateMailAlias(MailAlias mailAlias, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UpdateMailAlias", new object[] {
                 mailAlias}, callback, asyncState);
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:6,代码来源:MailServerProxy.cs


示例18: GetMailAlias

		public MailAlias GetMailAlias(string mailAliasName)
		{
			svcAliasAdmin aliases = new svcAliasAdmin();
			PrepareProxy(aliases);


			MailAlias alias = new MailAlias();
			MailAlias newAlias = new MailAlias();

			//convert old alliases created as mailboxes
			if (!MailAliasExists(mailAliasName))
			{
				MailAccount account = GetAccount(mailAliasName);
				newAlias.Name = account.Name;
				newAlias.ForwardTo = account.ForwardingAddresses[0];
				DeleteAccount(mailAliasName);
				CreateMailAlias(newAlias);
				return newAlias;
			}

			AliasInfoResult result = aliases.GetAlias(AdminUsername, AdminPassword, GetDomainName(mailAliasName), mailAliasName);
			alias.Name = result.AliasInfo.Name;
			alias.ForwardTo = result.AliasInfo.Addresses[0];
			return alias;
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:25,代码来源:SmarterMail7.cs


示例19: UpdateMailAliasAsync

 /// <remarks/>
 public void UpdateMailAliasAsync(MailAlias mailAlias)
 {
     this.UpdateMailAliasAsync(mailAlias, null);
 }
开发者ID:jordan49,项目名称:websitepanel,代码行数:5,代码来源:MailServerProxy.cs


示例20: UpdateMailAlias

		public void UpdateMailAlias(MailAlias mailAlias)
		{
			try
			{
				svcAliasAdmin aliases = new svcAliasAdmin();
				PrepareProxy(aliases);


				GenericResult result = aliases.UpdateAlias(AdminUsername, AdminPassword, GetDomainName(mailAlias.Name),
															 mailAlias.Name,
															 new string[] { mailAlias.ForwardTo });

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

			}
			catch (Exception ex)
			{
				throw new Exception("Could not update mailAlias", ex);
			}

		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:22,代码来源:SmarterMail7.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mail.MailDomain类代码示例发布时间:2022-05-26
下一篇:
C# Mail.MailAccount类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap