How I apply 'Rules and Alerts' for searching specific HTML Tags

G

Guest

How I apply 'Rules and Alerts' for searching specific HTML Tags in an E-Mail
message? I keep on getting an HTML type E-Mail that contains only an
image on it and I would like to apply a rule to search for a specific HTML
Tag or wording within the e-mail so that I can transfer it to a 'Junk E-Mail'
folder.
 
B

Brian Tillman

TNSFED said:
How I apply 'Rules and Alerts' for searching specific HTML Tags in an
E-Mail message?

I've never found Outlook's rules to be able to act upon HTML tags.
 
G

Guest

It is a shame because Spammers are getting smarter and are starting to use
images rather than text to spam their products.
 
G

Guest

It is a shame because Spammers are getting smarter and are starting to use
images rather than text to spam their products. This something that
Microsoft should look into.
 
G

Guest

I'm interested in the 'img' tag but if I can detect any type of HTML Tag,
that would be great.
 
G

George Hester

Well you cannot really do that. You might be able to detect most HTML 4.01 tags but that is not all the tags
you'll need to dectect. Note these are HTML tags in spam; <junkorama>s<jumphigh>ex will not
appear</junkorama>. Thse are not valid tags and is one way how Spammers avoid words in their missives
from being detected. You won't catch "sex" for example and if I removed the <junkorama> tags "sex"
would apperar but you cannot catch it with rules.

It is required in HTML for an active link to have <a ... href=>...</a>. That is the minimum. For images to
appear in the HTML that are served the minimum requirement is <img ... src=...>. Every thing else is just
dreck that can have multiple ways of insterspersing valid and invalid to outwit rules or whatever you have to
"DETECT."

But then you must also consider that Plain text with www.microsoft.com will appear as an active link like
you see now. That is a result of rendering which Outlook sometimes does to make you a happy camper.
Images will not work here though.
 
G

Guest

There is only one solution to this problem is to create a VBA program that run
everytime a new mail is recieved (Application_NewMail event). Here is a
Sample:

Option Explicit
Dim sSearchObj() As String
Dim iSearchCnt As Integer

Private Sub Application_NewMail()
Me.RunHTMLRule
End Sub

Public Sub SetupSearchObjects()
' Add Search Items Here.
' If Found, the mail in question will be moved to the Junk folder
iSearchCnt = 1
ReDim sSearchObj(iSearchCnt)
sSearchObj(0) = "src=""cid:[email protected]"""
sSearchObj(1) = "src=""cid:389708c4d3c0$2180fea0$835aa7c0@FJNRZI"""
End Sub

Public Sub RunHTMLRule()
Dim oNS As NameSpace
Dim oMF_Inbox As MAPIFolder
Dim oMF_Junk As MAPIFolder
Dim oMI As MailItem
Dim i As Integer

Me.SetupSearchObjects

Set oNS = Me.GetNamespace("MAPI")
Set oMF_Inbox = oNS.GetDefaultFolder(olFolderInbox)
Set oMF_Junk = oNS.GetDefaultFolder(olFolderJunk)

Set oMI = oMF_Inbox.Items.GetLast

For i = 0 To iSearchCnt
If InStr(1, " " & oMI.HTMLBody, sSearchObj(i), vbTextCompare) > 0 Then
oMI.Move oMF_Junk
End If
Next
End Sub

I tested it out an it works.
 
G

George Hester

Well yes. Unfortunately Microsoft with later versions of Outlook is makeing looking at the body of received email Nag central. You cannot do that without being at the machine to dismiss the nag. That's "progress" for you.
 

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