/// <summary>
        /// Get the spam action name description.
        /// </summary>
        /// <param name="spamAction">The spam action type to get the description of.</param>
        /// <returns>The spam action type name as a string.</returns>
        public static string GetSpamActionName(SpamAction spamAction)
        {
            var name = string.Empty;

            switch (spamAction)
            {
            case SpamAction.BLOCKED:
                name = "blocked";
                break;

            case SpamAction.DISABLED:
                name = "disabled";
                break;

            case SpamAction.TAG:
                name = "tag";
                break;
            }

            return(name);
        }
Beispiel #2
0
        /// <summary>
        /// Create an instance of the domain request.
        /// </summary>
        /// <param name="domainName">The domain name.</param>
        /// <param name="smtpPassword">The password for SMTP authentication.</param>
        /// <param name="spamAction">The action the domain will have when handling spam.</param>
        /// <param name="wildcard">Will the domain accept email for sub-domains.</param>
        /// <param name="forceDKIMAuthority">Is the domain itself the DKIM Authority, or will it inherit DKIM Authority from root registered domain.</param>
        /// <exception cref="FormatException">The domain name must be a correctly formatted, for reference check RFC 2396 and RFS 2732.</exception>
        /// <exception cref="ArgumentNullException">The domain name and smtp password are required parameters and cannot be null, empty, or whitespace.</exception>
        public DomainRequest(string domainName, string smtpPassword, SpamAction spamAction = SpamAction.DISABLED, bool wildcard = false, bool forceDKIMAuthority = false)
        {
            if (domainName.IsNullEmptyWhitespace())
            {
                throw new ArgumentNullException(nameof(domainName), "DomainName cannot be null or empty!");
            }

            if (smtpPassword.IsNullEmptyWhitespace())
            {
                throw new ArgumentNullException(nameof(smtpPassword), "Smtp Password cannot be null or empty!");
            }

            if (!this.isHostnameValid(domainName))
            {
                throw new FormatException("Domain name is incorrectly formatted!");
            }

            this.domainName         = domainName;
            this.smtpPassword       = smtpPassword;
            this.spamAction         = spamAction;
            this.wildcard           = wildcard;
            this.forceDKIMAuthority = forceDKIMAuthority;
        }
Beispiel #3
0
        private void buttonAccept_Click(object sender, EventArgs e)
        {
            try
            {
                SpamAction spamAction = new SpamAction(textBoxEditMessage.Text, textBoxEditTime.Text, textBoxEditNumber.Text, textBoxEditDelay.Text);
                if (spamAction.SpamMessage == "")
                {
                    throw null;
                }

                lists.EditAllAt(Index, spamAction);
                if (Working)
                {
                    lists.threadList[Index].Start();
                    lists.threadList[Index].Suspend();
                }

                this.Close();
            }
            catch
            {
                MessageBox.Show(lang[LanguageManager.Names.MBArgError], lang[LanguageManager.Names.MBTitle], MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void DomainRequest_Should_Generate_NonEmpty_JsonObject(string domainName, string smtpPassword, SpamAction spamAction, bool wildcard, bool authority)
        {
            var domainRequest = new DomainRequest(domainName, smtpPassword, spamAction, wildcard, authority);

            var json = domainRequest.ToJson();

            Assert.NotEmpty(json);
        }
        public void DomainRequest_Should_Generate_NonEmpty_FormContent(string domainName, string smtpPassword, SpamAction spamAction, bool wildcard, bool authority)
        {
            var domainRequest = new DomainRequest(domainName, smtpPassword, spamAction, wildcard, authority);

            var formContent = domainRequest.ToFormContent();

            Assert.NotEmpty(formContent);
        }
        public void Initialize_DomainRequest_Should_Have_Same_Values_As_When_Created(string domainName, string smtpPassword, SpamAction spamAction, bool wildcard, bool authority)
        {
            var domainRequest = new DomainRequest(domainName, smtpPassword, spamAction, wildcard, authority);

            Assert.Equal(domainName, domainRequest.DomainName);
            Assert.Equal(smtpPassword, domainRequest.SmtpPassword);
            Assert.Equal(spamAction, domainRequest.SpamAction);
            Assert.Equal(wildcard, domainRequest.Wildcard);
            Assert.Equal(authority, domainRequest.ForceDKIMAuthority);
        }
Beispiel #7
0
 public abstract int GetSpamConfidenceLevelThreshold(SpamAction action, int defaultValue);