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")); }
public void TestStrongPasswords() { hMailServer.Utilities utilities = _application.Utilities; // The password should not be a part of a user name. Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "testar")); // The password should be more than 4 characters long. Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "test")); // If the password is 6 characters or less, it should contain a number or special char Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "testar")); // Typically bad passwords... Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "secret")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "password")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "info")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "webmaster")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "admin")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "12345")); Assert.IsFalse(utilities.IsStrongPassword("*****@*****.**", "qwerty")); // Contains more than 6 characters - OK Assert.IsTrue(utilities.IsStrongPassword("*****@*****.**", "testarp")); // Contains more than 6 characters - OK Assert.IsTrue(utilities.IsStrongPassword("*****@*****.**", "test_")); }
public ucProgress() { InitializeComponent(); _application = Globals.GetApp(); _utilities = _application.Utilities; _domains = _application.Domains; _counter = 0; }
public void TestCriteriaMatching() { hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.Utilities utilities = app.Utilities; Assert.IsTrue(utilities.CriteriaMatch("Test", hMailServer.eRuleMatchType.eMTEquals, "Test")); Assert.IsFalse(utilities.CriteriaMatch("Testa", hMailServer.eRuleMatchType.eMTEquals, "Test")); Assert.IsTrue(utilities.CriteriaMatch("Test*", hMailServer.eRuleMatchType.eMTWildcard, "Testar!")); Assert.IsFalse(utilities.CriteriaMatch("Test*", hMailServer.eRuleMatchType.eMTWildcard, "Tesb")); }
public formRuleCriteria() { InitializeComponent(); _ruleCriteria = null; FillCombos(); new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); Strings.Localize(this); _utilities = APICreator.Application.Utilities; }
public formRuleCriteria(hMailServer.RuleCriteria ruleCriteria) { InitializeComponent(); _ruleCriteria = ruleCriteria; FillCombos(); LoadProperties(); new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); Strings.Localize(this); _utilities = APICreator.Application.Utilities; }
public void TestRetrieveMessageID() { hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.Utilities utilities = app.Utilities; // 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); hMailServer.Message message = account.IMAPFolders.get_ItemByName("INBOX").Messages[0]; Assert.AreEqual(message.ID, utilities.RetrieveMessageID(message.Filename)); Assert.AreEqual(0, utilities.RetrieveMessageID(@"C:\some\nonexistant\file")); }
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); }
private void buttonSend_Click(object sender, EventArgs e) { string wildcard = ""; if (radioToAllAccounts.Checked) { wildcard = "*"; } else if (radioSpecificDomain.Checked) { wildcard = "*@" + comboDomains.Text; } else if (radioMatchingWildcard.Checked) { wildcard = textWildcard.Text; } hMailServer.Utilities utilities = APICreator.Application.Utilities; utilities.EmailAllAccounts(wildcard, textFromAddress.Text, textFromName.Text, textSubject.Text, textBody.Text); }
public void TestCopyMessage() { hMailServer.Application app = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.Utilities utilities = app.Utilities; hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); // Create a new folder. hMailServer.IMAPFolder folder = account.IMAPFolders.get_ItemByName("INBOX"); folder.Save(); hMailServer.IMAPFolder someOtherFolder = account.IMAPFolders.Add("SomeOtherFolder"); for (int i = 0; i < 3; i++) { hMailServer.Message message = folder.Messages.Add(); message.set_Flag(hMailServer.eMessageFlag.eMFSeen, true); message.Save(); message.Copy(someOtherFolder.ID); } SMTPClientSimulator.StaticSend("*****@*****.**", account.Address, "Test", "Test"); // Copy back to inbox. for (int i = 0; i < 3; i++) { hMailServer.Message message = someOtherFolder.Messages[i]; message.Copy(folder.ID); } POP3Simulator.AssertMessageCount(account.Address, "test", 7); IMAPSimulator sim = new IMAPSimulator(); sim.ConnectAndLogon(account.Address, "test"); sim.SelectFolder("Inbox"); string response = sim.Fetch("1:7 UID"); string[] lines = Microsoft.VisualBasic.Strings.Split(response, Environment.NewLine, -1, Microsoft.VisualBasic.CompareMethod.Text); List <string> uids = new List <string>(); foreach (string line in lines) { int paraPos = line.IndexOf("("); int paraEndPos = line.IndexOf(")"); if (paraPos < 0 || paraEndPos < 0) { continue; } string paraContent = line.Substring(paraPos + 1, paraEndPos - paraPos - 1); if (!uids.Contains(paraContent)) { uids.Add(paraContent); } } Assert.AreEqual(7, uids.Count); // Make sure the UIDS are sorted properly by creating a copy, sort the copy // and then compare to original. List <string> copy = new List <string>(); copy.InsertRange(0, uids); copy.Sort(); Assert.AreEqual(copy, uids); }
public void OneTimeSetUp() { var application = SingletonProvider <TestSetup> .Instance.GetApp(); _utilities = application.Utilities; }
public void TestMD5Hashing() { hMailServer.Utilities utilities = _application.Utilities; string passwordHash = utilities.MD5("Password"); }
public TestDNSQueries(hMailServer.Application app) { application = app; utilities = app.Utilities; }