コード例 #1
0
ファイル: SmarterMail2.cs プロジェクト: jordan49/websitepanel
        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);
            }
        }
コード例 #2
0
ファイル: SmarterMail2.cs プロジェクト: jordan49/websitepanel
        public virtual MailGroup[] GetGroups(string domainName)
        {
            try
            {
                svcAliasAdmin svcGroups = new svcAliasAdmin();
                PrepareProxy(svcGroups);

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

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

                MailGroup[] groups = new MailGroup[result.AliasInfos.Length];
                for (int i = 0; i < groups.Length; i++)
                {
                    groups[i] = new MailGroup();
                    groups[i].Name = result.AliasInfos[i].Name + "@" + domainName;
                    groups[i].Members = result.AliasInfos[i].Addresses;
                    groups[i].Enabled = true; // by default
                }

                return groups;
            }
            catch (Exception ex)
            {
                throw new Exception("Could not get the list of mail domain groups", ex);
            }
        }
コード例 #3
0
		public MailGroup[] GetGroups(string domainName)
		{
			try
			{
				svcAliasAdmin svcGroups = new svcAliasAdmin();
				PrepareProxy(svcGroups);

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

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


				List<MailGroup> groups = new List<MailGroup>();

				foreach (AliasInfo alias in result.AliasInfos)
				{
					//group - alias with more than one forwarding address
					if (alias.Addresses.Length > 1)
					{
						MailGroup mailGroup = new MailGroup();
						mailGroup.Name = alias.Name + "@" + domainName;
						mailGroup.Members = alias.Addresses;
						groups.Add(mailGroup);
					}
				}

				return groups.ToArray();
			}
			catch (Exception ex)
			{
				throw new Exception("Could not get the list of mail domain groups", ex);
			}
		}