Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #4
0
        private void DeleteEnvironment()
        {
            while (_application.Domains.Count > 0)
            {
                _application.Domains[0].Delete();
            }

            WhiteListAddresses addresses = _application.Settings.AntiSpam.WhiteListAddresses;

            while (addresses.Count > 0)
            {
                addresses[0].Delete();
            }

            Routes routes = _application.Settings.Routes;

            while (routes.Count > 0)
            {
                routes[0].Delete();
            }

            BlockedAttachments attachments = _application.Settings.AntiVirus.BlockedAttachments;

            while (attachments.Count > 0)
            {
                attachments[0].Delete();
            }

            DNSBlackLists blackLists = _application.Settings.AntiSpam.DNSBlackLists;

            while (blackLists.Count > 0)
            {
                blackLists[0].Delete();
            }

            SURBLServers surblServers = _application.Settings.AntiSpam.SURBLServers;

            while (surblServers.Count > 0)
            {
                surblServers[0].Delete();
            }

            SSLCertificates sslCertificates = _application.Settings.SSLCertificates;

            while (sslCertificates.Count > 0)
            {
                sslCertificates[0].Delete();
            }

            IncomingRelays incomingRelays = _application.Settings.IncomingRelays;

            while (incomingRelays.Count > 0)
            {
                incomingRelays[0].Delete();
            }
        }
Example #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);
        }
Example #6
0
        private void ConfirmWhiteList()
        {
            WhiteListAddresses addresses = _application.Settings.AntiSpam.WhiteListAddresses;

            Assert.AreEqual(2, addresses.Count);

            WhiteListAddress address = addresses[0];

            Assert.AreEqual("Desc1", address.Description);
            Assert.AreEqual("Email1", address.EmailAddress);
            Assert.AreEqual("1.1.1.1", address.LowerIPAddress);
            Assert.AreEqual("2.2.2.2", address.UpperIPAddress);

            address = addresses[1];
            Assert.AreEqual("Desc2", address.Description);
            Assert.AreEqual("Email2", address.EmailAddress);
            Assert.AreEqual("2.2.2.2", address.LowerIPAddress);
            Assert.AreEqual("21.21.21.21", address.UpperIPAddress);
        }
Example #7
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();
        }
Example #8
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);
        }