Agent question

Here is my scenario I have single mailfile with multiple aliases user1, user2, user3, etc. let say email is delivered to mailbox for user1@domain.com then base on rule defined in mailbox this message is moved to subfolder called “user1” then agent runs on schedule and sends email from particular folder to particular user, subject line is set to static same for all of this messages send by agent something like “action required”.This was created using Document Selection - Add Condition “in folder user1” and Action - Send Mail with “include a copy of the document in the message”

This does what we need but as number of user’s subfolders is growing and number of users that these messages need to be send are growing this requires more agents to run and more rules to ran so other words if I have 20 aliases in such form userX@domain.com where X is a number I need to have 20 rules to move message to userX folder and then 20 agents to send document to individual email addresses.

Can this be simplified with 1 or 2 agents that would use variables? something like:

if messages TO field is use1@domain.com move to folder user1 then second agent would run thru folders and forward new messages appropriate recipient? there always is 1 to 1 association so in example user1@domain.com message is send including original document to userA@domain.com

one might ask why don’t you create rule “send copy to…” well because original subject line needs to be modified to specific text rule only let me send exactly same copy, where I need to edit and modify received doc or create new one and attach original doc, btw there always is an attachment in these emails, is this doable…

Subject: You could try this

Create an agent in the mail file to run before new mail arrives and the target is each incoming mail doc.

Use the outline of this code and modify where needed. I have not tested this code but I have something similar that forwards email.

Dim session As NotesSession

Dim db As NotesDatabase

	Dim doc As NotesDocument





Set session = New NotesSession	

Set db = session.CurrentDatabase

Set doc = session.DocumentContext		

select case doc.SendTo(0)

case “user1@domain.com” : doc.SendTo = userA@domain.com

case “user2@domain.com” : doc.SendTo = userB@domain.com

…so on and so forth up to user20

	end select

'set new subject line

doc.subject = “new subject”

	Call doc.Send(False) ' if doesn't work then try True 

	

End If

Subject: I’m not a dev person so be patient with me

… while I’m creating this agent I get this message:An operator or semicolon was expected but none was encountered: ‘session’

and session word is red

am I missing anything?

Subject: The code is LotusScript, and you have selected Formula for the language

Subject: typo

Dim session As NotesSession

should have been

Dim session As New NotesSession

(not tested, but 100% sure)