Beispiel #1
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 #2
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

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

            textNoOfRetries.Number             = settings.SMTPNoOfTries;
            textMinutesBetween.Number          = settings.SMTPMinutesBetweenTry;
            textHostName.Text                  = settings.HostName;
            textSMTPRelayer.Text               = settings.SMTPRelayer;
            textSMTPRelayerPort.Number         = settings.SMTPRelayerPort;
            chkSMTPRelayerRequiresAuth.Checked = settings.SMTPRelayerRequiresAuthentication;
            textSMTPRelayerUsername.Text       = settings.SMTPRelayerUsername;
            checkUseSSL.Checked                = settings.SMTPRelayerUseSSL;

            checkSendStatistics.Checked = settings.SendStatistics;

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

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

            EnableDisable();

            Marshal.ReleaseComObject(settings);
        }
Beispiel #3
0
        private void buttonDeleteBlockedAttachment_Click(object sender, EventArgs e)
        {
            if (!Utility.AskDeleteItems())
            {
                return;
            }

            hMailServer.Settings           settings          = APICreator.Settings;
            hMailServer.AntiVirus          antiVirusSettings = settings.AntiVirus;
            hMailServer.BlockedAttachments attachments       = antiVirusSettings.BlockedAttachments;

            List <ListViewItem> itemsToRemove = new List <ListViewItem>();

            foreach (ListViewItem item in listBlockedAttachments.SelectedItems)
            {
                int id = Convert.ToInt32(item.Tag);
                attachments.DeleteByDBID(id);
                itemsToRemove.Add(item);
            }

            foreach (ListViewItem item in itemsToRemove)
            {
                listBlockedAttachments.Items.Remove(item);
            }

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiVirusSettings);
            Marshal.ReleaseComObject(attachments);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;
            hMailServer.Cache    cache    = settings.Cache;

            checkEnabled.Checked = cache.Enabled;

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

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

            comboWorkerThreadPriority.SelectedValue = settings.WorkerThreadPriority;

            hMailServer.MessageIndexing indexing = settings.MessageIndexing;

            checkMessageIndexingEnabled.Checked = indexing.Enabled;

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

            EnableDisable();
        }
Beispiel #6
0
        public void LoadData()
        {
            hMailServer.Settings  settings          = APICreator.Application.Settings;
            hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus;

            radioDeleteEmail.Checked       = antiVirusSettings.Action == eAntivirusAction.hDeleteEmail;
            radioDeleteAttachments.Checked = antiVirusSettings.Action == eAntivirusAction.hDeleteAttachments;
            checkNotifySender.Checked      = antiVirusSettings.NotifySender;
            checkNotifyReceiver.Checked    = antiVirusSettings.NotifyReceiver;
            textVirusScanMaxSize.Number    = antiVirusSettings.MaximumMessageSize;

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

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

            checkBlockAttachmentsEnabled.Checked = antiVirusSettings.EnableAttachmentBlocking;

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

            ListBlockedAttachments();

            EnableDisable();

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(antiVirusSettings);
        }
Beispiel #7
0
        private void EditSelectedBlockedAttachment()
        {
            if (listBlockedAttachments.SelectedItems.Count < 0)
            {
                return;
            }

            int id = Convert.ToInt32(listBlockedAttachments.SelectedItems[0].Tag);

            hMailServer.Settings           settings          = APICreator.Settings;
            hMailServer.AntiVirus          antiVirusSettings = settings.AntiVirus;
            hMailServer.BlockedAttachments attachments       = antiVirusSettings.BlockedAttachments;
            hMailServer.BlockedAttachment  ba = attachments.get_ItemByDBID(id);

            formBlockedAttachment blockedDlg = new formBlockedAttachment();

            blockedDlg.LoadProperties(ba);

            if (blockedDlg.ShowDialog() == DialogResult.OK)
            {
                blockedDlg.SaveProperties(ba);
                ba.Save();
            }

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

            ListBlockedAttachments();
        }
        public void TestFixtureSetUp()
        {
            SingletonProvider<Utilities>.Instance.Authenticate();

             _application = SingletonProvider<Utilities>.Instance.GetApp();
             _settings = _application.Settings;
        }
Beispiel #9
0
        public void TestHierarchyDelimiterDelete()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.Settings settings = _settings;
            settings.IMAPHierarchyDelimiter = "\\";

            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "Test\\Test";

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(account.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            string listResponse = oSimulator.List();

            Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
            Assert.IsTrue(listResponse.Contains("\"Test\""));
            Assert.IsTrue(oSimulator.DeleteFolder("Test\\Test"));
            listResponse = oSimulator.List();
            Assert.IsFalse(listResponse.Contains("Test\\Test"));
            Assert.IsTrue(listResponse.Contains("Test"));
            oSimulator.Disconnect();
        }
Beispiel #10
0
        protected override void LoadList()
        {
            listObjects.Items.Clear();

            hMailServer.Application app      = APICreator.Application;
            hMailServer.Settings    settings = APICreator.Settings;

            hMailServer.IncomingRelays IncomingRelays = settings.IncomingRelays;

            for (int i = 0; i < IncomingRelays.Count; i++)
            {
                hMailServer.IncomingRelay IncomingRelay = IncomingRelays[i];

                ListViewItem item = listObjects.Items.Add(IncomingRelay.Name);
                item.SubItems.Add(IncomingRelay.LowerIP);
                item.SubItems.Add(IncomingRelay.UpperIP);
                item.Tag = IncomingRelay.ID;


                Marshal.ReleaseComObject(IncomingRelay);
            }

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(IncomingRelays);
        }
Beispiel #11
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 #12
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 #13
0
        public void TestSaveMessageInExistingIMAPFolder()
        {
            hMailServer.Settings settings = SingletonProvider <Utilities> .Instance.GetApp().Settings;

            hMailServer.Account oAccount1 = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            // Check that the message does not exist
            POP3Simulator.AssertMessageCount(oAccount1.Address, "test", 0);

            // Send a message to the account.
            hMailServer.IMAPFolder folder = oAccount1.IMAPFolders.get_ItemByName("INBOX");

            hMailServer.Message oMessage = folder.Messages.Add();

            Assert.AreEqual(0, oMessage.State);

            oMessage.Body    = "Välkommen till verkligheten";
            oMessage.Subject = "Hej";
            oMessage.Save();

            Assert.AreEqual(2, oMessage.State);
            Assert.IsFalse(oMessage.Filename.Contains(settings.PublicFolderDiskName));
            Assert.IsTrue(oMessage.Filename.Contains(_domain.Name));

            // Check that the message exists
            string message = POP3Simulator.AssertGetFirstMessageText(oAccount1.Address, "test");

            Assert.IsNotEmpty(message);
            Assert.Less(0, message.IndexOf("Hej"));
        }
Beispiel #14
0
        public void TestFixtureSetUp()
        {
            SingletonProvider <Utilities> .Instance.Authenticate();

            _application = SingletonProvider <Utilities> .Instance.GetApp();

            _settings = _application.Settings;
        }
Beispiel #15
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            textDefaultDomain.Text = settings.DefaultDomain;

            Marshal.ReleaseComObject(settings);
        }
Beispiel #16
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

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

            Marshal.ReleaseComObject(settings);
        }
Beispiel #17
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            textDefaultDomain.Text     = settings.DefaultDomain;
            checkIPv6Preferred.Checked = settings.IPv6PreferredEnabled;

            IsSupportIpv6();
            Marshal.ReleaseComObject(settings);
        }
Beispiel #18
0
        private hMailServer.Groups GetGroups()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            hMailServer.Groups groups = settings.Groups;

            Marshal.ReleaseComObject(settings);

            return(groups);
        }
Beispiel #19
0
        public void LoadData()
        {
            hMailServer.Application app = APICreator.Application;

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


            Marshal.ReleaseComObject(settings);
        }
Beispiel #20
0
        public void LoadData()
        {
            hMailServer.Application app = APICreator.Application;

            hMailServer.Settings settings = app.Settings;

            textSslCipherList.Text = settings.SslCipherList;

            Marshal.ReleaseComObject(settings);
        }
Beispiel #21
0
        private void buttonShowLogs_Click(object sender, EventArgs e)
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

            System.Diagnostics.ProcessStartInfo explorer = new System.Diagnostics.ProcessStartInfo();
            explorer.FileName  = "explorer.exe";
            explorer.Arguments = settings.Logging.Directory;
            System.Diagnostics.Process.Start(explorer);

            Marshal.ReleaseComObject(settings);
        }
Beispiel #22
0
        public void TestDomainAdminAccessSettings()
        {
            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelDomainAdmin;
            account.Save();

            hMailServer.Application newApplication = new hMailServer.Application();
            newApplication.Authenticate("*****@*****.**", "test");
            hMailServer.Settings settings = newApplication.Settings;
        }
Beispiel #23
0
        public void LoadData()
        {
            hMailServer.Application app = APICreator.Application;

            hMailServer.Settings settings = app.Settings;
            checkSMTP.Checked = settings.ServiceSMTP;
            checkPOP3.Checked = settings.ServicePOP3;
            checkIMAP.Checked = settings.ServiceIMAP;

            Marshal.ReleaseComObject(settings);
        }
Beispiel #24
0
        private hMailServer.DNSBlackLists GetDNSBlackLists()
        {
            hMailServer.Application   app           = APICreator.Application;
            hMailServer.Settings      settings      = app.Settings;
            hMailServer.AntiSpam      antiSpam      = settings.AntiSpam;
            hMailServer.DNSBlackLists dnsBlackLists = antiSpam.DNSBlackLists;

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

            return(dnsBlackLists);
        }
Beispiel #25
0
        private void buttonEditFolders_Click(object sender, EventArgs e)
        {
            hMailServer.Settings    settings      = APICreator.Application.Settings;
            hMailServer.IMAPFolders publicFolders = settings.PublicFolders;

            formAccountFolders accountFoldersDlg = new formAccountFolders(publicFolders, true);

            accountFoldersDlg.ShowDialog();

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(publicFolders);
        }
Beispiel #26
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 #27
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 #28
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 #29
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;

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

            EnableDisable();

            Marshal.ReleaseComObject(settings);
        }
Beispiel #30
0
        protected override void DeleteItems(List <ListViewItem> items)
        {
            hMailServer.Settings       settings       = APICreator.Settings;
            hMailServer.IncomingRelays IncomingRelays = settings.IncomingRelays;

            foreach (var item in items)
            {
                int id = Convert.ToInt32(item.Tag);
                IncomingRelays.DeleteByDBID(id);
            }

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(IncomingRelays);
        }
Beispiel #31
0
        public void LoadData()
        {
            hMailServer.Settings       settings       = APICreator.Application.Settings;
            hMailServer.BackupSettings backupSettings = settings.Backup;

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

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(backupSettings);
        }
Beispiel #32
0
        public void Authenticate()
        {
            hMailServer.Account account = application.Authenticate("Administrator", "testar");

             if (account == null)
            account = application.Authenticate("Administrator", "");

             if (account == null)
            Assert.Fail("hMailServer API authentication failed");

             _settings = application.Settings;
        }