I have an agent that runs if documents have been created or modified. The agent uses the NotesDocument Send method to send an email. The agent keeps failing with an error 4000 "The remote server is not a known TCP/IP host."
The server is able to ping the host portion of the email address. The agent also works when I run it manually from my client.
I searched the discussion groups for hours to no avail.
Here is the code:
Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument Dim docCurrent As NotesDocument Dim docMail As NotesDocument Dim item As NotesItem Set db = session.CurrentDatabase Set view = db.GetView( "Requests" ) Set doc = view.GetFirstDocument While Not (doc Is Nothing) 'Notify requester of the change Set docMail = New NotesDocument(db) Set item = docMail.ReplaceItemValue("Form", "Memo") Set item = docMail.ReplaceItemValue("SendTo", doc.EMail(0)) Set item = docMail.ReplaceItemValue("Subject", "Your Pump Doctor Password") Set rti = New NotesRichTextItem(docMail, "Body") Call rti.AppendText("Thank you for registering.") Call rti.AddNewLine(2) Call docMail.Send(False) 'Now set flag so the request will not get reprocessed. Set docCurrent = doc Set doc = view.GetNextDocument(doc) docCurrent.Processed = "Y" Call docCurrent.Save(True, False) Wend
I wish I could help you with this, but it looks like it would take some detailed debugging. We are not set up to do this through the SearchDomino expert forums. You can understand why, since debugging can sometimes go quickly and sometimes take a very long time.
I will offer one tip though... When code works from the client, but not from the server, the problem is usually permissions rather than a bug. Check the Agent Restrictions in the Security tab of the server document in NAMES.NSF. Make sure the signer (last saver) of the agent has the right permissions to run this agent.
This was first published in August 2001