Exemple #1
0
        public void TestLiveLog()
        {
            hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.Utilities utilities = app.Utilities;

            hMailServer.Logging logging = app.Settings.Logging;

            logging.EnableLiveLogging(true);

            // Add an account and send a message to it.
            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody");
            POP3Simulator.AssertMessageCount(account.Address, "test", 1);

            string liveLog = logging.LiveLog;

            Assert.IsTrue(liveLog.Length > 0, liveLog);

            SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody");
            POP3Simulator.AssertMessageCount(account.Address, "test", 2);

            logging.EnableLiveLogging(true);

            liveLog = logging.LiveLog;
            Assert.IsFalse(liveLog.Contains("SMTPDeliverer - Message"));
        }
Exemple #2
0
 private void DeleteCurrentLog()
 {
     hMailServer.Logging logging = _application.Settings.Logging;
     logging.LogDebug = true;
     if (File.Exists(logging.CurrentDefaultLog))
     {
         File.Delete(logging.CurrentDefaultLog);
     }
 }
Exemple #3
0
        public string AssertLiveLogContents()
        {
            hMailServer.Logging logging = _settings.Logging;
            for (int i = 0; i < 40; i++)
            {
                string contents = logging.LiveLog;
                if (contents.Length > 0)
                {
                    return(contents);
                }

                Thread.Sleep(100);
            }

            return("");
        }
Exemple #4
0
        private void EnableLogging(bool enable)
        {
            hMailServer.Logging logging = _settings.Logging;

            if (logging.AWStatsEnabled != enable)
            {
                logging.AWStatsEnabled = enable;
            }

            if (logging.Enabled != enable)
            {
                logging.Enabled = enable;
            }

            if (logging.LogApplication != enable)
            {
                logging.LogApplication = enable;
            }

            if (logging.LogDebug != enable)
            {
                logging.LogDebug = enable;
            }

            if (logging.LogIMAP != enable)
            {
                logging.LogIMAP = enable;
            }

            if (logging.LogPOP3 != enable)
            {
                logging.LogPOP3 = enable;
            }

            if (logging.LogSMTP != enable)
            {
                logging.LogSMTP = enable;
            }

            if (logging.LogTCPIP != enable)
            {
                logging.LogTCPIP = enable;
            }

            logging.KeepFilesOpen = false;
        }
Exemple #5
0
        public void LoadData()
        {
            _application = APICreator.Application;

            labelVersion.Text = string.Format("{0} ({1})", _application.Version, _application.VersionArchitecture);

            ShowStatistics();

            hMailServer.Database database = _application.Database;

            labelServerType.Text = InternalNames.GetDatabaseServerTypeName(database.DatabaseType);

            if (database.ServerName.Length > 0)
            {
                labelServerHost.Text = database.ServerName;
            }
            else
            {
                labelServerHost.Text = "-";
            }

            if (database.DatabaseName.Length > 0 && database.DatabaseType != eDBtype.hDBTypeMSSQLCE)
            {
                labelName.Text = database.DatabaseName;
            }
            else
            {
                labelName.Text = "-";
            }

            labelDBVersion.Text = database.CurrentVersion.ToString();

            Marshal.ReleaseComObject(database);

            hMailServer.Settings settings = _application.Settings;
            _logging = settings.Logging;
            Marshal.ReleaseComObject(settings);


            DisplayServerState();
            DisplayWarnings();
        }
Exemple #6
0
        public void LoadData()
        {
            hMailServer.Settings settings = APICreator.Application.Settings;
            hMailServer.Logging  logging  = settings.Logging;

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

            EnableDisable();

            Marshal.ReleaseComObject(settings);
            Marshal.ReleaseComObject(logging);
        }
Exemple #7
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);
        }
Exemple #8
0
        public void LoadData()
        {
            _application = APICreator.Application;

            labelVersion.Text = string.Format("{0} ({1})", _application.Version, _application.VersionArchitecture);

            ShowStatistics();

            hMailServer.Database database = _application.Database;

            labelServerType.Text = InternalNames.GetDatabaseServerTypeName(database.DatabaseType);

            if (database.ServerName.Length > 0)
                labelServerHost.Text = database.ServerName;
            else
                labelServerHost.Text = "-";

            if (database.DatabaseName.Length > 0 && database.DatabaseType != eDBtype.hDBTypeMSSQLCE)
                labelName.Text = database.DatabaseName;
            else
                labelName.Text = "-";

            labelDBVersion.Text = database.CurrentVersion.ToString();

            Marshal.ReleaseComObject(database);

            hMailServer.Settings settings = _application.Settings;
            _logging = settings.Logging;
            Marshal.ReleaseComObject(settings);

            DisplayServerState();
            DisplayWarnings();
        }