How do you automatically filter mail in Notes?

Author: Tripp W Black

Created: 08/26/1999 at 07:51 PM

 

Category:
Notes Developer Tips
Agents, LotusScript

How do you automatically filter mail in Notes?

1. Create a folder in your mail database to hold the mail from the mailing list.
2. Create an agent in your mail database.
3. Give it a name.
4. Specify it as "If new mail has arrived".
5. Mark that the agent will run a script, as opposed to simple action or formula.
6. In the Event field, choose Initialize and enter the following script:

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim collection As NotesDocumentCollection
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
For i=1 To collection.Count
Set doc=collection.GetNthDocument(i)
If doc.ReplyTo(0) = "lnotes-l@ozzie.notesnic.net" Then
doc.PutInFolder( "Mailing List\L-Notes" )
doc.RemoveFromFolder( "($Inbox)" )
End If
Next
End Sub

This will place all mail from the mailing L-Notes mailing list and place it in the folder named "Mailing List\L-Notes" whenever
the mail comes in. You can add additional Else statements for any other mailing lists you are subscribed to.
Your administrator will have to give you access to Run Restricted Agents in the server document for your mail server.

previous page