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 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);
        }