Solution for Not Archiving Spam (Full Version)

All Forums >> [Messaging] >> GFI MailArchiver for Exchange



Message


FresnoDoug -> Solution for Not Archiving Spam (10.Jun.2008 12:10:16 PM)

I think I have my solution to prevent MailArchiver from archiving spam. First, I configured as many of the MailEssential filters as possible to simply delete the spam. Then, I changed the filters that were set to "Move to user's junk mail folder" to "Move to subfolder of user's mailbox" and set the folder name to "Junk E-mail."  This has the same effect for the user -- the mail is moved to the Junk E-mail folder -- but the mail is not archived.

Then, I created custom toolbar button named "This is NOT Spam" that the user can click to identify false-positives in the Junk E-mail folder. This button runs a macro that does three things: (1) copy the email to the public "This is legitimate mail" folder; (2) copy the email to the "Archive" mailbox (that's the journaling mailbox); (3) move the email to the user's inbox.

Here is the code:

Public Sub ThisIsNotSpam

   If ActiveExplorer.Selection.count < 1 Then
       MsgBox "Please select a mail item.", vbCritical, "Error"
       Exit Sub
   End If

   Dim valitem As Object
   Set valitem = ActiveExplorer.Selection(1)
   If TypeName(valitem) <> "MailItem" Then
       MsgBox "Please select a mail item.", vbCritical, "Error"
       Exit Sub
   End If

   Dim item As MailItem
   Dim item2 As MailItem
   Dim item3 As MailItem

   Dim gfi As MAPIFolder
   Dim inbox As MAPIFolder
   Dim archive As MAPIFolder
   Dim ns As NameSpace
   
   Set ns = GetNamespace("MAPI")
   Set inbox = ns.GetDefaultFolder(olFolderInbox)
   Set gfi = GetFolder("Public Folders\All Public Folders\GFI AntiSpam Folders\This is legitimate email")
   Dim archiveRecipient As Recipient
   Set archiveRecipient = ns.CreateRecipient("Archive")
   archiveRecipient.Resolve
   Set archive = ns.GetSharedDefaultFolder(archiveRecipient, olFolderInbox)
  
   Dim count As Long
   Dim i As Long
   count = ActiveExplorer.Selection.count
   If count = 0 Then Exit Sub
   For i = 1 To count
       Set item = ActiveExplorer.Selection(1)
       Set item2 = item.Copy
       Set item3 = item.Copy
       item.Move inbox
       DoEvents
       item2.Move gfi
       DoEvents
       item3.Move archive
       DoEvents
   Next

End Sub

So far it seems to be working well.




John Letourneau -> RE: Solution for Not Archiving Spam (10.Jun.2008 2:49:59 PM)

FresnoDoug,

Thanks for posting this.  I'm sure there are members of this forum that will appreciate your work.




Deriuz -> RE: Solution for Not Archiving Spam (8.Jul.2008 2:27:19 AM)

are there any alternatives if we didn't use MailEssential filter?

thanks




Page: [1]