Search and Replace patterns of strings with a RULE with any new message received.

Joined
May 4, 2015
Messages
1
Reaction score
0
Good afternoon,
I created the script below to check in Outlook the incoming mail (it's to remark potential URL with spyware). That script works if I run it manually but I don't know how to change it as to make it working as a Rule. Can you kindly give me the details to make it as Rule?

I want to create a rule in Outlook to run that Script with any new incoming message.



Sub RemoveExpression()

Dim outApp As Object
Dim outInsp As Object
Dim outObj As Object
Dim strTextToReplace As String


Set outApp = GetObject(, "Outlook.Application")
Set outInsp = outApp.ActiveInspector
Set outObj = outInsp.CurrentItem

strTextToReplace = "/index.php"
strTextToReplace2 = "/default.php"
strTextToReplace3 = ".exe"
strTextToReplace4 = ".com"


outObj.Body = Replace(outObj.Body, strTextToReplace, "/index.p h p")
outObj.Body = Replace(outObj.Body, strTextToReplace2, "/default.p h p")
outObj.Body = Replace(outObj.Body, strTextToReplace3, ".e x e")
outObj.Body = Replace(outObj.Body, strTextToReplace4, ".c o m")


Set outObj = Nothing
Set outInsp = Nothing
Set outApp = Nothing


End Sub


Thanks for your support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top