Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1339
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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