Example #1
0
        private void SetupGreyListingWhiteList()
        {
            hMailServer.GreyListingWhiteAddresses addresses = _application.Settings.AntiSpam.GreyListingWhiteAddresses;

            hMailServer.GreyListingWhiteAddress address = addresses.Add();
            address.Description = "helo1";
            address.IPAddress   = "1.1.1.1";
            address.Save();

            address             = addresses.Add();
            address.Description = "helo2";
            address.IPAddress   = "2.2.2.2";
            address.Save();
        }
Example #2
0
        private void buttonEditWhiteList_Click(object sender, EventArgs e)
        {
            if (listWhitelistingRecords.SelectedItems.Count != 1)
            {
                return;
            }

            int id = Convert.ToInt32(listWhitelistingRecords.SelectedItems[0].Tag);
            GreyListingWhiteAddresses addresses = APICreator.GreylistingWhiteAddresses;

            hMailServer.GreyListingWhiteAddress whiteAddress =
                addresses.get_ItemByDBID(id);

            formGreyListingWhiteAddress whiteDlg = new formGreyListingWhiteAddress();

            whiteDlg.LoadProperties(whiteAddress);

            if (whiteDlg.ShowDialog() == DialogResult.OK)
            {
                whiteDlg.SaveProperties(whiteAddress);

                whiteAddress.Save();

                ListWhiteListAddresses();
            }

            Marshal.ReleaseComObject(whiteAddress);
            Marshal.ReleaseComObject(addresses);
        }
Example #3
0
        public void TestGreyListingWhiteListWildcard()
        {
            _antiSpam.GreyListingEnabled = true;

            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            hMailServer.GreyListingWhiteAddresses whiteAddresses = _antiSpam.GreyListingWhiteAddresses;
            hMailServer.GreyListingWhiteAddress   whiteAddress   = whiteAddresses.Add();
            whiteAddress.IPAddress = "127.0.0.5";
            whiteAddress.Save();

            Assert.IsFalse(SMTPClientSimulator.StaticSend("*****@*****.**", account.Address, "Test", "Test"));

            whiteAddress.IPAddress = "*";
            whiteAddress.Save();

            Assert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", account.Address, "Test", "Test"));

            POP3Simulator.AssertGetFirstMessageText(account.Address, "test");
        }
Example #4
0
        private void buttonAddWhiteList_Click(object sender, EventArgs e)
        {
            formGreyListingWhiteAddress whiteDlg = new formGreyListingWhiteAddress();

            if (whiteDlg.ShowDialog() == DialogResult.OK)
            {
                hMailServer.Application app              = APICreator.Application;
                hMailServer.Settings    settings         = app.Settings;
                hMailServer.AntiSpam    antiSpamSettings = settings.AntiSpam;
                hMailServer.GreyListingWhiteAddresses greyListingWhiteAddresses = antiSpamSettings.GreyListingWhiteAddresses;
                hMailServer.GreyListingWhiteAddress   whiteAddress = greyListingWhiteAddresses.Add();

                whiteDlg.SaveProperties(whiteAddress);
                whiteAddress.Save();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(antiSpamSettings);
                Marshal.ReleaseComObject(greyListingWhiteAddresses);
                Marshal.ReleaseComObject(whiteAddress);

                ListWhiteListAddresses();
            }
        }