Before Mail Arrives Agent - LotusScript

Hi All

I have created the following agent with the trigger of Before New Mail Arrives.

I the mailin database where the agent lives received an email where the subject matches “Test Email” it will forward the email on to another email address.

The agent works fine until the email received contains an attachment.

I know that it processed the email because the original email gets some fields updated and is stored in the mailin database. But the email is not sent on to the forwarding address.

As soon as the email is sent again without the attachment it works.

I have checked the logs and can not see any record the the email being routed, or held, there is nothing in the mail boxes on the server

Any ideas?

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument    

Set db = session.CurrentDatabase

’ Get all documents agent should run on e.g. Mailed documents

Set collection = db.UnprocessedDocuments

’ Loop around each document

Set doc = session.documentcontext



If doc.Subject(0) = "Test Email" Then

	Call doc.replaceitemvalue("intForwarded",1)

	Call doc.replaceitemvalue("Principal","Joe Bloggs/OU/O")

	Call doc.Save( True, True )

      	' Set who should recieve doc

	doc.sendto = "Seymour Butts@MYDomain"

      	' Set Subject

	doc.subject = "Reply from AutoForward - " + " Subject: " + doc.subject(0)

      	' Send document

	Call doc.send(False)

End If

Subject: Before Mail Arrives Agent - LotusScript

Look in the Log.nsf and see if there are any errors recorded there. Because you are just re-using the same document I can’/t see why having an attachmnet would make any difference one way or the other.

Subject: RE: Before Mail Arrives Agent - LotusScript

  1. There is nothing being recorded in the log for the agent

  2. As it is a before mail arrives agent and being run by the router, does it list in the log file?