OpenNTF.org - Agent for Mail template. Move
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Agent for Mail template. Move spam mail tagged by spamfilter. 
Rating:
Not Rated Yet 
Contributor:
francesco marzolo 
Category:
Lotusscript 
Type:
Email 
Document Release:
01 
Notes Version:
R5.x, R6.x 
Last Modified:
02 May 2005 
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
This agent allow identifying those memo messages that are checked by a Third Party

spam filter software that put onto them field containing a score of suspect spam.
This is not an antispam itself, it is a implementation that allow to identify memos tagged
with a special field and treat them to make not visible at all in user mailboxes.


Agent Information
Name: BeforeNewMailAntiSpam
Last Modification: 02/05/2005 15.41.05
Comment: [Not Assigned]
Shared Agent: Yes
Type: LotusScript
State: Enabled
Trigger: Before New Mail Arrives
Acts On: Each incoming mail document
LotusScript Code:
Option Public
Option Declare
Option Compare Nocase
%REM
Update history: *************
2005-04-02 Francesco Marzolo fecit
******************************
This agent allow identifying those memo messages that are checked by a Third Party
spam filter software that put onto them field containing a score of suspect spam.
This is not an antispam itself, it is a implementation that allow to identify memos tagged
with a special field and treat them to make not visible at all in user mailboxes.
Software that filter messages are many, as:
- Spamassassin
- Lyris MailShield
- Webwasher SpamEquator
- Finjan Vital Security
- Panda GateDefender
- Mailshell Gateway
- Mailshell for Sendmail Plugin
1) put this agent in a user mailbox (or its template), make it "Before new mail ..." triggered
2) create a notes mailbox (without either user or mail-in database record)
TIP: create a mailbox with very little mail template r63mail.ntf (client), to avoid owner problems
3) make sure that signer of agent is able to create document in the step 2 mail db
'modify freely, please UPDATE history, not replace. ThYoVeMu
%ENDREM
' Analyze a field of name
Const strSpamFieldName="X_Spam_Status"
' for the presence of a string containing "hits=99,99 ..."
Const scoreHits="hits="
Const scorelimit=5
'put the memo in the following mailbox, same server
Const strSpamMailboxName ="mail\PostaSpam.nsf"
Sub Initialize
Dim session As NotesSession
Set session = New NotesSession
Dim docMemo As NotesDocument,item As notesitem, hits As Double,part As String
Dim dbSpam As notesdatabase
Dim SpamMemo As notesdocument
On Error Goto errorWhere
Set docMemo = session.DocumentContext
'Put in folder required to have anyway document in Inbox
Call docMemo.PutInFolder("($Inbox)")
Print "Now look at subject: " & docMemo.subject(0)
If docMemo.HasItem(strSpamFieldName ) Then
Set dbSpam=New notesdatabase(session.CurrentDatabase.Server,strSpamMailboxName)
If Not (dbspam.IsOpen) Then
Print session.CurrentDatabase.FilePath & "/" & session.CurrentAgent.name & ": Not able to open destination db: " & session.CurrentDatabase.Server & "!!" & strSpamMailboxName
End If
Set item=docMemo.GetFirstItem(strSpamFieldName)
part=Strright(item.Text,scoreHits)
hits=Val(part)
Print "The document: " & docMemo.subject(0) & " contains " & item.Text & ", hits score=" & hits
If hits>=scoreLimit Then
Print " ... so i put it in dest db."
Set SpamMemo=dbSpam.CreateDocument
Call docMemo.CopyAllItems(SpamMemo)
Call SpamMemo.Save(True,False,True)
Call SpamMemo.PutInFolder("($inbox)")
Call DocMemo.Remove(True)
End If
End If
EndOperations:
Exit Sub
errorWhere:
Print session.CurrentDatabase.FilePath & "/" & session.CurrentAgent.name & ": Error " & Error$ & " alla riga " & Erl
Resume EndOperations
End Sub

Usage / Example
 Comments

No documents found

 Add your comment!