Beispiel #1
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            settings.MaxIMAPConnections = textMaxIMAPConnections.Number;
            settings.WelcomeIMAP        = textWelcomeMessage.Text;

            settings.IMAPSortEnabled      = checkEnableIMAPSort.Checked;
            settings.IMAPQuotaEnabled     = checkEnableIMAPQuota.Checked;
            settings.IMAPIdleEnabled      = checkEnableIMAPIdle.Checked;
            settings.IMAPACLEnabled       = checkEnableIMAPACL.Checked;
            settings.IMAPPublicFolderName = textIMAPPublicFolderName.Text;

            settings.IMAPSASLPlainEnabled           = checkEnableIMAPPlain.Checked;
            settings.IMAPSASLInitialResponseEnabled = checkEnableIMAPInitialResponse.Checked;
            settings.IMAPMasterUser = textIMAPMasterUser.Text;

            bool setClean = true;

            try
            {
                settings.IMAPHierarchyDelimiter = comboIMAPHierarchyDelimiter.Text;
            }
            catch (Exception ex)
            {
                setClean = false;
                MessageBox.Show(ex.Message, EnumStrings.hMailServerAdministrator);
            }

            Marshal.ReleaseComObject(settings);

            if (setClean)
            {
                DirtyChecker.SetClean(this);
            }

            return(true);
        }
Beispiel #2
0
        public bool SaveData()
        {
            bool newObject = false;

            if (representedObject == null)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.Groups   groups   = settings.Groups;
                representedObject = groups.Add();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(groups);

                newObject = true;
            }

            representedObject.Name = textName.Text;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(textName.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Name);
                mainForm.SelectNode(crit);
            }

            EnableDisable();

            return(true);
        }
Beispiel #3
0
        public bool SaveData()
        {
            bool newObject = false;

            if (_representedObject == null)
            {
                hMailServer.SURBLServers surblServers = APICreator.SURBLServers;
                _representedObject = surblServers.Add();
                newObject          = true;

                Marshal.ReleaseComObject(surblServers);
            }

            _representedObject.Active = checkEnabled.Checked;

            _representedObject.DNSHost       = textDNSHost.Text;
            _representedObject.RejectMessage = textRejectionMessage.Text;
            _representedObject.Score         = textSpamScore.Number;

            _representedObject.Save();


            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(null);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(_representedObject.DNSHost);
                mainForm.SelectNode(crit);
            }

            return(true);
        }
Beispiel #4
0
        public ucTCPIPPort(int portID)
        {
            InitializeComponent();

            DirtyChecker.SubscribeToChange(this, OnContentChanged);

            if (portID > 0)
            {
                hMailServer.TCPIPPorts ports = APICreator.TCPIPPortsSettings;
                _representedObject = ports.get_ItemByDBID(portID);
                Marshal.ReleaseComObject(ports);
            }

            comboProtocol.AddItem("SMTP", eSessionType.eSTSMTP);
            comboProtocol.AddItem("POP3", eSessionType.eSTPOP3);
            comboProtocol.AddItem("IMAP", eSessionType.eSTIMAP);

            ListSSLCertificates();

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);

            EnableDisable();
        }
Beispiel #5
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;
            hMailServer.AntiSpam antiSpam = settings.AntiSpam;

            antiSpam.SpamMarkThreshold   = textSpamMarkThreshold.Number;
            antiSpam.SpamDeleteThreshold = textSpamDeleteThreshold.Number;
            antiSpam.AddHeaderSpam       = checkAddHeaderSpam.Checked;
            antiSpam.AddHeaderReason     = checkAddHeaderReason.Checked;
            antiSpam.PrependSubject      = checkPrependSubject.Checked;
            antiSpam.PrependSubjectText  = textPrependSubjectText.Text;

            antiSpam.UseSPF               = chkUseSPF.Checked;
            antiSpam.UseSPFScore          = textUseSPFScore.Number;
            antiSpam.CheckHostInHelo      = chkCheckHostInHelo.Checked;
            antiSpam.CheckHostInHeloScore = textCheckHostInHeloScore.Number;
            antiSpam.UseMXChecks          = chkUseMXChecks.Checked;
            antiSpam.UseMXChecksScore     = textUseMXChecksScore.Number;

            antiSpam.SpamAssassinEnabled    = checkSpamAssassinEnabled.Checked;
            antiSpam.SpamAssassinHost       = textSpamAssassinHost.Text;
            antiSpam.SpamAssassinPort       = textSpamAssassinPort.Number;
            antiSpam.SpamAssassinMergeScore = checkSpamAssassinMergeScore.Checked;
            antiSpam.SpamAssassinScore      = textSpamAssassinScore.Number;

            antiSpam.DKIMVerificationEnabled      = checkDKIMVerificationEnabled.Checked;
            antiSpam.DKIMVerificationFailureScore = textDKIMVerificationFailureScore.Number;

            antiSpam.MaximumMessageSize = textMaximumMessageSize.Number;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiSpam);

            return(true);
        }
Beispiel #6
0
        public bool SaveData()
        {
            hMailServer.Application app = APICreator.Application;

            hMailServer.Settings settings = app.Settings;

            bool restartRequired =
                textSslCipherList.Dirty ||
                checkTlsVersion10.Dirty ||
                checkTlsVersion11.Dirty ||
                checkTlsVersion12.Dirty ||
                checkTlsVersion13.Dirty ||
                checkTlsOptionPreferServerCiphers.Dirty ||
                checkTlsOptionPrioritizeChaCha.Dirty;

            settings.VerifyRemoteSslCertificate = checkVerifyRemoteServerSslCertificate.Checked;
            settings.SslCipherList = textSslCipherList.Text;

            settings.TlsVersion10Enabled = checkTlsVersion10.Checked;
            settings.TlsVersion11Enabled = checkTlsVersion11.Checked;
            settings.TlsVersion12Enabled = checkTlsVersion12.Checked;
            settings.TlsVersion13Enabled = checkTlsVersion13.Checked;

            settings.TlsOptionPreferServerCiphersEnabled = checkTlsOptionPreferServerCiphers.Checked;
            settings.TlsOptionPrioritizeChaChaEnabled    = checkTlsOptionPrioritizeChaCha.Enabled && checkTlsOptionPrioritizeChaCha.Checked;

            Marshal.ReleaseComObject(settings);

            if (restartRequired)
            {
                Utility.AskRestartServer();
            }

            DirtyChecker.SetClean(this);
            return(true);
        }
 private void EnableDisable()
 {
     btnOK.Enabled = DirtyChecker.IsDirty(this) && textName.Text.Length > 0;
     checkEnableRouteRecipients.Enabled = checkProcessMIMERecipients.Checked;
 }
Beispiel #8
0
        public bool SaveData()
        {
            if (_domain == null)
            {
                hMailServer.Domains domains = _application.Domains;
                _domain = domains.Add();
                Marshal.ReleaseComObject(domains);
            }

            _domain.Name                     = textDomainName.Text;
            _domain.Postmaster               = textCatchAllAddress.Text;
            _domain.AddSignaturesToReplies   = checkAddSignaturesToReplies.Checked;
            _domain.AddSignaturesToLocalMail = checkAddSignaturesToLocalMail.Checked;
            _domain.SignatureEnabled         = checkSignatureEnabled.Checked;
            _domain.Active                   = checkEnabled.Checked;

            if (radioSMAppendToAccountSignature.Checked == true)
            {
                _domain.SignatureMethod = eDomainSignatureMethod.eSMAppendToAccountSignature;
            }
            else if (radioSMOverwriteAccountSignature.Checked == true)
            {
                _domain.SignatureMethod = eDomainSignatureMethod.eSMOverwriteAccountSignature;
            }
            else if (radioSMSetIfNotSpecifiedInAccount.Checked == true)
            {
                _domain.SignatureMethod = eDomainSignatureMethod.eSMSetIfNotSpecifiedInAccount;
            }

            _domain.MaxSize                      = textMaxSize.Number;
            _domain.MaxMessageSize               = textMaxMessageSize.Number;
            _domain.MaxAccountSize               = textMaxAccountSize.Number;
            _domain.MaxNumberOfAccounts          = textMaxNumberOfAccounts.Number;
            _domain.MaxNumberOfAliases           = textMaxNumberOfAliases.Number;
            _domain.MaxNumberOfDistributionLists = textMaxNumberOfDistributionLists.Number;

            _domain.MaxNumberOfAccountsEnabled          = checkMaxNumberOfAccountsEnabled.Checked;
            _domain.MaxNumberOfAliasesEnabled           = checkMaxNumberOfAliasesEnabled.Checked;
            _domain.MaxNumberOfDistributionListsEnabled = checkMaxNumberOfDistributionListsEnabled.Checked;

            _domain.SignaturePlainText = textPlainTextSignature.Text;
            _domain.SignatureHTML      = textHTMLSignature.Text;

            _domain.PlusAddressingEnabled     = checkUsePlusAddressing.Checked;
            _domain.PlusAddressingCharacter   = comboPlusAddressingCharacter.Text;
            _domain.AntiSpamEnableGreylisting = checkGreyListingEnabled.Checked;

            _domain.DKIMSignEnabled    = checkDKIMSignEnabled.Checked;
            _domain.DKIMPrivateKeyFile = textDKIMPrivateKeyFile.Text;
            _domain.DKIMSelector       = textDKIMSelector.Text;

            if (radioDKIMHeaderMethodSimple.Checked)
            {
                _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple;
            }
            else if (radioDKIMHeaderMethodRelaxed.Checked)
            {
                _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed;
            }

            if (radioDKIMBodyMethodSimple.Checked)
            {
                _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple;
            }
            else if (radioDKIMBodyMethodRelaxed.Checked)
            {
                _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed;
            }

            if (radioDKIMSigningAlgorithmSHA1.Checked)
            {
                _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA1;
            }
            else if (radioDKIMSigningAlgorithmSHA256.Checked)
            {
                _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA256;
            }



            try
            {
                _domain.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Strings.Localize(ex.Message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            IMainForm mainForm = Instances.MainForm;

            // Refresh the node in the tree
            mainForm.RefreshCurrentNode(_domain.Name);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            SearchNodeText crit = new SearchNodeText(_domain.Name);

            mainForm.SelectNode(crit);

            EnableDisableTabs();

            return(true);
        }
Beispiel #9
0
        public bool SaveData()
        {
            bool newObject = false;

            if (_representedObject == null)
            {
                hMailServer.Application    app            = APICreator.Application;
                hMailServer.Settings       settings       = app.Settings;
                hMailServer.SecurityRanges securityRanges = settings.SecurityRanges;
                _representedObject = securityRanges.Add();

                newObject = true;

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(securityRanges);
            }

            _representedObject.Name     = textName.Text;
            _representedObject.Priority = textPriority.Number;

            _representedObject.LowerIP = textLowerIPAddress.Text;
            _representedObject.UpperIP = textUpperIPAddress.Text;

            _representedObject.AllowSMTPConnections = checkAllowSMTP.Checked;
            _representedObject.AllowPOP3Connections = checkAllowPOP3.Checked;
            _representedObject.AllowIMAPConnections = checkAllowIMAP.Checked;

            _representedObject.RequireSMTPAuthLocalToLocal       = checkRequireSMTPAuthLocalToLocal.Checked;
            _representedObject.RequireSMTPAuthLocalToExternal    = checkRequireSMTPAuthLocalToExternal.Checked;
            _representedObject.RequireSMTPAuthExternalToLocal    = checkRequireSMTPAuthExternalToLocal.Checked;
            _representedObject.RequireSMTPAuthExternalToExternal = checkRequireSMTPAuthExternalToExternal.Checked;

            _representedObject.AllowDeliveryFromLocalToLocal   = checkAllowDeliveiesFromL2L.Checked;
            _representedObject.AllowDeliveryFromLocalToRemote  = checkAllowDeliveiesFromL2R.Checked;
            _representedObject.AllowDeliveryFromRemoteToLocal  = checkAllowDeliveiesFromR2L.Checked;
            _representedObject.AllowDeliveryFromRemoteToRemote = checkAllowDeliveiesFromR2R.Checked;

            _representedObject.EnableSpamProtection = checkSpamProtection.Checked;
            _representedObject.EnableAntiVirus      = checkAntiVirus.Checked;

            _representedObject.Expires     = checkExpires.Checked;
            _representedObject.ExpiresTime = dateTimeExpiresTime.Value;

            try
            {
                _representedObject.Save();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }


            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(checkExpires.Checked ? Color.Red : Color.Black, textName.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(_representedObject.Name);
                mainForm.SelectNode(crit);
            }

            return(true);
        }
Beispiel #10
0
        public bool SaveData()
        {
            if (!ValidateForm())
            {
                return(false);
            }


            bool newAccount = false;

            if (_representedAccount == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.Accounts accounts = domain.Accounts;
                _representedAccount = accounts.Add();

                Marshal.ReleaseComObject(accounts);
                Marshal.ReleaseComObject(domain);
            }

            if (_representedAccount.ID == 0)
            {
                newAccount = true;
            }

            _representedAccount.Address = textAddress.Text;
            _representedAccount.MaxSize = textMaxSize.Number;
            _representedAccount.Active  = checkEnabled.Checked;

            _representedAccount.VacationMessageIsOn        = checkVacationMessageEnable.Checked;
            _representedAccount.VacationSubject            = textVacationMessageSubject.Text;
            _representedAccount.VacationMessage            = textVacationMessageText.Text;
            _representedAccount.VacationMessageExpires     = checkVacationMessageExpires.Checked;
            _representedAccount.VacationMessageExpiresDate = dateVacationMessageExpiresDate.FormattedValue;

            _representedAccount.ForwardEnabled      = checkForwardEnabled.Checked;
            _representedAccount.ForwardAddress      = textForwardAddress.Text;
            _representedAccount.ForwardKeepOriginal = checkForwardKeepOriginal.Checked;

            _representedAccount.SignatureEnabled   = checkSignatureEnabled.Checked;
            _representedAccount.SignaturePlainText = textSignaturePlainText.Text;
            _representedAccount.SignatureHTML      = textSignatureHTML.Text;

            _representedAccount.IsAD       = checkAccountIsAD.Checked;
            _representedAccount.ADDomain   = textADDomain.Text;
            _representedAccount.ADUsername = textADUsername.Text;

            _representedAccount.PersonFirstName = textFirstName.Text;
            _representedAccount.PersonLastName  = textLastName.Text;
            _representedAccount.AdminLevel      = (hMailServer.eAdminLevel)comboAdministrationLevel.SelectedValue;

            if (textPassword.Dirty)
            {
                _representedAccount.Password = textPassword.Password;
            }

            _representedAccount.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(_representedAccount.Address);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newAccount)
            {
                SearchNodeText crit = new SearchNodeText(_representedAccount.Address);
                mainForm.SelectNode(crit);
            }
            else
            {
                EnableDisable();
            }

            return(true);
        }
        public bool SaveData()
        {
            bool newObject = false;

            if (_representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.DistributionLists lists = domain.DistributionLists;
                _representedObject = lists.Add();
                newObject          = true;

                Marshal.ReleaseComObject(lists);
                Marshal.ReleaseComObject(domain);
            }

            _representedObject.Address = textAddress.Text;
            _representedObject.Active  = checkEnabled.Checked;

            if (radioModePublic.Checked)
            {
                _representedObject.Mode = eDistributionListMode.eLMPublic;
            }

            if (radioModeMembership.Checked)
            {
                _representedObject.Mode = eDistributionListMode.eLMMembership;
            }

            if (optModeAnnouncements.Checked)
            {
                _representedObject.Mode = eDistributionListMode.eLMAnnouncement;
            }

            if (radioModeDomainMembers.Checked)
            {
                _representedObject.Mode = eDistributionListMode.eLMDomainMembers;
            }

            _representedObject.RequireSenderAddress = textRequireAddress.Text;
            _representedObject.RequireSMTPAuth      = checkRequireSMTPAuthentication.Checked;

            _representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(textAddress.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(_representedObject.Address);
                mainForm.SelectNode(crit);
            }

            EnableDisableTabs();

            return(true);
        }