About This Code
Brief Description:
Move Tagged Spam to the junk forder Agent
Contributor:
Frederic Hesse
Last Modified:
05 Oct 2004
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Sub Initialize
Dim s As New NotesSession
Dim doc As NotesDocument
Dim it As NotesItem
Dim SPAM As String
SPAM = "Spam:" ' make this your identifier
Set doc = s.documentcontext
' REMOVE the print statements after testing !!!!!
'Print "--> Spam filtering [From " & doc.From(0) & " to " & doc.sendto(0) & "]"
Set it = doc.GetFirstItem("Subject")
If it Is Nothing Then
Print "Exiting"
Else
Dim stringSPAM
stringSPAM = it.Text
If Instr( stringSPAM, SPAM) = 1 Then
Call doc.PutInFolder("($JunkMail)", False )
Print "--> Spam detected moving to the JunkMail folder ---"
Print "--> Spam From " & doc.From(0) & " to " & doc.sendto(0) & "."
Print "--> Spam Subject: " & doc.subject(0)
Call doc.RemoveFromFolder( "($Inbox)" )
Print "--> Removing mail from inbox ---"
Else
'Print "--> Bypassed Spam Filter from " & doc.from(0) & "."
End If
End If
End Sub
Usage / Example
Whe using a spam filter who tag and deliver mails, you can set up this agent on the mailbox template
in order to move Spam automaticaly to the junk folder.
When spam is detected the agent log it as following:
05.10.2004 15:49:14 Agent printing: --> Spam detected moving to the JunkMail folder ---
05.10.2004 15:49:14 Agent printing: --> Spam From Omni Hotels to XXX@sample.ORG.
05.10.2004 15:49:14 Agent printing: --> Spam Subject: Spam: BUY 2 NIGHTS GET 1 FREE IN ORLANDO
05.10.2004 15:49:14 Agent printing: --> Removing mail from inbox ---
Code Attachments