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

            hMailServer.Settings settings = app.Settings;

            bool restartRequired = textSslCipherList.Dirty || checkSslVersion30.Dirty || checkTlsVersion10.Dirty || checkTlsVersion11.Dirty || checkTlsVersion12.Dirty;

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

            settings.SslVersion30Enabled = checkSslVersion30.Checked;
            settings.TlsVersion10Enabled = checkTlsVersion10.Checked;
            settings.TlsVersion11Enabled = checkTlsVersion11.Checked;
            settings.TlsVersion12Enabled = checkTlsVersion12.Checked;

            Marshal.ReleaseComObject(settings);

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

            DirtyChecker.SetClean(this);
            return(true);
        }
Beispiel #2
0
        public bool SaveData()
        {
            if (_representedObject == null)
            {
                hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings;
                _representedObject = tcpIPPorts.Add();
                Marshal.ReleaseComObject(tcpIPPorts);
            }

            _representedObject.Address            = textIPAddress.Text;
            _representedObject.PortNumber         = textTCPIPPort.Number;
            _representedObject.ConnectionSecurity = (eConnectionSecurity)comboConnectionSecurity.SelectedValue;
            _representedObject.Protocol           = (hMailServer.eSessionType)comboProtocol.SelectedValue;

            if (comboSSLCertificate.SelectedValue == null)
            {
                _representedObject.SSLCertificateID = 0;
            }
            else
            {
                _representedObject.SSLCertificateID = (int)comboSSLCertificate.SelectedValue;
            }

            _representedObject.Save();

            DirtyChecker.SetClean(this);

            Utility.RefreshNode(InternalNames.GetPortName(_representedObject));

            Utility.AskRestartServer();

            return(true);
        }
Beispiel #3
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;

            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 #4
0
        public bool SaveData()
        {
            hMailServer.Settings        settings = APICreator.Application.Settings;
            hMailServer.Cache           cache    = settings.Cache;
            hMailServer.MessageIndexing indexing = settings.MessageIndexing;

            cache.Enabled = checkEnabled.Checked;

            cache.DomainCacheTTL           = textCacheDomainTTL.Number;
            cache.AccountCacheTTL          = textCacheAccountTTL.Number;
            cache.AliasCacheTTL            = textCacheAliasTTL.Number;
            cache.DistributionListCacheTTL = textCacheDistributionListTTL.Number;

            settings.TCPIPThreads           = textTCPIPThreads.Number;
            settings.MaxDeliveryThreads     = textDeliveryThreads.Number;
            settings.MaxAsynchronousThreads = textMaxAsynchronousThreads.Number;

            settings.WorkerThreadPriority = (int)comboWorkerThreadPriority.SelectedValue;

            indexing.Enabled = checkMessageIndexingEnabled.Checked;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(cache);
            Marshal.ReleaseComObject(indexing);

            return(true);
        }
Beispiel #5
0
        public bool SaveData()
        {
            hMailServer.Settings  settings          = APICreator.Application.Settings;
            hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus;

            antiVirusSettings.Action = radioDeleteEmail.Checked ? eAntivirusAction.hDeleteEmail : eAntivirusAction.hDeleteAttachments;

            antiVirusSettings.NotifySender       = checkNotifySender.Checked;
            antiVirusSettings.NotifyReceiver     = checkNotifyReceiver.Checked;
            antiVirusSettings.MaximumMessageSize = textVirusScanMaxSize.Number;

            antiVirusSettings.ClamWinEnabled    = checkUseClamWin.Checked;
            antiVirusSettings.ClamWinExecutable = textClamScanExecutable.Text;
            antiVirusSettings.ClamWinDBFolder   = textClamScanDatabase.Text;

            antiVirusSettings.CustomScannerEnabled     = checkUseCustomScanner.Checked;
            antiVirusSettings.CustomScannerExecutable  = textCustomScannerExecutable.Text;
            antiVirusSettings.CustomScannerReturnValue = textCustomScannerReturnValue.Number;

            antiVirusSettings.EnableAttachmentBlocking = checkBlockAttachmentsEnabled.Checked;

            antiVirusSettings.ClamAVHost    = textClamAVHostName.Text;
            antiVirusSettings.ClamAVPort    = textClamAVPort.Number;
            antiVirusSettings.ClamAVEnabled = checkClamAVEnabled.Checked;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiVirusSettings);

            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;
            }

            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);
        }
Beispiel #7
0
        public bool SaveData()
        {
            _scriptingSettings.Enabled  = checkEnabled.Checked;
            _scriptingSettings.Language = (string)comboLanguage.SelectedValue;

            DirtyChecker.SetClean(this);

            return(true);
        }
Beispiel #8
0
        public bool SaveData()
        {
            _representedObject.Text = textMessage.Text;

            _representedObject.Save();

            DirtyChecker.SetClean(this);

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

            hMailServer.Settings settings = app.Settings;
            settings.MirrorEMailAddress = textMirrorAddress.Text;

            Marshal.ReleaseComObject(settings);

            DirtyChecker.SetClean(this);
            return(true);
        }
Beispiel #10
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            settings.MaxPOP3Connections = textMaxPOP3Connections.Number;
            settings.WelcomePOP3        = textWelcomeMessage.Text;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);

            return(true);
        }
Beispiel #11
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;
            settings.ServiceSMTP = checkSMTP.Checked;
            settings.ServicePOP3 = checkPOP3.Checked;
            settings.ServiceIMAP = checkIMAP.Checked;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);

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

            hMailServer.Settings settings = app.Settings;

            settings.SslCipherList = textSslCipherList.Text;

            Marshal.ReleaseComObject(settings);

            Utility.AskRestartServer();

            DirtyChecker.SetClean(this);
            return(true);
        }
Beispiel #13
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            settings.AutoBanOnLogonFailure         = checkAutoBanOnLogonFailure.Checked;
            settings.MaxInvalidLogonAttempts       = textMaxInvalidLogonAttempts.Number;
            settings.MaxInvalidLogonAttemptsWithin = textMaxInvalidLogonAttemptsWithin.Number;
            settings.AutoBanMinutes = textAutoBanMinutes.Number;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);

            return(true);
        }
Beispiel #14
0
        public bool SaveData()
        {
            if (_representedObject == null)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.Routes   routes   = settings.Routes;
                _representedObject = routes.Add();

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

            _representedObject.DomainName     = textDomainName.Text;
            _representedObject.Description    = textDescription.Text;
            _representedObject.TargetSMTPHost = textTargetSMTPHost.Text;
            _representedObject.TargetSMTPPort = textTargetSMTPPort.Number;

            _representedObject.ConnectionSecurity = (eConnectionSecurity)comboConnectionSecurity.SelectedValue;

            _representedObject.TreatSenderAsLocalDomain    = radioTreatSenderAsLocalDomain.Checked;
            _representedObject.TreatRecipientAsLocalDomain = radioTreatRecipientAsLocalDomain.Checked;

            _representedObject.NumberOfTries     = textNumberOfTries.Number;
            _representedObject.MinutesBetweenTry = textNumberOfMinutesBetween.Number;

            _representedObject.RelayerRequiresAuth = checkServerRequiresAuth.Checked;
            _representedObject.RelayerAuthUsername = textUsername.Text;


            if (textPassword.Dirty)
            {
                _representedObject.SetRelayerAuthPassword(textPassword.Password);
            }

            _representedObject.AllAddresses = radioRouteForAll.Checked;

            _representedObject.Save();

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

            Utility.RefreshNode(_representedObject.DomainName);

            return(true);
        }
Beispiel #15
0
        public bool SaveData()
        {
            hMailServer.Settings       settings       = APICreator.Application.Settings;
            hMailServer.BackupSettings backupSettings = settings.Backup;

            backupSettings.Destination              = textDestination.Text;
            backupSettings.BackupSettings           = checkBackupSettings.Checked;
            backupSettings.BackupDomains            = checkBackupDomains.Checked;
            backupSettings.BackupMessages           = checkBackupMessages.Checked;
            backupSettings.CompressDestinationFiles = checkCompressFiles.Checked;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(backupSettings);

            return(true);
        }
Beispiel #16
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            settings.MaxSMTPConnections = textMaxSMTPConnections.Number;
            settings.WelcomeSMTP        = textWelcomeMessage.Text;
            settings.MaxMessageSize     = textMaxMessageSize.Number;

            settings.SMTPNoOfTries          = textNoOfRetries.Number;
            settings.SMTPMinutesBetweenTry  = textMinutesBetween.Number;
            settings.SMTPConnectionSecurity = chkSmtpDeliveryConnectionSecurity.Checked ? eConnectionSecurity.eCSSTARTTLSOptional : eConnectionSecurity.eCSNone;

            settings.HostName        = textHostName.Text;
            settings.SMTPRelayer     = textSMTPRelayer.Text;
            settings.SMTPRelayerPort = textSMTPRelayerPort.Number;
            settings.SMTPRelayerRequiresAuthentication = chkSMTPRelayerRequiresAuth.Checked;
            settings.SMTPRelayerUsername           = textSMTPRelayerUsername.Text;
            settings.SMTPRelayerConnectionSecurity = (eConnectionSecurity)comboConnectionSecurity.SelectedValue;

            if (textSMTPRelayerPassword.Dirty)
            {
                settings.SetSMTPRelayerPassword(textSMTPRelayerPassword.Password);
            }

            settings.SendStatistics = checkSendStatistics.Checked;

            settings.AllowSMTPAuthPlain         = checkAllowPlainTextAuthentication.Checked;
            settings.DenyMailFromNull           = !checkAllowMailFromNull.Checked;
            settings.AllowIncorrectLineEndings  = checkAllowIncorrectLineEndings.Checked;
            settings.DisconnectInvalidClients   = checkDisconnectInvalidClients.Checked;
            settings.MaxNumberOfInvalidCommands = textMaxNumberOfInvalidCommands.Number;

            settings.SMTPDeliveryBindToIP     = textBindToLocalIP.Text;
            settings.MaxSMTPRecipientsInBatch = textMaxSMTPRecipientsInBatch.Number;
            settings.AddDeliveredToHeader     = checkAddDeliveredToHeader.Checked;
            settings.RuleLoopLimit            = textRuleLoopLimit.Number;
            settings.MaxNumberOfMXHosts       = textMaxNumberOfMXHosts.Number;

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);

            return(true);
        }
Beispiel #17
0
        public bool SaveData()
        {
            if (_representedObject == null)
            {
                hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings;
                _representedObject = tcpIPPorts.Add();
                Marshal.ReleaseComObject(tcpIPPorts);
            }

            _representedObject.Address    = textIPAddress.Text;
            _representedObject.PortNumber = textTCPIPPort.Number;
            _representedObject.UseSSL     = checkEnableSSL.Checked;
            _representedObject.Protocol   = (hMailServer.eSessionType)comboProtocol.SelectedValue;

            if (comboSSLCertificate.SelectedValue == null)
            {
                _representedObject.SSLCertificateID = 0;
            }
            else
            {
                _representedObject.SSLCertificateID = (int)comboSSLCertificate.SelectedValue;
            }

            _representedObject.Save();

            DirtyChecker.SetClean(this);

            Utility.RefreshNode(InternalNames.GetPortName(_representedObject));

            if (MessageBox.Show(Strings.Localize("hMailServer needs to be restarted for the changes to take effect.") + Environment.NewLine +
                                Strings.Localize("Do you want to restart hMailServer now?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (new WaitCursor())
                {
                    hMailServer.Application application = APICreator.Application;
                    application.Stop();
                    application.Start();

                    MessageBox.Show(Strings.Localize("The hMailServer server has been restarted."), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

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

            if (_representedObject == null)
            {
                hMailServer.Settings      settings      = APICreator.Application.Settings;
                hMailServer.AntiSpam      antiSpam      = settings.AntiSpam;
                hMailServer.DNSBlackLists dnsBlackLists = antiSpam.DNSBlackLists;

                _representedObject = dnsBlackLists.Add();
                newObject          = true;

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

            _representedObject.Active = checkEnabled.Checked;

            _representedObject.DNSHost        = textDNSHost.Text;
            _representedObject.ExpectedResult = textExpectedResult.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(_representedObject.DNSHost);

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

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

            return(true);
        }
Beispiel #19
0
        public bool SaveData()
        {
            hMailServer.Settings settings         = APICreator.Application.Settings;
            hMailServer.AntiSpam antiSpamSettings = settings.AntiSpam;

            antiSpamSettings.GreyListingEnabled            = checkEnable.Checked;
            antiSpamSettings.GreyListingInitialDelay       = textGreyListingInitialDelay.Number;
            antiSpamSettings.GreyListingInitialDelete      = textGreyListingInitialDelete.Number * 24;
            antiSpamSettings.GreyListingFinalDelete        = textGreyListingFinalDelete.Number * 24;
            antiSpamSettings.BypassGreylistingOnMailFromMX = checkBypassGreyListingOnMailFromMX.Checked;
            antiSpamSettings.BypassGreylistingOnSPFSuccess = checkBypassGreylistingOnSPFSuccess.Checked;

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiSpamSettings);

            DirtyChecker.SetClean(this);

            return(true);
        }
Beispiel #20
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            settings.DefaultDomain = textDefaultDomain.Text;

            if (textAdministratorPassword.Dirty)
            {
                string newPassword = textAdministratorPassword.Text;

                settings.SetAdministratorPassword(newPassword);
            }

            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);

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

            if (_representedObject == null)
            {
                hMailServer.Settings        settings        = APICreator.Application.Settings;
                hMailServer.SSLCertificates sslCertificates = settings.SSLCertificates;

                _representedObject = sslCertificates.Add();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(sslCertificates);

                newObject = true;
            }

            _representedObject.Name = textName.Text;

            _representedObject.CertificateFile = textCertificateFile.Text;
            _representedObject.PrivateKeyFile  = textPrivateKeyFile.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);
            }

            return(true);
        }
Beispiel #22
0
        public bool SaveData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;
            hMailServer.Logging  logging  = settings.Logging;

            logging.Enabled        = checkEnableLogging.Checked;
            logging.LogApplication = chkLogApplication.Checked;
            logging.LogSMTP        = checkLogSMTP.Checked;
            logging.LogPOP3        = checkLogPOP3.Checked;
            logging.LogIMAP        = checkLogIMAP.Checked;
            logging.LogTCPIP       = checkLogTCPIP.Checked;
            logging.LogDebug       = checkLogDebug.Checked;
            logging.AWStatsEnabled = checkLogAWStats.Checked;
            logging.KeepFilesOpen  = checkKeepFilesOpen.Checked;
            DirtyChecker.SetClean(this);

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(logging);

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

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

                newObject = true;

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

            _representedObject.Name = textName.Text;

            _representedObject.LowerIP = textLower.Text;
            _representedObject.UpperIP = textUpper.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);
            }

            return(true);
        }
Beispiel #24
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.CheckPTR             = chkCheckPTR.Checked;
            antiSpam.CheckPTRScore        = textCheckPTRScore.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 #25
0
        public bool SaveData()
        {
            bool newObject = false;

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

                hMailServer.Aliases aliases = domain.Aliases;
                representedObject = aliases.Add();
                newObject         = true;

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


            representedObject.Name   = textName.Text;
            representedObject.Value  = textValue.Text;
            representedObject.Active = checkEnabled.Checked;

            representedObject.Save();

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

            mainForm.RefreshCurrentNode(representedObject.Name);

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

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

            return(true);
        }
Beispiel #26
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 #27
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 #28
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);
        }
Beispiel #29
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 #30
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);
        }