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);
        }
示例#2
0
        private void buttonDeleteWhiteAddress_Click(object sender, EventArgs e)
        {
            if (!Utility.AskDeleteItems())
            {
                return;
            }

            hMailServer.WhiteListAddresses addresses = GetWhiteListAddresses();

            foreach (ListViewItem item in listWhiteAddresses.SelectedItems)
            {
                int id = Convert.ToInt32(item.Tag);
                addresses.DeleteByDBID(id);
            }

            Marshal.ReleaseComObject(addresses);

            ListItems();
        }