Ejemplo n.º 1
0
        public void TestEnabled()
        {
            WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;
            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.
            var oSURBLServer = _antiSpam.SURBLServers[0];

            oSURBLServer.Active = true;
            oSURBLServer.Score  = 5;
            oSURBLServer.Save();

            // Send a messages to this account.
            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.
            CustomAsserts.Throws <DeliveryFailedException>(() => SmtpClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "SURBL-Match",
                                                                                                "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));

            Pop3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 1);
        }
Ejemplo n.º 2
0
        public void TestWildcardStar()
        {
            WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;

            WhiteListAddress obAddress = obAddresses.Add();

            obAddress.EmailAddress   = "white*@microsoft.com";
            obAddress.LowerIPAddress = "0.0.0.0";
            obAddress.UpperIPAddress = "255.255.255.255";
            obAddress.Description    = "Test";
            obAddress.Save();

            // Enable SURBL.
            SURBLServer oSURBLServer = _antiSpam.SURBLServers[0];

            oSURBLServer.Active = true;
            oSURBLServer.Score  = 5;
            oSURBLServer.Save();

            // Send a messages to this account.
            CustomAssert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "SURBL-Match",
                                                               "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));
            CustomAssert.IsFalse(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "SURBL-Match",
                                                                "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));
            CustomAssert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**",
                                                               "SURBL-Match",
                                                               "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));
            CustomAssert.IsFalse(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**",
                                                                "SURBL-Match",
                                                                "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));

            POP3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 2);
        }
Ejemplo n.º 3
0
        public void TestWildcardSingleQuote()
        {
            WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;

            WhiteListAddress obAddress = obAddresses.Add();

            obAddress.EmailAddress   = "white'*****@*****.**";
            obAddress.LowerIPAddress = "0.0.0.0";
            obAddress.UpperIPAddress = "255.255.255.255";
            obAddress.Description    = "Test";
            obAddress.Save();

            // Enable SURBL.
            SURBLServer surblServer = _antiSpam.SURBLServers[0];

            surblServer.Active = true;
            surblServer.Score  = 5;
            surblServer.Save();

            // Send a messages to this account.
            SmtpClientSimulator.StaticSend("white'*****@*****.**", "*****@*****.**",
                                           "SURBL-Match",
                                           "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-");
            CustomAsserts.Throws <DeliveryFailedException>(() => SmtpClientSimulator.StaticSend("whitelist@micro_soft.com", "*****@*****.**",
                                                                                                "SURBL-Match",
                                                                                                "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));

            Pop3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 1);
        }
Ejemplo n.º 4
0
        private void SetupWhiteList()
        {
            WhiteListAddresses addresses = _application.Settings.AntiSpam.WhiteListAddresses;

            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();
        }
Ejemplo n.º 5
0
        public void TestFormatVariations()
        {
            WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;

            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);
        }
Ejemplo n.º 6
0
        public void TestHelo()
        {
            WhiteListAddresses obAddresses = _antiSpam.WhiteListAddresses;
            WhiteListAddress   obAddress   = obAddresses.Add();

            obAddress.EmailAddress   = "*****@*****.**";
            obAddress.LowerIPAddress = "0.0.0.0";
            obAddress.UpperIPAddress = "255.255.255.255";
            obAddress.Description    = "Test";
            obAddress.Save();

            // Test that we can send spam now.
            // Create a test account
            // Fetch the default domain

            _antiSpam.CheckHostInHelo      = true;
            _antiSpam.CheckHostInHeloScore = 125;

            // Enable SURBL.
            var oSURBLServer = _antiSpam.SURBLServers[0];

            oSURBLServer.Active = true;
            oSURBLServer.Score  = 5;
            oSURBLServer.Save();

            // Send a messages to this account.
            var smtpClientSimulator = new SmtpClientSimulator();

            smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "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 deteceted as spam again.
            CustomAsserts.Throws <DeliveryFailedException>(() => smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "SURBL-Match",
                                                                                          "This is a test message with a SURBL url: -> http://surbl-org-permanent-test-point.com/ <-"));

            Pop3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 1);
        }