public void TestDomainAdminAccessOtherDomain() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelDomainAdmin; account.Save(); SingletonProvider <Utilities> .Instance.AddDomain("example.com"); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); Assert.AreEqual(1, newApplication.Domains.Count); hMailServer.Domains domains = SingletonProvider <Utilities> .Instance.GetApp().Domains; Assert.AreEqual(2, domains.Count); try { hMailServer.Domain secondDomain = newApplication.Domains.get_ItemByName("example.com"); Assert.Fail(); } catch (COMException ex) { Assert.IsTrue(ex.Message.Contains("Invalid index.")); } }
private void bt_connect_Click(object sender, EventArgs e) { var oApp = new hMailServer.Application(); if (oApp.Authenticate(ed_usr.Text, ed_pwd.Text) == null) { MessageBox.Show(@"Username / Password Wrong", @"Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { var i = oApp.Database.ExecuteSQLWithReturn(sql_pad.Text); if (i != 0) { return; } lb_status.Text = @"Query excuted without Errors [OK]"; lb_status.Visible = true; } catch (Exception err) { lb_status.Text = @"Warning: Query caused a Problem [ERROR]"; lb_status.Visible = true; MessageBox.Show(err.ToString(), @"SQL-Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public void TestNormalUserAccessOtherAccount() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; account.Save(); hMailServer.Account secondAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); secondAccount.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; secondAccount.Save(); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); Assert.AreEqual(1, newApplication.Domains.Count); Assert.AreEqual(1, newApplication.Domains[0].Accounts.Count); hMailServer.Account myAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("*****@*****.**"); try { hMailServer.Account otherAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("*****@*****.**"); Assert.Fail(); } catch (COMException ex) { Assert.IsTrue(ex.Message.Contains("Invalid index.")); } hMailServer.Domains domains = SingletonProvider <Utilities> .Instance.GetApp().Domains; Assert.AreEqual(2, domains[0].Accounts.Count); }
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; }
public void TestDomainAdminAccessOtherDomain() { hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelDomainAdmin; account.Save(); SingletonProvider<Utilities>.Instance.AddDomain("example.com"); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); Assert.AreEqual(1, newApplication.Domains.Count); hMailServer.Domains domains = SingletonProvider<Utilities>.Instance.GetApp().Domains; Assert.AreEqual(2, domains.Count); try { hMailServer.Domain secondDomain = newApplication.Domains.get_ItemByName("example.com"); Assert.Fail(); } catch (COMException ex) { Assert.IsTrue(ex.Message.Contains("Invalid index.")); } }
public static List <string> GetOrphanedEmail(Config config, TeknikEntities db) { List <string> foundEmail = new List <string>(); if (config.EmailConfig.Enabled) { List <User> curUsers = db.Users.ToList(); // Connect to hmailserver COM var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var accounts = domain.Accounts; for (int i = 0; i < accounts.Count; i++) { var account = accounts[i]; bool userExists = curUsers.Exists(u => UserHelper.GetUserEmailAddress(config, u.Username) == account.Address); bool isReserved = UserHelper.GetReservedUsernames(config).Exists(r => UserHelper.GetUserEmailAddress(config, r).ToLower() == account.Address.ToLower()); if (!userExists && !isReserved) { foundEmail.Add(account.Address); } } } return(foundEmail); }
private hMailServer.Application GetApp() { hMailServer.Application application = new hMailServer.Application(); hMailServer.Account account = application.Authenticate("Administrator", ""); if (account != null) return application; account = application.Authenticate("Administrator", "testar"); if (account != null) return application; MessageBox.Show("Authentication failed", "Database password"); return null; }
private hMailServer.Application InitApp() { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(_Username, _Password); return(app); }
public void TestDomainAdminAccessBackupManager() { 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.BackupManager backupManager = newApplication.BackupManager; }
public IAccount Authenticate(string Username, string Password) { hMailServer.Account a = _object.Authenticate(Username, Password); if (a != null) { Authed = true; return(new Account(a)); } return(null); }
public void TestDomainAdminAccessBackupManager() { 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.BackupManager backupManager = newApplication.BackupManager; }
public void TestNormalUserAccessSettings() { hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; account.Save(); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); hMailServer.Settings settings = newApplication.Settings; }
public void TestDomainAdminAccessDatabase() { 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.Database database = newApplication.Database; database.ExecuteSQL("select"); }
public static bool AuthenticateUser(hMailServer.Application application, string password) { hMailServer.Account account = application.Authenticate("Administrator", password); if (account != null) { return(true); } return(false); }
public void TestDomainAdminAccessDatabase() { 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.Database database = newApplication.Database; database.ExecuteSQL("select"); }
private hMailServer.Application GetApp() { hMailServer.Application application = new hMailServer.Application(); hMailServer.Account account = application.Authenticate("Administrator", ""); if (account != null) { return(application); } account = application.Authenticate("Administrator", "testar"); if (account != null) { return(application); } MessageBox.Show("Authentication failed", "Database password"); return(null); }
public void NormalUserShouldNotBeAbleToAddDomain() { hMailServer.Domain domain = SingletonProvider <Utilities> .Instance.AddTestDomain(); // Create an account with normal privileges. hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(domain, "*****@*****.**", "test"); hMailServer.Application newApp = new hMailServer.Application(); hMailServer.Account authenticated = newApp.Authenticate(account.Address, "test"); Assert.IsNotNull(authenticated); // This should throw an exception. hMailServer.Domain newDomain = newApp.Domains.Add(); }
public void NormalUserShouldNotBeAbleToAddDomain() { hMailServer.Domain domain = SingletonProvider<Utilities>.Instance.AddTestDomain(); // Create an account with normal privileges. hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(domain, "*****@*****.**", "test"); hMailServer.Application newApp = new hMailServer.Application(); hMailServer.Account authenticated = newApp.Authenticate(account.Address, "test"); Assert.IsNotNull(authenticated); // This should throw an exception. hMailServer.Domain newDomain = newApp.Domains.Add(); }
public void Run() { hMailServer.Application applicaiton = new hMailServer.Application(); applicaiton.Authenticate("Administrator", "testar"); // Run DNS query tests. TestDNSQueries test = new TestDNSQueries(applicaiton); test.Prepare(); int iMemoryUsageBefore = Utilities.GetMemoryUsage(); test.Run(); int iMemoryUsageAfter = Utilities.GetMemoryUsage(); int iBytesDiff = iMemoryUsageAfter - iMemoryUsageBefore; if (iBytesDiff > test.MaxIncrease) throw new Exception("Memory leak found: " + iBytesDiff.ToString() + " bytes leaked"); }
private bool IsAuthHMail(hMailServer.Application hApp) { string hAdministrator = txtHAdmin.Text; string hPassword = txtHPassword.Text; hMailServer.Account authenticated = hApp.Authenticate(hAdministrator, hPassword); if (authenticated != null) { return(true); } txtLog.AppendText("hAdministrator или hPassword неправильный!" + Environment.NewLine); return(false); }
public void DomainAdminShouldBeAbleToSaveDomain() { hMailServer.Domain domain = SingletonProvider<Utilities>.Instance.AddTestDomain(); // Create an account with normal privileges. hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelDomainAdmin; account.Save(); hMailServer.Application newApp = new hMailServer.Application(); hMailServer.Account authenticated = newApp.Authenticate(account.Address, "test"); Assert.IsNotNull(authenticated); Assert.AreEqual(1, newApp.Domains.Count); // Retrieve our domain. hMailServer.Domain newDomain = newApp.Domains[0]; newDomain.Save(); }
public void BlowfishEncryptShouldNotRequireAdminPrivileges() { hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); hMailServer.Application newApp = new hMailServer.Application(); Assert.IsNotNull(newApp.Authenticate(account.Address, "test")); hMailServer.Utilities utilities = newApp.Utilities; string encryptedResult = utilities.BlowfishEncrypt("Test"); Assert.AreNotEqual("Test", encryptedResult, encryptedResult); string decrypted = utilities.BlowfishDecrypt(encryptedResult); Assert.AreEqual("Test", decrypted, decrypted); }
public void Run() { hMailServer.Application applicaiton = new hMailServer.Application(); applicaiton.Authenticate("Administrator", "testar"); // Run DNS query tests. TestDNSQueries test = new TestDNSQueries(applicaiton); test.Prepare(); int iMemoryUsageBefore = Utilities.GetMemoryUsage(); test.Run(); int iMemoryUsageAfter = Utilities.GetMemoryUsage(); int iBytesDiff = iMemoryUsageAfter - iMemoryUsageBefore; if (iBytesDiff > test.MaxIncrease) { throw new Exception("Memory leak found: " + iBytesDiff.ToString() + " bytes leaked"); } }
public void UserShouldNotBeAbleToSaveDomain() { hMailServer.Domain domain = SingletonProvider <Utilities> .Instance.AddTestDomain(); // Create an account with normal privileges. hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; account.Save(); hMailServer.Application newApp = new hMailServer.Application(); hMailServer.Account authenticated = newApp.Authenticate(account.Address, "test"); Assert.IsNotNull(authenticated); Assert.AreEqual(1, newApp.Domains.Count); // Retrieve our domain. hMailServer.Domain newDomain = newApp.Domains[0]; newDomain.Save(); }
public static List<string> GetInactiveAccounts(Config config, TeknikEntities db, int maxDays) { List<string> foundUsers = new List<string>(); List<User> curUsers = db.Users.ToList(); foreach (User user in curUsers) { // If the username is reserved, don't worry about it if (UserHelper.UsernameReserved(config, user.Username)) { continue; } #region Inactivity Finding DateTime lastActivity = UserHelper.GetLastAccountActivity(db, config, user); TimeSpan inactiveTime = DateTime.Now.Subtract(lastActivity); // If older than max days, check their current usage if (inactiveTime >= new TimeSpan(maxDays, 0, 0, 0, 0)) { // Check the user's usage of the service. bool noData = true; // Any blog comments? var blogCom = db.BlogComments.Where(c => c.UserId == user.UserId); noData &= !(blogCom != null && blogCom.Any()); // Any blog posts? var blogPosts = db.BlogPosts.Where(p => p.Blog.UserId == user.UserId); noData &= !(blogPosts != null && blogPosts.Any()); // Any podcast comments? var podCom = db.PodcastComments.Where(p => p.UserId == user.UserId); noData &= !(podCom != null && podCom.Any()); // Any email? if (config.EmailConfig.Enabled) { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); try { var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[UserHelper.GetUserEmailAddress(config, user.Username)]; noData &= ((account.Messages.Count == 0) && ((int)account.Size == 0)); } catch { } } // Any git repos? if (config.GitConfig.Enabled) { string email = UserHelper.GetUserEmailAddress(config, user.Username); // We need to check the actual git database MysqlDatabase mySQL = new MysqlDatabase(config.GitConfig.Database); string sql = @"SELECT * FROM gogs.repository LEFT JOIN gogs.action ON gogs.user.id = gogs.action.act_user_id WHERE gogs.user.login_name = {0}"; var results = mySQL.Query(sql, new object[] { email }); noData &= !(results != null && results.Any()); } if (noData) { // They have no data, so safe to delete them. foundUsers.Add(user.Username); } continue; } #endregion } return foundUsers; }
public static bool Authenticate(hMailServer.Application app, Settings.Server server) { string password = server.encryptedPassword; if (password.Length > 0) { password = Encryption.Decrypt(password); } bool wrongPassword = false; while (true) { if (!server.savePassword || wrongPassword) { // The user must input the password. formEnterPassword dlg = new formEnterPassword(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { return(false); } password = dlg.Password; } try { hMailServer.Account account = app.Authenticate(server.userName, password); if (account == null) { // Wrong password, try again. MessageBox.Show("The specified user name or password is incorrect.", EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK); wrongPassword = true; } else { try { if (account.AdminLevel != eAdminLevel.hAdminLevelServerAdmin) { // Wrong password, try again. MessageBox.Show("hMailServer server administration rights are required to run hMailServer Administrator.", EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } return(true); } finally { Marshal.ReleaseComObject(account); } } } catch (Exception e) { // Wrong password, try again. MessageBox.Show("The specified user name or password is incorrect." + Environment.NewLine + e.Message, EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK); wrongPassword = true; } } }
public static bool UserEmailExists(Config config, string email) { // If Email Server is enabled if (config.EmailConfig.Enabled) { // Connect to hmailserver COM var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); try { var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[email]; // We didn't error out, so the email exists return true; } catch { } } return false; }
public static DateTime UserEmailLastActive(Config config, string email) { DateTime lastActive = new DateTime(1900, 1, 1); if (config.EmailConfig.Enabled) { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); try { var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[email]; DateTime lastEmail = (DateTime)account.LastLogonTime; if (lastActive < lastEmail) lastActive = lastEmail; } catch { } } return lastActive; }
public static void AddUserEmail(Config config, string email, string password) { try { // If Email Server is enabled if (config.EmailConfig.Enabled) { // Connect to hmailserver COM var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var newAccount = domain.Accounts.Add(); newAccount.Address = email; newAccount.Password = password; newAccount.Active = true; newAccount.MaxSize = config.EmailConfig.MaxSize; newAccount.Save(); } } catch (Exception ex) { throw new Exception("Unable to add email.", ex); } }
public static List <string> GetInactiveAccounts(Config config, TeknikEntities db, int maxDays) { List <string> foundUsers = new List <string>(); List <User> curUsers = db.Users.ToList(); foreach (User user in curUsers) { // If the username is reserved, don't worry about it if (UserHelper.UsernameReserved(config, user.Username) || user.Username == Constants.SERVERUSER) { continue; } // If they are Premium, don't worry about it either if (user.AccountType == AccountType.Premium && user.AccountStatus != AccountStatus.Banned) { continue; } #region Inactivity Finding DateTime lastActivity = DateTime.Now; try { lastActivity = UserHelper.GetLastAccountActivity(db, config, user); } catch { continue; } TimeSpan inactiveTime = DateTime.Now.Subtract(lastActivity); // If older than max days, check their current usage if (inactiveTime >= new TimeSpan(maxDays, 0, 0, 0, 0)) { // Check the user's usage of the service. bool noData = true; // Any blog comments? var blogCom = db.BlogComments.Where(c => c.UserId == user.UserId); noData &= !(blogCom != null && blogCom.Any()); // Any blog posts? var blogPosts = db.BlogPosts.Where(p => p.Blog.UserId == user.UserId); noData &= !(blogPosts != null && blogPosts.Any()); // Any podcast comments? var podCom = db.PodcastComments.Where(p => p.UserId == user.UserId); noData &= !(podCom != null && podCom.Any()); // Any email? if (config.EmailConfig.Enabled && UserHelper.UserEmailExists(config, UserHelper.GetUserEmailAddress(config, user.Username))) { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); try { var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[UserHelper.GetUserEmailAddress(config, user.Username)]; noData &= ((account.Messages.Count == 0) && ((int)account.Size == 0)); } catch { } } // Any git repos? if (config.GitConfig.Enabled && UserHelper.UserGitExists(config, user.Username)) { string email = UserHelper.GetUserEmailAddress(config, user.Username); // We need to check the actual git database MysqlDatabase mySQL = new MysqlDatabase(config.GitConfig.Database.Server, config.GitConfig.Database.Database, config.GitConfig.Database.Username, config.GitConfig.Database.Password, config.GitConfig.Database.Port); string sql = @"SELECT * FROM gogs.repository LEFT JOIN gogs.action ON gogs.user.id = gogs.action.act_user_id WHERE gogs.user.login_name = {0}"; var results = mySQL.Query(sql, new object[] { email }); noData &= !(results != null && results.Any()); } if (noData) { // They have no data, so safe to delete them. foundUsers.Add(user.Username); } continue; } #endregion } return(foundUsers); }
public void TestNormalUserAccessOtherAccount() { hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; account.Save(); hMailServer.Account secondAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test"); secondAccount.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; secondAccount.Save(); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); Assert.AreEqual(1, newApplication.Domains.Count); Assert.AreEqual(1, newApplication.Domains[0].Accounts.Count); hMailServer.Account myAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("*****@*****.**"); try { hMailServer.Account otherAccount = newApplication.Domains[0].Accounts.get_ItemByAddress("*****@*****.**"); Assert.Fail(); } catch (COMException ex) { Assert.IsTrue(ex.Message.Contains("Invalid index.")); } hMailServer.Domains domains = SingletonProvider<Utilities>.Instance.GetApp().Domains; Assert.AreEqual(2, domains[0].Accounts.Count); }
public static List<string> GetOrphanedEmail(Config config, TeknikEntities db) { List<string> foundEmail = new List<string>(); if (config.EmailConfig.Enabled) { List<User> curUsers = db.Users.ToList(); // Connect to hmailserver COM var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var accounts = domain.Accounts; for (int i = 0; i < accounts.Count; i++) { var account = accounts[i]; bool userExists = curUsers.Exists(u => UserHelper.GetUserEmailAddress(config, u.Username) == account.Address); bool isReserved = UserHelper.GetReservedUsernames(config).Exists(r => UserHelper.GetUserEmailAddress(config, r).ToLower() == account.Address.ToLower()); if (!userExists && !isReserved) { foundEmail.Add(account.Address); } } } return foundEmail; }
public static void EditUserEmailPassword(Config config, string email, string password) { try { // If Email Server is enabled if (config.EmailConfig.Enabled) { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[email]; account.Password = password; account.Save(); } } catch (Exception ex) { throw new Exception("Unable to edit email account password.", ex); } }
public static void DeleteUserEmail(Config config, string email) { try { // If Email Server is enabled if (config.EmailConfig.Enabled) { var app = new hMailServer.Application(); app.Connect(); app.Authenticate(config.EmailConfig.Username, config.EmailConfig.Password); var domain = app.Domains.ItemByName[config.EmailConfig.Domain]; var account = domain.Accounts.ItemByAddress[email]; if (account != null) { account.Delete(); } } } catch (Exception ex) { throw new Exception("Unable to delete email account.", ex); } }
public void TestNormalUserAccessSettings() { hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test"); account.AdminLevel = hMailServer.eAdminLevel.hAdminLevelNormal; account.Save(); hMailServer.Application newApplication = new hMailServer.Application(); newApplication.Authenticate("*****@*****.**", "test"); hMailServer.Settings settings = newApplication.Settings; }