• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1336
  • Last Modified:

lotus notes agent to move incoming mail to folder (based on part of subject)

i would like to have an agent that moves an incoming mail to a folder,
but only mails that contain a certain text in the mail body.
other mails will stay in the inbox or will be ove to another folder based on another text.

eg. when the subject contains the text '52.9 ritverzamellijst', the incoming mail should be moved to the same folder '52.9 ritverzamellijst'.
i tried with the attached code, but apparently there's something wrong with the routines that find the text in the body, because the mail stays in the inbox and is not moved.

any expert can fix this code ?
Sub Initialize
	Dim s As New NotesSession
	Dim doc As NotesDocument
	Dim it  As NotesItem
	Dim SPAM As String
	myident = "52.9 ritverzamellijst" ' make this your identifier 
	Set doc = s.documentcontext
	
	Print "Processing " & doc.subject(0) " from " & doc.From(0)
	Set it = doc.GetFirstItem("Body")
	If it Is Nothing Then
		Print "Exiting"
	Else
		Dim stringMyIdent
		stringMyIdent = it.Text
		If Instr( stringMyIdent, myident ) > 0 Then
			Call doc.PutInFolder("52.9 ritverzamellijst", False )
			Print "--> moving to folder  ---"
			Call doc.RemoveFromFolder( "($Inbox)" )
			Print "--> removing from inbox ---"
		Else
			Print "--> does not contain 52.9 ritverzamellijst ---"
		End If
	End If
End Sub

Open in new window

0
Lieven Embrechts
Asked:
Lieven Embrechts
  • 2
  • 2
1 Solution
 
daj_ukCommented:
Would it not be simpler to use a mail rule?  As this feature is already built into the mail template

0
 
Lieven EmbrechtsSenior IT ConsultantAuthor Commented:
a mail rule on mail BODY ?  i use notes 7.0.2.
0
 
daj_ukCommented:
yes, see attached screen shot...
screen.jpg
0
 
Lieven EmbrechtsSenior IT ConsultantAuthor Commented:
yup, it's already solved.
i forgot there's something like 'mail rules' next to 'quick rules'.
or i need glasses...
thanks for your quick help !
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now