Deleting blocked senders mail while filtering suspected mail in OL

  • Thread starter Thread starter J. Oliver
  • Start date Start date
J

J. Oliver

When blocking a sender's address in OL 2003, Outlook simply moves it
to the Junk Mail Folder. I would like to write a script that
automatically deletes any email which I have already confirmed as spam
(added to the blocked sender's list). I can set Outlook to delete Junk
mail, but it will also delete any suspecting Junk Mail and I risk of
deleting false positives. How could I accomplish this?

- josé
 
The list of blocked senders for 2003 is stored in the registry. See this
key (thanks to Diane Poremsky!):

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles\<profile
name>\0a0d020000000000c000000000000046\001f041a

It's binary, so you have to convert it in your code (a royal pain in the
ass).

You might also be interested in this article that looks at the new junk mail
filter "under the hood":
http://www.mapilab.com/articles/outlook_spam_filter_2.html
 
Eric Legault said:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles\<profile
name>\0a0d020000000000c000000000000046\001f041a

It's binary, so you have to convert it in your code (a royal pain in the
ass).

It is actually stored in UNICODE and fairly simple to retrieve. The
following snippet shows how to read it with VBScript and Windows Scripting
Host (watch the line breaks):

Set objWSHShell = CreateObject("WScript.Shell")
varJunkMail = Array()
intCounter = 0
bstrJunkMailList = ""
strProfileName = "PST"
strRegValue = "HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & strProfileName &
"\0a0d020000000000c000000000000046\001f0419"
bstrJunkMailList = objWSHShell.RegRead(strRegValue)
If UBound(bstrJunkMailList) <> 0 Then
For intCounter = LBound(bstrJunkMailList) To UBound(bstrJunkMailList)
If Hex(bstrJunkMailList(intCounter)) <> 0 Then
strJunkMailList = strJunkMailList & Chr(bstrJunkMailList(intCounter))
Else
strJunkMailList = strJunkMailList & " "
End If
strJunkMailList = Left(strJunkMailList, InStr(1, strJunkMailList, " ") -
1)
strJunkMailList = Replace(strJunkMailList, " ", "")
Next
End If
varJunkMail = Split(strJunkMailList, ";")
For intCounter = LBound(varJunkMail) To UBound(varJunkMail)
If Trim(varJunkMail(intCounter)) <> "" Then
WScript.Echo varJunkMail(intCounter)
End If
Next

Since Microsoft is obvisouly moving to store anything in UNICODE (thanks
God!) the same code can be used for a variety of tasks. The snippet above is
actually cut & paste out of a piece to read the Outlook 2002/2003 master
categories list I did a bunch of years ago when I played with them the first
time and just the registry key has been changed.

No big deal at all...
 
Back
Top