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