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); }
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); }
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); }
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); }
public void TestWhiteListAddress() { Settings oSettings = SingletonProvider <TestSetup> .Instance.GetApp().Settings; WhiteListAddress whiteAddress = oSettings.AntiSpam.WhiteListAddresses.Add(); whiteAddress.Description = "My description of this entry"; whiteAddress.EmailAddress = "*****@*****.**"; whiteAddress.Save(); if (whiteAddress.ID == 0) { throw new Exception("White list address not saved properly"); } oSettings.AntiSpam.WhiteListAddresses.DeleteByDBID(whiteAddress.ID); }
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); }
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(); }
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); }
public void TestWhiteList() { // First white-list the sender address WhiteListAddress address = _settings.AntiSpam.WhiteListAddresses.Add(); address.Description = "TestWhiteList"; address.EmailAddress = "*****@*****.**"; address.LowerIPAddress = "0.0.0.0"; address.UpperIPAddress = "255.255.255.255"; address.Save(); // Send a messages to this account. var oSMTP = new SMTPClientSimulator(); oSMTP.Send("*****@*****.**", account.Address, "SA test", "This is a test message with spam.\r\n XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X."); string sMessageContents = POP3ClientSimulator.AssertGetFirstMessageText(account.Address, "test"); CustomAssert.IsFalse(sMessageContents.Contains("X-Spam-Status: Yes")); }