New Mail Trigger - Its Broken? (Foreign Domain)

I have created a foreign domain, called “SMTPPage”, and setup the Gateway mail file name is set to smtppapp.nsf, an application that sends out pages.

Now the deal is this, when a new document is mailed into this application, it is supposed to be processed by an agent. The agent is called “New Mail Trigger”, and the only thing this agent does is run the following code.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim agentLog As New NotesLog("Agent log") 

Dim agent As NotesAgent



Set db = session.CurrentDatabase

Set agent = db.GetAgent( "(Trigger Send Page)" )	

Call agentLog.OpenAgentLog

Call agentLog.LogAction( "About to call Trigger Send Page" )

Call agent.Run	'The sole purpose of this agent is to run this line, which runs the Trigger Send Page agent

Call agentLog.LogAction( "Just called Trigger Send Page" )

Call agentLog.Close 

End Sub

Here is how (for one brief day) this application worked. People and applications would send mail to specific addresses that were routed to the foreign domain “SMTPPage”. They would be routed to my smtppapp.nsf. When the new mailed, my agent would kick off within minutes and run the “(Trigger Send Page)” agent. When this was first set up, I was actually able to run “tell amgr sched” and actually watch agent manager recognize the mail delivered, schedule the “New Mail Trigger” agent, and run it. It was beautiful.

Now, I am depths of despair. It has stopped working, and I do not know why.

When I run it manually, it works perfectly. The new mail trigger agent calls the other agent, pages are processed, and cell phones and text pagers start buzzing all around the country.

When I run it manually I get this:

Started running agent ‘New Mail Trigger’ on 05/15/2005 05:33:37 PM

Running on new mail messages: 0 total

Found 0 document(s) that match search criteria

05/15/2005 05:33:46 PM: About to call Trigger Send Page

05/15/2005 05:33:47 PM: Just called Trigger Send Page

Ran LotusScript code

Done running agent ‘New Mail Trigger’ on 05/15/2005 05:33:47 PM

When I “Test” the agent, the result was this…

The following will occur when this agent is run:

‘CN=Jason Freis/O=wfstestnotes’ has unrestricted rights to run LotusScript/Java agents on ‘CN=wfstestnotes1/O=wfstestnotes’.

Allow restricted operations flag is de-selected in this agent. Restricted operations will be disallowed.

Agent will be run by the Agent Manager after new mail messages are delivered.

Home mail server for ‘CN=Jason Freis/O=wfstestnotes’ is ‘CN=wfstestnotes1/O=wfstestnotes’.

Started running agent ‘New Mail Trigger’ on 05/15/2005 05:13:30 PM

Running on new mail messages: 0 total

Found 0 document(s) that match search criteria

Testing: Ran LotusScript code

Done running agent ‘New Mail Trigger’ on 05/15/2005 05:13:39 PM

Does anyone have any suggestions as to how this agent would begin to run when new mail was delivered???

Here is what I have tried:

  1. Restarted agent manager

  2. Restarted the server

Subject: New Mail Trigger - Its Broken? (Foreign Domain)

What do you see on the server console when you expect this agent to work (and it does not)? What does the agent manager queue look like when this agent is supposed to run? It sounds like the problem is with triggering the agent and you should see some additional information on the server console if you turn on agent manager debugging.

Subject: RE: New Mail Trigger - Its Broken? (Foreign Domain)

Becca,

Thank you for your response! Sorry for the delay… Yes, that is exactly what I thought. So, here goes…

When I turned on Debug_Amgr=* and restarted the server here is what I get. The agent name is “New Mail Trigger”.

When the server restarted, AMgr recognizes it as a new mail task and schedules it to run…

05/24/2005 07:40:38 PM AMgr: Agent ‘New Mail Trigger’ in ‘smtppapp.nsf’ added as a new mail triggered task

05/24/2005 07:40:38 PM AMgr: Agent ‘New Mail Trigger’ is scheduled to run next at: 05/24/2005 07:40:38 PM

A few seconds later, AMgr starts it and it runs… taking 1596 ticks

05/24/2005 07:40:47 PM AMgr: Start executing agent ‘New Mail Trigger’ in ‘smtppapp.nsf’ by Executive ‘1’

05/24/2005 07:40:47 PM AMgr: ‘Jason Freis/wfstestnotes’ is the agent signer of agent ‘New Mail Trigger’ in ‘smtppapp.nsf’

05/24/2005 07:40:47 PM AMgr: 'Agent ‘New Mail Trigger’ in ‘smtppapp.nsf’ will run on behalf of ‘Jason Freis/wfstestnotes’

deleted log entries having nothing to do with AMgr

05/24/2005 07:41:12 PM AMgr: Agent ‘New Mail Trigger’ in ‘smtppapp.nsf’ ran successfully; elapsed time was ‘1596’ ticks

Ok, so based on these entries, my guess is that the agent ran perfectly, without any troubles due to authority, or home mail servers or any of that. But, and its a big but, it was scheduled to run only because thats what AMgr does to all agents when the server is rebooted.

“What happens when mail is routed to this application?” you may ask…

“Nothing” I respond weeping softly.

A few moments after the agent ran successfully upon reboot, I sent a mail message…

05/24/2005 07:46:57 PM Router: Transferred 1 messages to WFSTESTNOTES1/WFSTESTNOTES via Notes

05/24/2005 07:46:57 PM Router: Transferring mail to WFSTESTNOTES1/WFSTESTNOTES via Notes

05/24/2005 07:47:01 PM Router: Message 00044875 transferred to WFSTESTNOTES1/WFSTESTNOTES for 8174562959@SMTPPAGE via Notes

Remeber that this whole deal is using a Foreign Domain called “SMTPPAGE” to route mail to a particular application called smtppapp.nsf.

Based on the mail routing log entries above, the mail was delivered by the router, and because I wanted to make sure, I confirmed that the mail arrived in the application. Now, all full of excitement, I wanted to watch AMgr schedule and then execute the “New Mail Trigger” agent so I went to the server console and did “tell amgr schedule”. Here were the responses, note the times…

05/24/2005 07:47:38 PM Remote console command issued by Jason Freis/wfstestnotes: tell amgr schedule

tell amgr schedule

S S 07:49 PM Today Confirm Pages smtppapp.nsf

S S 07:58 PM Today Expired Pages smtppapp.nsf

V M New Mail Trigger smtppapp.nsf

05/24/2005 07:47:56 PM Remote console command issued by Jason Freis/wfstestnotes: tell amgr schedule

tell amgr schedule

S S 07:49 PM Today Confirm Pages smtppapp.nsf

S S 07:58 PM Today Expired Pages smtppapp.nsf

V M New Mail Trigger smtppapp.nsf

05/24/2005 07:49:18 PM Remote console command issued by Jason Freis/wfstestnotes: tell amgr schedule

tell amgr schedule

S S 07:49 PM Today Confirm Pages smtppapp.nsf

S S 07:58 PM Today Expired Pages smtppapp.nsf

V M New Mail Trigger smtppapp.nsf

Then, I launched a browser, came to this site, composed this entire response to your message in hopes of providing some additional data that would allow some brilliant person (like yourself) in our notes community to come up with a reasonable cause of my servers stubborn unwillingness to run an agent when new mail is delivered.

Then, just to be sure, I checked the application again. The document was still there, unprocessed, and “tell amgr schedule” still displays the disappointing “V M”. Note the timestamp… (according to my calculations a new mail document has been sitting for a long time).

05/24/2005 08:09:14 PM Remote console command issued by Jason Freis/wfstestnotes: tell amgr schedule

tell amgr schedule

S S 08:10 PM Today Confirm Pages smtppapp.nsf

S S 08:14 PM Today Expired Pages smtppapp.nsf

V M New Mail Trigger smtppapp.nsf

So, the router deposits new mail into the application at 7:47:01PM and by the time 8:09:14PM rolls around, still has not kicked off an agent that appears to have the authority to run.

Now, please keep in mind that I am a novice with AMgr, and have not used agents using the “After new mail arrives” event very often (mostly because of goofy results like we see here). So, please be gentle if the error is obvious :wink: