Function UnwantedMessage(olkMsg As Outlook.MailItem) As Boolean
'On the next line edit the keywords/phrases you want to filter out. Use the | character to separate each word/phrase
Const KEYWORDS = "Address change completed|Thank you for your interest in employment |Ad|Internet Explorer 8 Settings"
Dim olkAtt As Outlook.Attachment, objRegEx As Object, colMatches As Object
Set objRegEx = CreateObject("VBscript.RegExp")
With objRegEx
.IgnoreCase = False
.Pattern = KEYWORDS
.Global = True
End With
For Each olkAtt In olkMsg.Attachments
If IsHiddenAttachment(olkAtt) Then
Set colMatches = objRegEx.Execute(olkAtt.FileName)
If colMatches.Count > 0 Then
UnwantedMessage = True
Exit For
End If
End If
Next
Set olkAtt = Nothing
Set objRegEx = Nothing
Set colMatches = Nothing
End Function
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.