Sending mail in webquerysave agent doesn't always work

Greetings All - I have the following agent triggered in webquerysave. It’s supposed to send an email when a document is submitted. It only works sometimes. Like in every 5 times I try, I see the e-mail is sent only in one of the times. There is nothing in the server’s log and I know the agent runs because my prints at the end are displayed in the browser. What could be the problem?

Dim sess As NotesSession

Dim dbCur As NotesDatabase

Dim docWeb As NotesDocument

Dim docProfile As NotesDocument

Sub Initialize

Set sess = New NotesSession

Set dbCur = sess.CurrentDatabase	

Set docWeb = sess.DocumentContext

Set docProfile = dbCur.GetProfileDocument("d_profile")



Call notifyDBManager



Print {<head><link href="Global.css" rel="stylesheet" type="text/css"></head>}		

Print {<h3 class="title">Your request is sucessfully submitted.</h3>}

Print {<h6 class="emphasized">The database manager is notified of your request. You will receive an e-mail when your request is processed.</h6>}

Print {<input type="button" value="Close" onclick="window.close()" />}

End Sub

Function notifyDBManager

On Error Goto ErrorHandle	

Dim docMail As NotesDocument

Dim rtiBody As NotesRichTextItem	



Set docMail = dbCur.CreateDocument

Set rtiBody = New NotesRichTextItem(docMail, "Body")

docMail.Form = "Memo"

docMail.SendTo = docProfile.txt_dbManagerEmail(0)

docMail.SaveMessageOnSend = False

docMail.Subject = dbCur.Title & ": New web ID request has been made (Automatic Notification)"

Call rtiBody.AppendText("Greetings,")

Call rtiBody.AddNewline(2)

Call rtiBody.AppendText("This is an automatic e-mail sent by " & dbCur.Title & ". There has been a new web ID Request that requires your action. Please click on the link below to open the request document.")

Call rtiBody.AppendDocLink(docWeb, "Link to the web ID Request")

Call docMail.Send(False,)



Exit Function

ErrorHandle:

Print {<head><link href="Global.css" rel="stylesheet" type="text/css"></head>}	

Print {<p class="title"> Error occured </p>}	

Print {<p class="normal"> Error occured while trying to notify database manager. The task failed in (agt_wqs_webIDRequest) in notifyDBManager function:  } & Error$ & {; } & Cstr(Err) & {; line } & Cstr(Erl) & {</p> }

Print {<p class="emphasized"> Please note this error and contact the Database Manager. </p>}

End

End Function

Subject: sending mail in webquerysave agent doesn’t always work

Basir,I glanced at the code and the line that sticks out to me is…

Call docMail.Send(False,)

Try replacing it with the below line as that comma may be the issue.

Call docMail.Send(False)

Subject: RE: sending mail in webquerysave agent doesn’t always work

Tried it, did not make any difference. There is no error or anything either…