【发布时间】:2022-08-24 15:45:46
【问题描述】:
我从输入文件中的文本创建规则。
规则条件之一是检查收到的电子邮件的邮件头,并根据邮件头内容移动电子邮件。
我尝试了 .TEXT 属性无济于事。
我用谷歌搜索但没有任何结果。
我有超过 300 条规则,其中许多都需要消息头测试。
将文本字符串分配给 oRule.Conditions.Subject.Text 时出现相同的错误。
\"运行时错误 \'13\' - 类型不匹配\"
我为这些字段尝试了 String 和 Variant,我得到了同样的信息。
Dim strMessageHeader As Variant Do While Not EOF(1) Input #1, StrRuleName, strCond, strFrom, strSubject, strSentTo, strMessageHeader, strSendersAddress, strMoveTo, strSetCategory \' Create the rule Set oRule = colRules.Create(StrRuleName, olRuleReceive) \' What is the condition? Select Case strCond Case olConditionFrom \' 1 - Condition is \"from\" Set oFromCondition = oRule.Conditions.From With oFromCondition .Enabled = True .Recipients.Add (strFrom) .Recipients.ResolveAll End With Case olConditionSubject \' 2 - Condition is text \"in the subject\" Set oSubjectCondition = oRule.Conditions.Subject With oSubjectCondition .Enabled = True .Text = strSubject End With Case olConditionSentTo \' 12 - Condition is \"sent to a specific email\" Set oSentToCond = oRule.Conditions.SentTo With oSentToCond .Enabled = True .Recipients.Add (strSentTo) End With Case olConditionMessageHeader \' 15 - Condition is text \"in the message header\" Set oMsgHdrCond = oRule.Conditions.MessageHeader With oMsgHdrCond .Text = strMessageHeader End With