public void TestEnabled() { hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp(); hMailServer.WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses; hMailServer.WhiteListAddress obAddress = obAddresses.Add(); obAddress.EmailAddress = "*****@*****.**"; obAddress.LowerIPAddress = "0.0.0.0"; obAddress.UpperIPAddress = "255.255.255.255"; obAddress.Description = "Test"; obAddress.Save(); // Enable SURBL. hMailServer.SURBLServer oSURBLServer = _antiSpam.SURBLServers[0]; oSURBLServer.Active = true; oSURBLServer.Score = 5; oSURBLServer.Save(); // Send a messages to this account. Assert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "SURBL-Match", "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-")); obAddresses.DeleteByDBID(obAddress.ID); // Check that it's detected as spam again. Assert.IsFalse(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "SURBL-Match", "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-")); POP3Simulator.AssertMessageCount("*****@*****.**", "test", 1); }
private void EditSelectedItem() { if (listWhiteAddresses.SelectedItems.Count != 1) { return; } int id = Convert.ToInt32(listWhiteAddresses.SelectedItems[0].Tag); hMailServer.WhiteListAddresses addresses = GetWhiteListAddresses(); hMailServer.WhiteListAddress address = addresses.get_ItemByDBID(id); formWhiteListAddress whiteDlg = new formWhiteListAddress(); whiteDlg.LoadProperties(address); if (whiteDlg.ShowDialog() == DialogResult.OK) { whiteDlg.SaveProperties(address); address.Save(); ListItems(); } Marshal.ReleaseComObject(address); Marshal.ReleaseComObject(addresses); }
private void SetupWhiteList() { hMailServer.WhiteListAddresses addresses = _application.Settings.AntiSpam.WhiteListAddresses; hMailServer.WhiteListAddress address = addresses.Add(); address.Description = "Desc1"; address.EmailAddress = "Email1"; address.LowerIPAddress = "1.1.1.1"; address.UpperIPAddress = "2.2.2.2"; address.Save(); address = addresses.Add(); address.Description = "Desc2"; address.EmailAddress = "Email2"; address.LowerIPAddress = "2.2.2.2"; address.UpperIPAddress = "21.21.21.21"; address.Save(); }
public void TestWhiteListAddress() { hMailServer.Settings oSettings = SingletonProvider <Utilities> .Instance.GetApp().Settings; hMailServer.WhiteListAddress whiteAddress = oSettings.AntiSpam.WhiteListAddresses.Add(); whiteAddress.Description = "My description of this entry"; whiteAddress.EmailAddress = "*****@*****.**"; whiteAddress.Save(); if (whiteAddress.ID == 0) { throw new Exception("White list address not saved properly"); } oSettings.AntiSpam.WhiteListAddresses.DeleteByDBID(whiteAddress.ID); }
public void TestWhiteList() { // First white-list the sender address hMailServer.WhiteListAddress address = _settings.AntiSpam.WhiteListAddresses.Add(); address.Description = "TestWhiteList"; address.EmailAddress = "*****@*****.**"; address.LowerIPAddress = "0.0.0.0"; address.UpperIPAddress = "255.255.255.255"; address.Save(); // Send a messages to this account. SMTPClientSimulator oSMTP = new SMTPClientSimulator(); oSMTP.Send("*****@*****.**", account.Address, "SA test", "This is a test message with spam.\r\n XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X."); string sMessageContents = POP3Simulator.AssertGetFirstMessageText(account.Address, "test"); Assert.IsFalse(sMessageContents.Contains("X-Spam-Status: Yes")); }
private void buttonAddWhiteAddress_Click(object sender, EventArgs e) { formWhiteListAddress whiteDlg = new formWhiteListAddress(); if (whiteDlg.ShowDialog() == DialogResult.OK) { hMailServer.AntiSpam antiSpam = APICreator.AntiSpamSettings; hMailServer.WhiteListAddresses addresses = antiSpam.WhiteListAddresses; hMailServer.WhiteListAddress address = addresses.Add(); whiteDlg.SaveProperties(address); address.Save(); Marshal.ReleaseComObject(antiSpam); Marshal.ReleaseComObject(addresses); Marshal.ReleaseComObject(address); ListItems(); } }