hi all...
I wanted an easy way for users to report misidentified spam/ham especially in the early stages of training my assp db...
here is a macro that works in outlook 2002(xp)
you have to first install redemption which can be found here
spam reporting macro:-----------------------------------------------
Sub ForwardToSpam()
Dim objOL As Outlook.Application
Dim objSelection As Outlook.Selection
Dim objMsg As Object
Dim objNewMsg As Object
On Error Resume Next
' Instantiate an Outlook Application object
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects
Set objSelection = objOL.ActiveExplorer.Selection
' This code sends the all of the selected mail items
' one at a time.
For Each objMsg In objSelection
' This code sends one selected mail item at a time
If objMsg.Class = olMail Then
' Create a new mail item
Set objNewMsg = Application.CreateItem(olMailItem)
' send the new mail item to the spam reporting email address
objNewMsg.To = "assp-spam@yourdomain.com"
objNewMsg.Subject = objMsg.Subject
'save the new mail before adding attachments
objNewMsg.Save
' add selected mail item as attachment to new mail item
objNewMsg.Attachments.Add objMsg
' send the new mail item
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
objSafeMail.Item = objNewMsg
objSafeMail.Send
' Clear the New Mail Item object
Set objNewMsg = Nothing
' Delete the spam mail item
objMsg.Delete
End If
Next
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
Dim oBtn As CommandBarButton
Set oBtn = Application.ActiveExplorer.CommandBars.FindControl(1, 5488)
oBtn.Execute
Set oBtn = Nothing
MsgBox "Thank you for reporting spam!"
End Sub
What this will do is allow you to control click on multiple spam emails and then click on a button on your outlook toolbar to forward them as attachments to your assp web interface. This process will delete the offending email. I updated the the macro so that you don't have to push send receive anymore
Here is the macro to report misidentified ham or good email----------------------
Sub ForwardToNotSpam()
Dim objOL As Outlook.Application
Dim objSelection As Outlook.Selection
Dim objMsg As Object
Dim objNewMsg As Object
On Error Resume Next
' Instantiate an Outlook Application object
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects
Set objSelection = objOL.ActiveExplorer.Selection
' This code sends the all of the selected mail items
' one at a time.
For Each objMsg In objSelection
' This code sends one selected mail item at a time
If objMsg.Class = olMail Then
' Create a new mail item
Set objNewMsg = Application.CreateItem(olMailItem)
' send the new mail item to the spam reporting email address
objNewMsg.To = "assp-notspam@yourdomain.com"
objNewMsg.Subject = objMsg.Subject
'save the new mail before adding attachments
objNewMsg.Save
' add selected mail item as attachment to new mail item
objNewMsg.Attachments.Add objMsg
' send the new mail item
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
objSafeMail.Item = objNewMsg
objSafeMail.Send
' Clear the New Mail Item object
Set objNewMsg = Nothing
End If
Next
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
'send and receive
Dim oBtn As CommandBarButton
Set oBtn = Application.ActiveExplorer.CommandBars.FindControl(1, 5488)
oBtn.Execute
Set oBtn = Nothing
MsgBox "Thank you for reporting misidentified spam. "
End Sub
There is another macroset that works for outlook 2003 that doesn't require hitting send/receive or the redemption dll. I will post that sub in a day or two. NOTE this macro will not delete the good spam after reporting
Good luck to all...
and thank you Martin for making such a magnificent HMS program.....