set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set colRules =
Session.Stores.DefaultStore.ClientRules
Set oRule = colRules.Create("Test rule", olRuleReceive)
'Specify
the condition in a ToOrFromRuleCondition object
'Condition is if the message is sent by "test@dimastr.com"
Set oFromCondition = oRule.Conditions.From
With oFromCondition
.Enabled =
True
.Recipients.AddEx
"Joe The User",
"test@dimastr.com",
"SMTP"
End
With
'Specify
the action in a MoveOrCopyRuleAction object
'Action
is to move the message to the target folder
set oMoveTarget = Session.Stores.DefaultFolder(olFolderInbox).Folders.OpenOrAdd("Test folder")
Set oMoveRuleAction =
oRule.Actions.MoveToFolder
With oMoveRuleAction
.Enabled =
True
.Folder = oMoveTarget
End
With
'Specify
the exception condition for the subject in a TextRuleCondition object
'Exception condition is if the subject contains "fun" or "chat"
Set oExceptSubject = oRule.Exceptions.Subject
With oExceptSubject
.Enabled =
True
.Text =
Array("fun",
"chat")
End
With
'Update
the rules
colRules.Save
|