After Mail Arrives agent not working.

Posted on 2005-05-04
Last Modified: 2013-12-18
Sorry for the lengthy detail but want to make sure you know the whole environment.

We have four Lotus Notes Domino R5.0.13 servers, 3 of which handle mail files. One that is setup to handle the main mail routing (call this one Main) and then pass it on to the other two servers if their mail file resides there. (call them Remote and Field)

We created a shared agent to run on the server copy of one of our user’s mail files. The agent was created with the Admin ID. We then went into Notes Administrator and signed the agent with the Field server’s ID. The agent is set up to forward a copy of all mail to the user’s blackberry device via an external internet address. (Call this address Here is copy of the code for reference.

Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim col As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim maildoc As NotesDocument
      Set db = s.currentdatabase
      Set col = db.unprocesseddocuments
      Set doc = col.getfirstdocument
      While Not (doc Is Nothing)
            Set maildoc = db.createdocument
            maildoc.From = doc.From
            maildoc.ReplyTo = doc.From
            maildoc.SendTo = ""
            maildoc.CopyTo = ""
            maildoc.Subject = doc.Subject
            maildoc.Body = doc.Body
            maildoc.Form = "Memo"
            maildoc.Principal = doc.From                  
            maildoc.Send (False)
            Call s.UpdateProcessedDoc( doc )
            Set doc = col.getnextdocument( doc )
End Sub

This agent works perfectly for someone we had created this for a few months ago that resides on the Main server. This user in question resides on the Field server. We cut the code directly out of the working agent and created a new agent from scratch in the user’s mail file and pasted this code into the Lotus Script section of the agent and updated the address only.

In the log.nsf for the Field server we see the following error:

AMgr: Agent 'Blackberry' will not run. It is intended to run on 'MAIN' not ‘Field’

In troubleshooting this issue I have read in several instances to check the $MachineName and verify the name is correct. IT IS NOT! Since the schedule button is greyed out when the choice ‘After New Mail Has Arrived’ is selected, how do I update this field? I have tried changing to ‘On Schedule…’ and then changing the server that way. It updates fine shows Fields as the server to run on. I then save the changes. I check the $MachineName and it properly is set to Field. I then go back into the agent and change the when to run back to ‘After New Mail Has Arrived’ and save those changes. When I check the value of $MachineName it has reverted back incorrectly to Main.

I have checked the server document and the mail server for Field properly reads the hierarchial name of Field. Can someone please give me some direction on how to resolve this? Where else might this information keep resetting itself from? How can I force the agent to run on Field?
Question by:Blackmoorian
    LVL 19

    Expert Comment

    make it Before Mail Arrives and test.
    LVL 4

    Author Comment

    We have with the same results. The $MachineName resets to the wrong server whenever we change from scheduled back to either option contigient upon mail arrival.
    LVL 4

    Author Comment

    We have found a solution....Apparently the home server of the user ID used to create or update the agent, not the owner or administration server of the mail file, is used in this case. When we created a special ID using the Field server as its home server and recreated the agent using that ID the $MachineName always remained Field rather than changing to Main as it had been doing. The agent began working just fine after that.

    If anyone has any further information to add or if they know of another solution, please respond to this post.

    Accepted Solution

    Closed, 250 points refunded.
    Community Support Moderator

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
    This is an old article, please see an updated version of this article, located here:
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now