Using Redemption for removing Outlook Warning

C

Crossh

I am trying to parse out some data from an incoming email using a rule. I
wanted to eliminate the message "A program is trying to Access email
addresses..." I have installed the redemption.dll and have it referenced.
But when I put a stop in the code, nothing is in the objMail.body during
run-time. What am I doing wrong?

Public Sub MailFiltering(MyMail As MailItem)

Dim objMail As Object
Set objMail = CreateObject("Redemption.SafeMailItem")
If InStr(objMail.Body, "Thank you for submitting your change.") > 0 Then
' do stuff here
End if

End Sub
 
S

Sue Mosher [MVP-Outlook]

You shouldn't need Redemption. All you need is to derive the message from the intrinsic Application object in Outlook VBA:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.Session
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
If InStr(msg.Body, "Thank you for submitting your change.") > 0 Then
' do stuff here
End if

Set msg = Nothing
Set olNS = Nothing
End Sub

For another example of a "run a script" rule actions, see:

http://www.outlookcode.com/codedetail.aspx?id=1494

CAUTION: Using "run a script" rule actions has been known to result in corrupt VBA code. Be sure to export your code modules or back up the VBAProject.otm file.
 

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