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);
        }
Esempio n. 2
0
        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 TestFormatVariations()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;

            hMailServer.WhiteListAddress obAddress = obAddresses.Add();

            string address = @"A%B/C\[email protected]";

            obAddress.EmailAddress = address;
            Assert.AreEqual(address, obAddress.EmailAddress);

            address = @"\%%%__\[email protected]";
            obAddress.EmailAddress = address;
            Assert.AreEqual(address, obAddress.EmailAddress);
        }
Esempio n. 4
0
        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();
            }
        }