Solved

how can I block all emails with html content

Posted on 2002-05-27
10
158 Views
Last Modified: 2010-04-08
I want to filter out all msgs that I receive in outlook 2000 that have html as the body, as these are invariably junk.
ie. Any msgs that are ordainary text, allow into inbox
    any msgs with html as the body text, move to junk folder

Any ideas on how I might do this?

Cheers
Duncan
0
Comment
Question by:blarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 7037449
I would probably go with a VBA macro/event sink that checks the length of the htmlbody propery and then moves the item.

For an example on how to convert a message from html to plain text can be found at http://www.slipstick.com/dev/code/zaphtml.htm (note: with a little modification of this code, it will solve the first paragraph.)
0
 
LVL 23

Expert Comment

by:slink9
ID: 7038949
If you are not interested in vba coding, you can go third-party.  Pop Agent sounds like an interesting alternative for email purposes - http://www.imesoftware.com/popagent.htm
0
 

Author Comment

by:blarts
ID: 7043919
The VBA option sounds good, however I don't know how to set about doing this as my programming skills are on mainframes (old dinosaur that I am)
Any chance of an idiots step by step guide to inplementing a suitable macro?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 16

Expert Comment

by:Neo_mvps
ID: 7046214
Sure... this code is a bit weird because outlook isn't allowing me to move the original item.  so this code makes a copy and moves it to a folder named Junk Mail right under the inbox and then deletes the original.

steps for you...
* Press CTRL+F11
* Go to ThisOutlookSession and paste in the following


Option Explicit
Private WithEvents olInboxItems As Items

Private Sub Application_Startup()

  Dim objNS As NameSpace
  Set objNS = Application.GetNamespace("MAPI")
  ' instantiate objects declared WithEvents
  Set olInboxItems = _
    objNS.GetDefaultFolder(olFolderInbox).Items
  Set objNS = Nothing
End Sub

Private Sub Application_Quit()
  ' disassociate global objects declared WithEvents
  Set olInboxItems = Nothing
End Sub

Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
  Dim objFolder As Outlook.MAPIFolder
  Dim objTemp As Object
  ' On Error Resume Next

  If Item.HTMLBody <> vbNullString Then
    Set objFolder = _
      Application.Session.GetDefaultFolder(olFolderInbox)

    Set objFolder = objFolder.Folders.Item("Junk Mail")
    Set objTemp = Item.Copy
    Call objTemp.Move(objFolder)
    objTemp.Close (olSave)
    Item.Delete
  End If
  Set Item = Nothing
End Sub



0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 7046218
I should mention this... this method can end up missing items to copy/delete.  there is a timing issue in outlook where it won't call the event for every message. so if you end up getting 20 or more items at once, expect the code to miss a few.
0
 
LVL 1

Accepted Solution

by:
tcav earned 500 total points
ID: 7056078
I already have a Rules Wizard rule that does just mhat you're looking for.

Create a rule like this:

Apply this rule after the message arrives
with : text/html in the message header
...

and then do what you want with with the message.

IMPORTANT: the search text must be ": text/html" minus the quotes but with a space between the colon and text/html.

Tom
0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 7056190
Nice suggestion about the rules wizard -- but it fails when running against a Microsoft Exchange server and the message comes from another person in the same site/org. (There is no internet header to search)
0
 
LVL 1

Expert Comment

by:tcav
ID: 7057102
True.

But blarts wants to block junk mail (and so do I.) It's unlikely that he (I'm presuming blarts is male) would want to block an html message that originated from his own Exchange Server.
0
 

Author Comment

by:blarts
ID: 7057429
Many thanks mate, that seemed to work perfectly. (Yes I am male!)

0
 

Author Comment

by:blarts
ID: 7057453
Many thanks for your help Neo. I implemented the code but need to get the folders name sorted out. I'm quite keen to get the hang of VBA coding so I'll be having a close look at the code you kindly sent me when I get back from holiday.
In the meantime the rules wizard solution seems to be working fine for what I need. I'd like to be able to show my appreciation for your help with points/grade but don't seem to be able to do so now having accepted tcav's answer. For what its worth, I thought it was A1. Cheers!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question