public void SaveItem(MailDomain item)
		{
			item.CatchAllAccount = ddlCatchAllAccount.SelectedValue;
			SaveQuotas(item);

			featuresSection.SaveItem(item);
            sharingSection.SaveItem(item);
            throttlingSection.SaveItem(item);
			
            
			if (item[MailDomain.SMARTERMAIL_LICENSE_TYPE] == "PRO")
			{
				secSharing.Visible = false;
				sharingSection.Visible = false;
				secThrottling.Visible = false;
				throttlingSection.Visible = false;
			}
			else
			{
				sharingSection.SaveItem(item);
				throttlingSection.SaveItem(item);
			}
            

		}
Пример #2
0
        public MailDomain ToMailDomain()
        {
            if (domainConfig["mode"] == "0")
            {
                MailDomain domain = new MailDomain();

                domain.Enabled = domainConfig["enabled"] == "1" ? true : false;
                domain.Name    = domainConfig["domain"];

                if (domainConfig["usemaxusers"] == "1")
                {
                    domain.MaxDomainUsers = Convert.ToInt32(domainConfig["maxusers"]);
                }

                if (domainConfig["usemaxmailinglists"] == "1")
                {
                    domain.MaxLists = Convert.ToInt32(domainConfig["maxmailinglists"]);
                }

                if (domainConfig["usecatchcalluser"] == "1")
                {
                    domain.CatchAllAccount = domainConfig["catchalluser"];
                }

                return(domain);
            }

            return(null);
        }
        public void BindItem(MailDomain item)
        {
            // Hide/show controls when not enabled on service level
            rowMaxDomainDiskSpace.Visible = item.UseDomainDiskQuota;
            rowDomainLimits.Visible = item.UseDomainLimits;
            rowUserLimits.Visible = item.UseUserLimits;

            txtMaxDomainDiskSpace.Text = item.MaxDomainSizeInMB.ToString();
            txtMaxDomainUsers.Text = item.MaxDomainUsers.ToString();
            txtLimitVolume.Text = item.MegaByteSendLimit.ToString();
            txtLimitNumber.Text = item.NumberSendLimit.ToString();
            txtDefaultUserQuotaInMB.Text = item.DefaultUserQuotaInMB.ToString();
            txtDefaultUserMaxMessageSizeMegaByte.Text = item.DefaultUserMaxMessageSizeMegaByte.ToString();
            txtDefaultUserMegaByteSendLimit.Text = item.DefaultUserMegaByteSendLimit.ToString();
            txtDefaultUserNumberSendLimit.Text = item.DefaultUserNumberSendLimit.ToString();

            if (!IsPostBack)
            {
                var accounts = ES.Services.MailServers.GetMailAccounts(item.PackageId, false);
                ddlCatchAllAccount.DataSource = accounts;
                ddlCatchAllAccount.DataBind();
                ddlPostMasterAccount.DataSource = accounts;
                ddlPostMasterAccount.DataBind();
            }

            Utils.SelectListItem(ddlCatchAllAccount, item.CatchAllAccount);
            Utils.SelectListItem(ddlPostMasterAccount, item.PostmasterAccount);

        }
		public void BindItem(MailDomain item)
		{
			cbShowcontentfilteringmenu.Checked = item.ShowContentFilteringMenu;
			cbShowdomainaliasmenu.Checked = item.ShowDomainAliasMenu;
			cbShowlistmenu.Checked = item.ShowListMenu;
			cbShowspammenu.Checked = item.ShowSpamMenu;
			cbShowDomainReports.Checked = item.ShowsStatsMenu;
		}
        public void BindItem(MailDomain item)
        {
            BindMailboxes(item);

            chkDomainSmartHostEnabled.Checked = Convert.ToBoolean(item["MailEnable_SmartHostEnabled"]);
            chkDomainSmartHostAuthSenders.Checked = Convert.ToBoolean(item["MailEnable_SmartHostAuth"]);
            txtDestination.Text = item.RedirectionHosts;
        }
 public void BindItem(MailDomain item)
 {
     cbGlobalAddressList.Checked = item.IsGlobalAddressList;
     cbSharedCalendars.Checked = item.SharedCalendars;
     cbSharedContacts.Checked = item.SharedContacts;
     cbSharedFolders.Checked = item.SharedFolders;
     cbSharedNotes.Checked = item.SharedNotes;
     cbSharedTasks.Checked = item.SharedTasks;
 }
		public void BindItem(MailDomain item)
		{
			txtMessagesPerHour.Text = item[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR];
			cbMessagesPerHour.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR_ENABLED]);
			txtBandwidthPerHour.Text = item[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR];
			cbBandwidthPerHour.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR_ENABLED]);
			txtBouncesPerHour.Text = item[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR];
			cbBouncesPerHour.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR_ENABLED]);
		}
		public void SaveItem(MailDomain item)
		{
			item[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR] = txtMessagesPerHour.Text;
			item[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR_ENABLED] = cbMessagesPerHour.Checked.ToString();
			item[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR] = txtBandwidthPerHour.Text;
			item[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR_ENABLED] = cbBandwidthPerHour.Checked.ToString();
			item[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR] = txtBouncesPerHour.Text;
			item[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR_ENABLED] = cbBouncesPerHour.Checked.ToString();
		}
		private void BindMailboxes(MailDomain item)
		{
			MailAccount[] accounts = ES.Services.MailServers.GetMailAccounts(item.PackageId, false);
            MailAlias[] forwardings = ES.Services.MailServers.GetMailForwardings(item.PackageId, false);

			BindAccounts(item, ddlCatchAllAccount, accounts);
			BindAccounts(item, ddlCatchAllAccount, forwardings);
			Utils.SelectListItem(ddlCatchAllAccount, item.CatchAllAccount);
		}
 public void SaveItem(MailDomain item)
 {
     item.IsGlobalAddressList = cbGlobalAddressList.Checked;
     item.SharedCalendars = cbSharedCalendars.Checked;
     item.SharedContacts = cbSharedContacts.Checked;
     item.SharedFolders = cbSharedFolders.Checked;
     item.SharedNotes = cbSharedNotes.Checked;
     item.SharedTasks = cbSharedTasks.Checked;
     
 }
 private void SaveQuotas(MailDomain item)
 {                        
     item.MaxDomainSizeInMB = Utils.ParseInt(txtSize.Text);
     item.MaxDomainAliases = Utils.ParseInt(txtDomainAliases.Text);
     item.MaxDomainUsers = Utils.ParseInt(txtUser.Text);
     item.MaxAliases = Utils.ParseInt(txtUserAliases.Text);
     item.MaxLists = Utils.ParseInt(txtMailingLists.Text);            
     item.MaxRecipients = Utils.ParseInt(txtRecipientsPerMessage.Text);
     item.MaxMessageSize = Utils.ParseInt(txtMessageSize.Text);
 }
		public void BindItem(MailDomain item)
		{
			cbShowcontentfilteringmenu.Checked = item.ShowContentFilteringMenu;
			cbShowdomainaliasmenu.Checked = item.ShowDomainAliasMenu;
			cbShowlistmenu.Checked = item.ShowListMenu;
			cbShowspammenu.Checked = item.ShowSpamMenu;
			cbShowDomainReports.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_SHOW_DOMAIN_REPORTS]);
			cbEnablePopRetreival.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ENABLED]);
		    cbEnableCatchAlls.Checked = Convert.ToBoolean(item[MailDomain.SMARTERMAIL5_CATCHALLS_ENABLED]);
		}
		public void SaveItem(MailDomain item)
		{
			item.ShowContentFilteringMenu = cbShowcontentfilteringmenu.Checked;
			item.ShowDomainAliasMenu = cbShowdomainaliasmenu.Checked;
			item.ShowListMenu = cbShowlistmenu.Checked;
			item.ShowSpamMenu = cbShowspammenu.Checked;
			item[MailDomain.SMARTERMAIL5_SHOW_DOMAIN_REPORTS] = cbShowDomainReports.Checked.ToString();
			item[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ENABLED] = cbEnablePopRetreival.Checked.ToString();
		    item[MailDomain.SMARTERMAIL5_CATCHALLS_ENABLED] = cbEnableCatchAlls.Checked.ToString();
		}
        private void BindItem()
        {
            try
            {
                if (!IsPostBack)
                {
                    // load item if required
                    if (PanelRequest.ItemID > 0)
                    {
                        // existing item
                        try
                        {
                            item = ES.Services.MailServers.GetMailDomain(PanelRequest.ItemID);
                        }
                        catch (Exception ex)
                        {
                            ShowErrorMessage("MAIL_GET_DOMAIN", ex);
                            return;
                        }

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

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

                if (!IsPostBack)
                {
                    // bind item to controls
                    if (item != null)
                    {
                        // bind item to controls
                        litDomainName.Text = item.Name;

                        // other controls
                        IMailEditDomainControl ctrl = (IMailEditDomainControl)providerControl.Controls[0];
                        ctrl.BindItem(item);

                        BindPointers();
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("MAIL_INIT_DOMAIN_FORM", ex);
                return;
            }
        }
 public void SaveItem(MailDomain item)
 {
     item.CatchAllAccount = ddlCatchAllAccount.SelectedValue;
     item.PostmasterAccount = ddlPostMasterAccount.SelectedValue;
     item.MaxDomainSizeInMB = Convert.ToInt32(txtMaxDomainDiskSpace.Text);
     item.MaxDomainUsers = Convert.ToInt32(txtMaxDomainUsers.Text);
     item.NumberSendLimit = Convert.ToInt32(txtLimitNumber.Text);
     item.MegaByteSendLimit = Convert.ToInt32(txtLimitVolume.Text);
     item.DefaultUserQuotaInMB = Convert.ToInt32(txtDefaultUserQuotaInMB.Text);
     item.DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32(txtDefaultUserMaxMessageSizeMegaByte.Text);
     item.DefaultUserMegaByteSendLimit = Convert.ToInt32(txtDefaultUserMegaByteSendLimit.Text);
     item.DefaultUserNumberSendLimit = Convert.ToInt32(txtDefaultUserNumberSendLimit.Text);
 }
        public void SaveItem(MailDomain item)
        {
            item.AbuseAccount = ddlAbuseAccount.SelectedValue;
            item.PostmasterAccount = ddlPostmasterAccount.SelectedValue;

            // if we have a smarthost we need to clear the catchall
            if (chkDomainSmartHostEnabled.Checked)
                item.CatchAllAccount= "";
            else
                item.CatchAllAccount = ddlCatchAllAccount.SelectedValue;

            item["MailEnable_SmartHostEnabled"] = chkDomainSmartHostEnabled.Checked.ToString();
            item["MailEnable_SmartHostAuth"] = chkDomainSmartHostAuthSenders.Checked.ToString(); 
            item.RedirectionHosts = txtDestination.Text;
        }
		private void BindAccounts(MailDomain item, DropDownList ddl, MailAccount[] accounts)
		{
			if (ddl.Items.Count == 0)
				ddl.Items.Add(new ListItem(GetLocalizedString("Text.NotSelected"), ""));

			foreach (MailAccount account in accounts)
			{
				int idx = account.Name.IndexOf("@");
				string accountName = account.Name.Substring(0, idx);
				string accountDomain = account.Name.Substring(idx + 1);

				if (String.Compare(accountDomain, item.Name, true) == 0)
					ddl.Items.Add(new ListItem(account.Name, accountName));
			}
		}
        public void BindItem(MailDomain item)
        {            
            BindMailboxes(item);
            BindQuotas(item);
            featuresSection.BindItem(item);

			if (item[MailDomain.SMARTERMAIL_LICENSE_TYPE] == "PRO")
			{
				secSharing.Visible = false;
				sharingSection.Visible = false;
			}
			else
			{
				sharingSection.BindItem(item);
			}
        }
Пример #19
0
        public void CreateDomain(MailDomain domain)
        {
            Tree      domains   = AMSHelper.GetDomainsConfig();
            AmsDomain amsDomain = new AmsDomain(domain.Name);

            if (amsDomain.Load(domains))
            {
                throw new Exception("Domain is already registered.");
            }

            amsDomain.Read(domain);

            if (!amsDomain.Save(domains))
            {
                throw new Exception("Couldn't create a domain.");
            }
        }
Пример #20
0
        public void UpdateDomain(MailDomain domain)
        {
            Tree      config    = AMSHelper.GetDomainsConfig();
            AmsDomain amsDomain = new AmsDomain(domain.Name);

            if (amsDomain.Load(config))
            {
                amsDomain.Read(domain);

                if (!amsDomain.Save(config))
                {
                    throw new Exception("Couldn't update specified domain.");
                }
            }
            else
            {
                throw new Exception("Couldn't find specified domain.");
            }
        }
Пример #21
0
 public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
 {
     foreach (ServiceProviderItem item in items)
     {
         if (item is MailDomain)
         {
             try
             {
                 MailDomain domain = GetDomain(item.Name);
                 domain.Enabled = enabled;
                 // update mail domain
                 UpdateDomain(domain);
             }
             catch (Exception ex)
             {
                 Log.WriteError(String.Format("Error switching '{0}' mail domain", item.Name), ex);
             }
         }
     }
 }
Пример #22
0
        public void Read(MailDomain domain)
        {
            domainConfig["enabled"] = domain.Enabled ? "1" : "0";
            domainConfig["domain"]  = domain.Name;
            domainConfig["mode"]    = "0";

            domainConfig["usemaxusers"] = (domain.MaxDomainUsers == 0) ? "0" : "1";
            domainConfig["maxusers"]    = (domain.MaxDomainUsers == 0) ? "0" : domain.MaxDomainUsers.ToString();

            domainConfig["usemaxmailinglists"] = (domain.MaxLists == 0) ? "0" : "1";
            domainConfig["maxmailinglists"]    = (domain.MaxLists == 0) ? "0" : domain.MaxLists.ToString();

            if (!string.IsNullOrEmpty(domain.CatchAllAccount))
            {
                domainConfig["usecatchcalluser"] = "******";
                domainConfig["catchalluser"]     = domain.CatchAllAccount;
            }
            else
            {
                domainConfig["usecatchcalluser"] = "******";
                domainConfig["catchalluser"]     = string.Empty;
            }
        }
Пример #23
0
		public void CreateDomain(MailDomain domain)
		{
			Tree domains = AMSHelper.GetDomainsConfig();
			AmsDomain amsDomain = new AmsDomain(domain.Name);

			if (amsDomain.Load(domains))
				throw new Exception("Domain is already registered.");

			amsDomain.Read(domain);

			if (!amsDomain.Save(domains))
				throw new Exception("Couldn't create a domain.");
		}
		public void SaveItem(MailDomain item)
		{
			item.CatchAllAccount = ddlCatchAllAccount.SelectedValue;
		}
Пример #25
0
		private static void FillMailDomainFields(MailDomain domain, SettingsRequestResult addResult)
		{
			foreach (string pair in addResult.settingValues)
			{
				string[] parts = pair.Split('=');
				switch (parts[0])
				{
					case "catchall":
						domain.CatchAllAccount = parts[1];
						break;
					case "enablecatchalls":
						if (String.Equals(parts[1], "Enabled"))
							domain[MailDomain.SMARTERMAIL5_CATCHALLS_ENABLED] = "True";
						if (String.Equals(parts[1], "Disabled"))
							domain[MailDomain.SMARTERMAIL5_CATCHALLS_ENABLED] = "False";
						break;
					case "enablepopretrieval":
						domain[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ENABLED] = parts[1];
						break;
					case "isenabled":
						domain.Enabled = Boolean.Parse(parts[1]);
						break;
					case "ldapport":
						domain.LdapPort = int.Parse(parts[1]);
						break;
					case "altsmtpport":
						domain.SmtpPortAlt = int.Parse(parts[1]);
						break;
					case "sharedcalendar":
						domain.SharedCalendars = Boolean.Parse(parts[1]);
						break;
					case "sharedcontact":
						domain.SharedContacts = Boolean.Parse(parts[1]);
						break;
					case "sharedfolder":
						domain.SharedFolders = Boolean.Parse(parts[1]);
						break;
					case "sharednotes":
						domain.SharedNotes = Boolean.Parse(parts[1]);
						break;
					case "sharedtasks":
						domain.SharedTasks = Boolean.Parse(parts[1]);
						break;
					case "sharedgal":
						domain.IsGlobalAddressList = Boolean.Parse(parts[1]);
						break;
					case "bypassforwardblacklist":
						domain.BypassForwardBlackList = Boolean.Parse(parts[1]);
						break;
					case "showdomainreports":
						domain[MailDomain.SMARTERMAIL5_SHOW_DOMAIN_REPORTS] = parts[1];
						break;
					case "maxmessagesperhour":
						domain[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR] = parts[1];
						break;
					case "maxmessagesperhourenabled":
						domain[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR_ENABLED] = parts[1];
						break;
					case "maxsmtpoutbandwidthperhour":
						domain[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR] = parts[1];
						break;
					case "maxsmtpoutbandwidthperhourenabled":
						domain[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR_ENABLED] = parts[1];
						break;
					case "maxpopretrievalaccounts":
						domain[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ACCOUNTS] = parts[1];
						break;
					case "maxbouncesreceivedperhour":
						domain[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR] = parts[1];
						break;
					case "maxbouncesreceivedperhourenabled":
						domain[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR_ENABLED] = parts[1];
						break;
					case "enableimapretrieval":
						domain[MailDomain.SMARTERMAIL6_IMAP_RETREIVAL_ENABLED] = parts[1];
						break;
					case "enablemailsigning":
						domain[MailDomain.SMARTERMAIL6_MAIL_SIGNING_ENABLED] = parts[1];
						break;
					case "enableemailreports":
						domain[MailDomain.SMARTERMAIL6_EMAIL_REPORTS_ENABLED] = parts[1];
						break;
					case "syncml":
						domain[MailDomain.SMARTERMAIL6_SYNCML_ENABLED] = parts[1];
						break;
				}
			}
		}
		public void BindItem(MailDomain item)
		{
			BindMailboxes(item);
		}
Пример #27
0
		public void CreateDomain(MailDomain domain)
		{
			try
			{

				svcDomainAdmin domains = new svcDomainAdmin();
				PrepareProxy(domains);

				DomainSettingsResult defaultDomainSettings = domains.GetDomainDefaults(AdminUsername, AdminPassword);

				SettingsRequestResult defaultRequestedSettings =
					domains.GetRequestedDomainDefaults(AdminUsername, AdminPassword, new string[]
                                                                                         {
                                                                                             "defaultaltsmtpport",
                                                                                             "defaultaltsmtpportenabled",
                                                                                             "defaultautoresponderrestriction",
                                                                                             "defaultbypassgreylisting",
                                                                                             "defaultenablecatchalls",
                                                                                             "defaultenabledomainkeys",
                                                                                             "defaultenableemailreports",
                                                                                             "defaultenablepopretrieval",
                                                                                             "defaultmaxmessagesperhour",
                                                                                             "defaultmaxmessagesperhourenabled",
                                                                                             "defaultmaxsmtpoutbandwidthperhour",
                                                                                             "defaultmaxsmtpoutbandwidthperhourenabled",
                                                                                             "defaultmaxbouncesreceivedperhour",
                                                                                             "defaultmaxbouncesreceivedperhourenabled",
                                                                                             "defaultmaxpopretrievalaccounts",
                                                                                             "defaultsharedcalendar",
                                                                                             "defaultsharedcontact",
                                                                                             "defaultsharedfolder",
                                                                                             "defaultsharedgal",
                                                                                             "defaultsharednotes",
                                                                                             "defaultsharedtasks",
                                                                                             "defaultshowcalendar",
                                                                                             "defaultshowcontacts",
                                                                                             "defaultshowcontentfilteringmenu",
                                                                                             "defaultshowdomainaliasmenu",
                                                                                             "defaultshowdomainreports",
                                                                                             "defaultshowlistmenu",
                                                                                             "defaultshownotes",
                                                                                             "defaultshowspammenu",
                                                                                             "defaultshowtasks",
                                                                                             "defaultshowuserreports",
                                                                                             "defaultskin",
                                                                                             "defaultspamresponderoption",
                                                                                             "defaultspamforwardoption"
                                                                                         });

				string[] requestedDomainDefaults = defaultRequestedSettings.settingValues;

				//domain Path is taken from WebsitePanel Service settings

				GenericResult result = null;

				if (!InheritDomainDefaultLimits)
				{
					result = domains.AddDomain(AdminUsername,
											   AdminPassword,
											   domain.Name,
											   Path.Combine(DomainsPath, domain.Name),
											   SYSTEM_DOMAIN_ADMIN, // admin username
											   Guid.NewGuid().ToString("P"), // admin password
											   "Domain", // admin first name
											   "Administrator", // admin last name
											   ServerIP,
											   defaultDomainSettings.ImapPort,
											   defaultDomainSettings.PopPort,
											   defaultDomainSettings.SmtpPort,
											   domain.MaxAliases,
											   domain.MaxDomainSizeInMB,
											   domain.MaxDomainUsers,
											   domain.MaxMailboxSizeInMB,
											   domain.MaxMessageSize,
											   domain.MaxRecipients,
											   domain.MaxDomainAliases,
											   domain.MaxLists,
											   defaultDomainSettings.ShowDomainAliasMenu,
						// ShowDomainAliasMenu
											   defaultDomainSettings.ShowContentFilteringMenu,
						// ShowContentFilteringMenu
											   defaultDomainSettings.ShowSpamMenu, // ShowSpamMenu
											   defaultDomainSettings.ShowStatsMenu, // ShowStatsMenu
											   defaultDomainSettings.RequireSmtpAuthentication,
											   defaultDomainSettings.ShowListMenu, // ShowListMenu
											   defaultDomainSettings.ListCommandAddress);
				}
				else
				{
					result = domains.AddDomain(AdminUsername, AdminPassword,
											   domain.Name,
											   Path.Combine(DomainsPath, domain.Name),
											   SYSTEM_DOMAIN_ADMIN, // admin username
											   Guid.NewGuid().ToString("P"), // admin password
											   "Domain", // admin first name
											   "Administrator", // admin last name
											   ServerIP,
											   defaultDomainSettings.ImapPort,
											   defaultDomainSettings.PopPort,
											   defaultDomainSettings.SmtpPort,
											   defaultDomainSettings.MaxAliases,
											   defaultDomainSettings.MaxDomainSizeInMB,
											   defaultDomainSettings.MaxDomainUsers,
											   defaultDomainSettings.MaxMailboxSizeInMB,
											   defaultDomainSettings.MaxMessageSize,
											   defaultDomainSettings.MaxRecipients,
											   defaultDomainSettings.MaxDomainAliases,
											   defaultDomainSettings.MaxLists,
											   defaultDomainSettings.ShowDomainAliasMenu, // ShowDomainAliasMenu
											   defaultDomainSettings.ShowContentFilteringMenu, // ShowContentFilteringMenu
											   defaultDomainSettings.ShowSpamMenu, // ShowSpamMenu
											   defaultDomainSettings.ShowStatsMenu, // ShowStatsMenu
											   defaultDomainSettings.RequireSmtpAuthentication,
											   defaultDomainSettings.ShowListMenu, // ShowListMenu
											   defaultDomainSettings.ListCommandAddress);
				}
				if (!result.Result)
					throw new Exception(result.Message);


				// update additional settings
				result = domains.SetRequestedDomainSettings(AdminUsername, AdminPassword, domain.Name,
															SetMailDomainDefaultSettings(requestedDomainDefaults));

				if (!result.Result)
					throw new Exception(result.Message);
			}
			catch (Exception ex)
			{
				if (DomainExists(domain.Name))
				{
					DeleteDomain(domain.Name);
				}
				Log.WriteError(ex);
				throw new Exception("Could not create mail domain", ex);
			}
		}
Пример #28
0
		public void UpdateDomain(MailDomain domain)
		{
			try
			{
				// load original domain
				MailDomain origDomain = GetDomain(domain.Name);

				svcDomainAdmin domains = new svcDomainAdmin();
				PrepareProxy(domains);

				GenericResult result = domains.UpdateDomain(AdminUsername, AdminPassword,
					domain.Name,
					origDomain.ServerIP,
					domain.ImapPort,
					domain.PopPort,
					domain.SmtpPort,
					domain.MaxAliases,
					domain.MaxDomainSizeInMB,
					domain.MaxDomainUsers,
					domain.MaxMailboxSizeInMB,
					domain.MaxMessageSize,
					domain.MaxRecipients,
					domain.MaxDomainAliases,
					domain.MaxLists,
					domain.ShowDomainAliasMenu, // ShowDomainAliasMenu
					domain.ShowContentFilteringMenu, // ShowContentFilteringMenu
					domain.ShowSpamMenu, // ShowSpamMenu
					domain.ShowsStatsMenu, // this parameter is no longer used in SM5
					origDomain.RequireSmtpAuthentication,
					domain.ShowListMenu, // Showlistmenu
					origDomain.ListCommandAddress);

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

				// update catch-all group
				UpdateDomainCatchAllGroup(domain.Name, domain.CatchAllAccount);


				// update additional settings
				result = domains.SetRequestedDomainSettings(AdminUsername, AdminPassword, domain.Name,
					new string[] {
                        "isenabled=" + domain.Enabled,
                        "catchall=" + (!String.IsNullOrEmpty(domain.CatchAllAccount) ? SYSTEM_CATCH_ALL : ""),
                        "altsmtpport=" + domain.SmtpPortAlt,
                        "ldapport=" + domain.LdapPort,
                        "sharedcalendar=" + domain.SharedCalendars,
                        "sharedcontact=" + domain.SharedContacts,
                        "sharedfolder=" + domain.SharedFolders,
                        "sharednotes=" + domain.SharedNotes,
                        "sharedtasks=" + domain.SharedTasks,
                        "sharedgal=" + domain.IsGlobalAddressList,
                        "enablecatchalls=" + domain[MailDomain.SMARTERMAIL5_CATCHALLS_ENABLED],
                        "bypassforwardblacklist=" + domain.BypassForwardBlackList,
						"showdomainreports=" + domain[MailDomain.SMARTERMAIL5_SHOW_DOMAIN_REPORTS],
						"maxmessagesperhour=" + domain[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR],
					    "maxmessagesperhourenabled=" + domain[MailDomain.SMARTERMAIL5_MESSAGES_PER_HOUR_ENABLED],
					    "maxsmtpoutbandwidthperhour=" + domain[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR],
					    "maxsmtpoutbandwidthperhourenabled=" + domain[MailDomain.SMARTERMAIL5_BANDWIDTH_PER_HOUR_ENABLED],
                        "enablepopretrieval=" + domain[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ENABLED],
						"maxpopretrievalaccounts=" + domain[MailDomain.SMARTERMAIL5_POP_RETREIVAL_ACCOUNTS],
						"maxbouncesreceivedperhour=" + domain[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR],
						"maxbouncesreceivedperhourenabled=" + domain[MailDomain.SMARTERMAIL5_BOUNCES_PER_HOUR_ENABLED],
                        "enableimapretrieval=" + domain[MailDomain.SMARTERMAIL6_IMAP_RETREIVAL_ENABLED],
                        "enablemailsigning=" + domain[MailDomain.SMARTERMAIL6_MAIL_SIGNING_ENABLED],
                        "enableemailreports=" + domain[MailDomain.SMARTERMAIL6_EMAIL_REPORTS_ENABLED],
                        "syncml=" + domain[MailDomain.SMARTERMAIL6_SYNCML_ENABLED]
				});

				/*
                                          
				string[] requestedSettings = new string[]
					{
						"maxmessagesperhour",
						"maxmessagesperhourenabled",
						"maxsmtpoutbandwidthperhour",
						"maxsmtpoutbandwidthperhourenabled"
					};

				SettingsRequestResult addResult =
					domains.GetRequestedDomainSettings(AdminUsername, AdminPassword, domain.Name, requestedSettings);
				*/

				if (!result.Result)
					throw new Exception(result.Message);
			}
			catch (Exception ex)
			{
				throw new Exception("Could not update mail domain", ex);
			}
		}
Пример #29
0
        /// <summary>
        /// Returns domain info
        /// </summary>
        /// <param name="domainName">Domain name</param>
        /// <returns>Domain info</returns>
        public virtual MailDomain GetDomain(string domainName)
        {
            try
            {
                svcDomainAdmin domains = new svcDomainAdmin();
                PrepareProxy(domains);

                DomainSettingsResult result = domains.GetDomainSettings(AdminUsername, AdminPassword, domainName);
                if (!result.Result)
                    throw new Exception(result.Message);

                // fill domain properties
                MailDomain domain = new MailDomain();
                domain.Name = domainName;
                domain.Path = result.Path;
                domain.ServerIP = result.ServerIP;
                domain.ImapPort = result.ImapPort;
                domain.SmtpPort = result.SmtpPort;
                domain.PopPort = result.PopPort;
                domain.MaxAliases = result.MaxAliases;
                domain.MaxDomainAliases = result.MaxDomainAliases;
                domain.MaxLists = result.MaxLists;
                domain.MaxDomainSizeInMB = result.MaxDomainSizeInMB;
                domain.MaxDomainUsers = result.MaxDomainUsers;
                domain.MaxMailboxSizeInMB = result.MaxMailboxSizeInMB;
                domain.MaxMessageSize = result.MaxMessageSize;
                domain.MaxRecipients = result.MaxRecipients;
                domain.RequireSmtpAuthentication = result.RequireSmtpAuthentication;
                domain.ListCommandAddress = result.ListCommandAddress;
                domain.ShowContentFilteringMenu = result.ShowContentFilteringMenu;
                domain.ShowDomainAliasMenu = result.ShowDomainAliasMenu;
                domain.ShowListMenu = result.ShowListMenu;
                domain.ShowSpamMenu = result.ShowSpamMenu;
                domain.ShowsStatsMenu = result.ShowStatsMenu;
				// get additional domain settings
                string[] requestedSettings = new string[]
                {
                    "catchall",
                    "isenabled",
                    "ldapport",
                    "altsmtpport",
                    "sharedcalendar",
                    "sharedcontact",
                    "sharedfolder",
                    "sharednotes",
                    "sharedtasks",
                    "sharedgal",
                    "bypassforwardblacklist",
					
                };

                SettingsRequestResult addResult = domains.GetRequestedDomainSettings(AdminUsername, AdminPassword, domainName, requestedSettings);
                if (!addResult.Result)
                    throw new Exception(addResult.Message);

                FillMailDomainFields(domain, addResult);
                
                // get catch-all address
                if (!String.IsNullOrEmpty(domain.CatchAllAccount))
                {
                    // get catch-all group
                    string groupName = SYSTEM_CATCH_ALL + "@" + domain.Name;
                    if (GroupExists(groupName))
                    {
                        // get the first member of this group
                        MailGroup group = GetGroup(groupName);
                        domain.CatchAllAccount = GetAccountName(group.Members[0]);
                    }
                }

                /* 
				//get license information
				if (GetProductLicenseInfo() == "PRO")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "PRO";
				}
				if (GetProductLicenseInfo() == "ENT")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "ENT";
				}
				if (GetProductLicenseInfo() == "FREE")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "FREE";
				}
                */
                 
                return domain;
            }
            catch (Exception ex)
            {
                throw new Exception("Could not get mail domain", ex);
            }
        }
Пример #30
0
		public MailDomain GetDomain(string domainName)
		{
			try
			{
				svcDomainAdmin domains = new svcDomainAdmin();
				PrepareProxy(domains);

				DomainSettingsResult result = domains.GetDomainSettings(AdminUsername, AdminPassword, domainName);
				if (!result.Result)
					throw new Exception(result.Message);

				// fill domain properties
				MailDomain domain = new MailDomain();
				domain.Name = domainName;
				domain.Path = result.Path;
				domain.ServerIP = result.ServerIP;
				domain.ImapPort = result.ImapPort;
				domain.SmtpPort = result.SmtpPort;
				domain.PopPort = result.PopPort;
				domain.MaxAliases = result.MaxAliases;
				domain.MaxDomainAliases = result.MaxDomainAliases;
				domain.MaxLists = result.MaxLists;
				domain.MaxDomainSizeInMB = result.MaxDomainSizeInMB;
				domain.MaxDomainUsers = result.MaxDomainUsers;
				domain.MaxMailboxSizeInMB = result.MaxMailboxSizeInMB;
				domain.MaxMessageSize = result.MaxMessageSize;
				domain.MaxRecipients = result.MaxRecipients;
				domain.RequireSmtpAuthentication = result.RequireSmtpAuthentication;
				domain.ListCommandAddress = result.ListCommandAddress;
				domain.ShowContentFilteringMenu = result.ShowContentFilteringMenu;
				domain.ShowDomainAliasMenu = result.ShowDomainAliasMenu;
				domain.ShowListMenu = result.ShowListMenu;
				domain.ShowSpamMenu = result.ShowSpamMenu;
				// get additional domain settings
				string[] requestedSettings = new string[]
                {
                    "catchall",
					"enablepopretrieval",
					"enablecatchalls",
                    "isenabled",
                    "ldapport",
                    "altsmtpport",
                    "sharedcalendar",
                    "sharedcontact",
                    "sharedfolder",
                    "sharednotes",
                    "sharedtasks",
                    "sharedgal",
                    "bypassforwardblacklist",
					"showdomainreports",
					"spamresponderoption",
					"spamforwardoption",
					"maxmessagesperhour",
					"maxmessagesperhourenabled",
					"maxsmtpoutbandwidthperhour",
					"maxsmtpoutbandwidthperhourenabled",
					"maxpopretrievalaccounts",
					"maxbouncesreceivedperhour",
					"maxbouncesreceivedperhourenabled",
                    "enableimapretrieval",
                    "enablemailsigning",
                    "enableemailreports",
                    "syncml"
				};

				SettingsRequestResult addResult = domains.GetRequestedDomainSettings(AdminUsername, AdminPassword, domainName, requestedSettings);
				if (!addResult.Result)
					throw new Exception(addResult.Message);

				FillMailDomainFields(domain, addResult);


				// get catch-all address
				if (!String.IsNullOrEmpty(domain.CatchAllAccount))
				{
					// get catch-all group
					string groupName = SYSTEM_CATCH_ALL + "@" + domain.Name;
					if (GroupExists(groupName))
					{
						// get the first member of this group
						MailGroup group = GetGroup(groupName);
						domain.CatchAllAccount = GetAccountName(group.Members[0]);
					}
				}


				svcServerAdmin serverAdmin = new svcServerAdmin();
				PrepareProxy(serverAdmin);

				EditionResult licenseType = serverAdmin.GetEdition(AdminUsername, AdminPassword);

				if (licenseType.Edition == "PRO")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "PRO";
				}
				if (licenseType.Edition == "ENT")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "ENT";
				}
				if (licenseType.Edition == "FREE")
				{
					domain[MailDomain.SMARTERMAIL_LICENSE_TYPE] = "FREE";
				}


				return domain;
			}
			catch (Exception ex)
			{
				throw new Exception("Could not get mail domain", ex);
			}
		}
        private void SaveItem()
        {
            if (!Page.IsValid)
                return;

            // get form data
            MailDomain item = new MailDomain();
            item.Id = PanelRequest.ItemID;
            item.PackageId = PanelSecurity.PackageId;

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

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

            // return
            RedirectSpaceHomePage();
        }
Пример #32
0
        private static void FillMailDomainFields(MailDomain domain, SettingsRequestResult addResult)
        {
            foreach (string pair in addResult.settingValues)
            {
                string[] parts = pair.Split('=');
                switch (parts[0])
                {
                    case "catchall":
                        domain.CatchAllAccount = parts[1];
                        break;
                    case "isenabled":
                        domain.Enabled = Boolean.Parse(parts[1]);
                        break;
                    case "ldapport":
                        domain.LdapPort = int.Parse(parts[1]);
                        break;
                    case "altsmtpport":
                        domain.SmtpPortAlt = int.Parse(parts[1]);
                        break;
                    case "sharedcalendar":
                        domain.SharedCalendars = Boolean.Parse(parts[1]);
                        break;
                    case "sharedcontact":
                        domain.SharedContacts = Boolean.Parse(parts[1]);
                        break;
                    case "sharedfolder":
                        domain.SharedFolders = Boolean.Parse(parts[1]);
                        break;
                    case "sharednotes":
                        domain.SharedNotes = Boolean.Parse(parts[1]);
                        break;
                    case "sharedtasks":
                        domain.SharedTasks = Boolean.Parse(parts[1]);
                        break;
                    case "sharedgal":
                        domain.IsGlobalAddressList = Boolean.Parse(parts[1]);
                        break;
                    case "bypassforwardblacklist":
                        domain.BypassForwardBlackList = Boolean.Parse(parts[1]);
                        break;     
					
                }
            }
        }
 private void BindQuotas(MailDomain item)
 {            
     txtSize.Text = item.MaxDomainSizeInMB.ToString();
     txtDomainAliases.Text = item.MaxDomainAliases.ToString();
     txtUser.Text = item.MaxDomainUsers.ToString();
     txtUserAliases.Text = item.MaxAliases.ToString();
     txtMailingLists.Text = item.MaxLists.ToString();
     txtRecipientsPerMessage.Text = item.MaxRecipients.ToString();
     txtMessageSize.Text = item.MaxMessageSize.ToString();
 }
Пример #34
0
        /// <summary>
        /// Creates a new domain in the specified folder 
        /// </summary>
        /// <param name="domain">Domain info</param>
        public virtual void CreateDomain(MailDomain domain)
        {
            try
            {
                svcDomainAdmin domains = new svcDomainAdmin();
                PrepareProxy(domains);

				
                DomainSettingsResult defaultDomainSettings = domains.GetDomainDefaults(AdminUsername, AdminPassword);

                SettingsRequestResult defaultRequestedSettings =
                    domains.GetRequestedDomainDefaults(AdminUsername, AdminPassword, new string[] { 
                        "defaultaltsmtpport",
						"defaultimapport",
						"defaultmaxaliases",
						"defaultmaxdomainaliases",
						"defaultmaxdomainsize",
						"defaultmaxdomainusers",
						"defaultmaxlists",
						"defaultmaxmailboxsize",
						"defaultmaxmessagesize",
						"defaultmaxrecipients",
						"defaultpopport",
						"defaultshowcontentfilteringmenu",
						"defaultshowdomainaliasmenu",
						"defaultshowlistmenu",
						"defaultshowspammenu",
						"defaultshowstatmenu",
						"defaultsmtpauthenticationrequired",
						"defaultsmtpport",
						"defaultbypassforwardblacklist",
						"defaultldapport",
						"defaultldapdisallowoptout",
						"defaultsharedcalendar",
						"defaultsharedcontact",
						"defaultsharedfolder",
						"defaultsharedtasks",
						"defaultsharedgal"
						});


            	string[] requestedDomainDefaults = defaultRequestedSettings.settingValues;

				//domain Path is taken from WebsitePanel Service settings

                GenericResult1 result = null;

                if (!InheritDomainDefaultLimits)
                {
                    result = domains.AddDomain(AdminUsername, AdminPassword,
                                                             domain.Name,
                                                             Path.Combine(DomainsPath, domain.Name),
                                                             SYSTEM_DOMAIN_ADMIN, // admin username
                                                             Guid.NewGuid().ToString("P"), // admin password
                                                             "Domain", // admin first name
                                                             "Administrator", // admin last name
                                                             ServerIP,
                                                             defaultDomainSettings.ImapPort,
                                                             defaultDomainSettings.PopPort,
                                                             defaultDomainSettings.SmtpPort,
                                                             domain.MaxAliases,
                                                             domain.MaxDomainSizeInMB,
                                                             domain.MaxDomainUsers,
                                                             domain.MaxMailboxSizeInMB,
                                                             domain.MaxMessageSize,
                                                             domain.MaxRecipients,
                                                             domain.MaxDomainAliases,
                                                             domain.MaxLists,
                                                             defaultDomainSettings.ShowDomainAliasMenu,// ShowDomainAliasMenu
                                                             defaultDomainSettings.ShowContentFilteringMenu,// ShowContentFilteringMenu
                                                             defaultDomainSettings.ShowSpamMenu, // ShowSpamMenu
                                                             defaultDomainSettings.ShowStatsMenu, // ShowStatsMenu
                                                             defaultDomainSettings.RequireSmtpAuthentication,
                                                             defaultDomainSettings.ShowListMenu, // ShowListMenu
                                                             defaultDomainSettings.ListCommandAddress);
                }
                else
                {
                    result = domains.AddDomain(AdminUsername, AdminPassword,
                                                             domain.Name,
                                                             Path.Combine(DomainsPath, domain.Name),
                                                             SYSTEM_DOMAIN_ADMIN, // admin username
                                                             Guid.NewGuid().ToString("P"), // admin password
                                                             "Domain", // admin first name
                                                             "Administrator", // admin last name
                                                             ServerIP,
                                                             defaultDomainSettings.ImapPort,
                                                             defaultDomainSettings.PopPort,
                                                             defaultDomainSettings.SmtpPort,
                                                             defaultDomainSettings.MaxAliases,
                                                             defaultDomainSettings.MaxDomainSizeInMB,
                                                             defaultDomainSettings.MaxDomainUsers,
                                                             defaultDomainSettings.MaxMailboxSizeInMB,
                                                             defaultDomainSettings.MaxMessageSize,
                                                             defaultDomainSettings.MaxRecipients,
                                                             defaultDomainSettings.MaxDomainAliases,
                                                             defaultDomainSettings.MaxLists,
                                                             defaultDomainSettings.ShowDomainAliasMenu,// ShowDomainAliasMenu
                                                             defaultDomainSettings.ShowContentFilteringMenu,// ShowContentFilteringMenu
                                                             defaultDomainSettings.ShowSpamMenu, // ShowSpamMenu
                                                             defaultDomainSettings.ShowStatsMenu, // ShowStatsMenu
                                                             defaultDomainSettings.RequireSmtpAuthentication,
                                                             defaultDomainSettings.ShowListMenu, // ShowListMenu
                                                             defaultDomainSettings.ListCommandAddress);
                }

                if (!result.Result)
                    throw new Exception(result.Message);
				
                // update additional settings
                result = domains.SetRequestedDomainSettings(AdminUsername, AdminPassword, domain.Name, requestedDomainDefaults);

				
                if (!result.Result)
                    throw new Exception(result.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("Could not create mail domain", ex);
            }
           
        }
Пример #35
0
        /// <summary>
        /// Updates the settings for the specified domain 
        /// </summary>
        /// <param name="domain">Domain info</param>
        public virtual void UpdateDomain(MailDomain domain)
        {
            try
            {
                // load original domain
                MailDomain origDomain = GetDomain(domain.Name);

                svcDomainAdmin domains = new svcDomainAdmin();
                PrepareProxy(domains);

                GenericResult1 result = domains.UpdateDomain(AdminUsername, AdminPassword,
                    domain.Name,
                    origDomain.ServerIP,
                    domain.ImapPort,
                    domain.PopPort,
                    domain.SmtpPort,
					domain.MaxAliases,
                    domain.MaxDomainSizeInMB,
					domain.MaxDomainUsers,
                    domain.MaxMailboxSizeInMB,
					domain.MaxMessageSize,
					domain.MaxRecipients,
					domain.MaxDomainAliases,
					domain.MaxLists,
                    domain.ShowDomainAliasMenu, // ShowDomainAliasMenu
                    domain.ShowContentFilteringMenu, // ShowContentFilteringMenu
                    domain.ShowSpamMenu, // ShowSpamMenu
                    domain.ShowsStatsMenu, // ShowStatsMenu
                    origDomain.RequireSmtpAuthentication,
                    domain.ShowListMenu, // ShowListMenu
                    origDomain.ListCommandAddress);

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

                // update catch-all group
                UpdateDomainCatchAllGroup(domain.Name, domain.CatchAllAccount);

                // update additional settings
                result = domains.SetRequestedDomainSettings(AdminUsername, AdminPassword, domain.Name,
                    new string[] {
                        "isenabled=" + domain.Enabled,
                        "catchall=" + (!String.IsNullOrEmpty(domain.CatchAllAccount) ? SYSTEM_CATCH_ALL : ""),
                        "altsmtpport=" + domain.SmtpPortAlt,
                        "ldapport=" + domain.LdapPort,
                        "sharedcalendar=" + domain.SharedCalendars,
                        "sharedcontact=" + domain.SharedContacts,
                        "sharedfolder=" + domain.SharedFolders,
                        "sharednotes=" + domain.SharedNotes,
                        "sharedtasks=" + domain.SharedTasks,
                        "sharedgal=" + domain.IsGlobalAddressList,
                        "bypassforwardblacklist=" + domain.BypassForwardBlackList,
				});
				

                if (!result.Result)
                    throw new Exception(result.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("Could not update mail domain", ex);
            }
        }