Beispiel #1
0
        private void CreateMessageModificationRule(hMailServer.Rules ruleContainer)
        {
            hMailServer.Rule oRule = ruleContainer.Add();
            oRule.Name   = "Criteria test";
            oRule.Active = true;

            hMailServer.RuleCriteria oRuleCriteria = oRule.Criterias.Add();
            oRuleCriteria.UsePredefined   = true;
            oRuleCriteria.PredefinedField = hMailServer.eRulePredefinedField.eFTMessageSize;
            oRuleCriteria.MatchType       = hMailServer.eRuleMatchType.eMTGreaterThan;
            oRuleCriteria.MatchValue      = "0";
            oRuleCriteria.Save();

            hMailServer.RuleAction oRuleAction = oRule.Actions.Add();
            oRuleAction.Type           = hMailServer.eRuleActionType.eRARunScriptFunction;
            oRuleAction.ScriptFunction = "ModifyMessage";
            oRuleAction.Save();

            oRule.Save();

            File.WriteAllText(_settings.Scripting.CurrentScriptFile, "Sub ModifyMessage(oMessage)" + Environment.NewLine +
                              "oMessage.Subject = \"[Spam] \" + CStr(oMessage.Subject)" + Environment.NewLine +
                              "oMessage.Save" + Environment.NewLine +
                              "End Sub");

            _settings.Scripting.Reload();
        }
Beispiel #2
0
        private void buttonAddRule_Click(object sender, EventArgs e)
        {
            hMailServer.Rule rule = _rulesCollection.Add();

            formRule ruleDialog = new formRule(rule);

            if (ruleDialog.ShowDialog() == DialogResult.OK)
            {
                rule.Save();

                ListRules();
            }

            Marshal.ReleaseComObject(rule);
        }
Beispiel #3
0
        private void CreateMoveRule(hMailServer.Rules ruleContainer, string foldername)
        {
            hMailServer.Rule oRule = ruleContainer.Add();
            oRule.Name   = "Criteria test";
            oRule.Active = true;

            hMailServer.RuleCriteria oRuleCriteria = oRule.Criterias.Add();
            oRuleCriteria.UsePredefined   = true;
            oRuleCriteria.PredefinedField = hMailServer.eRulePredefinedField.eFTMessageSize;
            oRuleCriteria.MatchType       = hMailServer.eRuleMatchType.eMTGreaterThan;
            oRuleCriteria.MatchValue      = "0";
            oRuleCriteria.Save();

            hMailServer.RuleAction oRuleAction = oRule.Actions.Add();
            oRuleAction.Type       = hMailServer.eRuleActionType.eRAMoveToImapFolder;
            oRuleAction.IMAPFolder = foldername;
            oRuleAction.Save();

            oRule.Save();
        }