First, to avoid security issues, create a self certification that you'll use with your macros.
Run the following selfcert program: C:\Program Files\Microsoft Office\OFFICE12\selfcert.exe enter your name or any string there
** Go back to Outlook
Type Alt+F11 (or go to Tools->Macro->Visual Basic Editor)
Right-click on the Projects1 item in the project tree, then click Insert->Module the code window for the new module should open on the right
Paste the following code into that code window:
Sub SpamLearnForward()
Dim mySelection As Outlook.Selection
Dim curObject As MailItem
Dim myMail As MailItem
Dim myDeletedItemsFolder As MAPIFolder
Set mySelection = ActiveExplorer.Selection
Set myDeletedItemsFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems)
For x = 1 To mySelection.Count
Set curObject = mySelection.Item(x)
Set myMail = CreateItem(olMailItem)
myMail.Attachments.Add curObject
myMail.Recipients.Add "spamlearn@spam.iss.net"
myMail.Send
If Not (ActiveExplorer.CurrentFolder.Name = myDeletedItemsFolder.Name) Then
curObject.Move myDeletedItemsFolder
End If
Next x
End Sub
Now click Tools->"Digital Signature"
then click Choose the digital signature that you created in the first step
Save the macro by clicking the save button on the macro editor toolbar
close the macro editor.
Create a custom toolbar button
The following steps are to create a custom button for the spamlearn operation:
1.) Right-click on any of your toolbars in outlook, then click "customize"
2.) Click "Macros" in the categories list, you'll see the spamlearnforward macro on the right.
3.) Drag the spamlearnforward macro to wherever you want in your toolbar
4.) Right-click on the newly dragged icon in your toolbar and click in the name field to shorten it to whatever you want.
5.) Click on "Close" in the Customize dialog box
Now you can use the spamlearn forward by clicking on a spam in your inbox, then clicking on the button you created. you will notice that the spam is forwarded (by checking your sent items) and deleted (by the fact that it is now gone).